mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-13 07:29:39 +00:00
Use GitHub actions for CI (#100)
Co-authored-by: Adrian Moennich <adrian.moennich@cern.ch>
This commit is contained in:
parent
11c3376f1a
commit
af0054357c
@ -9,7 +9,7 @@ const resolve = require('resolve');
|
||||
const yaml = require('js-yaml');
|
||||
|
||||
// Returns the path to the Indico source package/repo
|
||||
const PATH_COMMAND = `python -c 'from flask.helpers import get_root_path; print get_root_path("indico")'`;
|
||||
const PATH_COMMAND = `python -c 'from flask.helpers import get_root_path; print(get_root_path("indico"))'`;
|
||||
|
||||
let indicoBaseDir = null;
|
||||
const indicoPathFile = path.join(__dirname, '.indico_source');
|
||||
|
||||
17
.github/matchers/flake8-problem-matcher.json
vendored
Normal file
17
.github/matchers/flake8-problem-matcher.json
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "flake8",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^([^:]*):(\\d+):(\\d+): (\\w\\d\\d\\d) (.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"code": 4,
|
||||
"message": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
14
.github/matchers/headers-problem-matcher.json
vendored
Normal file
14
.github/matchers/headers-problem-matcher.json
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "headers",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^((?:Missing|Incorrect) header) in (.+)$",
|
||||
"message": 1,
|
||||
"file": 2
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
260
.github/workflows/ci.yml
vendored
Normal file
260
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,260 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- 2.3-maintenance
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- 2.3-maintenance
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
runs-on: ubuntu-18.04
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Get upstream branch name
|
||||
run: |
|
||||
if [[ $GITHUB_EVENT_NAME == push ]]; then
|
||||
upstream_branch="${GITHUB_REF#refs/heads/}"
|
||||
elif [[ $GITHUB_EVENT_NAME == pull_request ]]; then
|
||||
upstream_branch="${GITHUB_HEAD_REF#refs/heads/}"
|
||||
else
|
||||
echo "unsupported event: $GITHUB_EVENT_NAME"
|
||||
exit 1
|
||||
fi
|
||||
if [[ $upstream_branch != master && $upstream_branch != *-maintenance ]]; then
|
||||
echo "assuming there is no branch named ${upstream_branch} in indico; defaulting to 2.3-maintenance"
|
||||
upstream_branch=2.3-maintenance
|
||||
else
|
||||
echo "using indico upstream branch ${upstream_branch}"
|
||||
fi
|
||||
echo "INDICO_BRANCH=${upstream_branch}" >> "$GITHUB_ENV"
|
||||
|
||||
- uses: actions/cache@v2
|
||||
id: cache-pip
|
||||
with:
|
||||
path: .venv
|
||||
key: indico-v2-${{ runner.os }}-pip
|
||||
|
||||
- uses: actions/cache@v2
|
||||
id: cache-npm
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('package*.json') }}
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
if: steps.cache-pip.outputs.cache-hit != 'true'
|
||||
with:
|
||||
python-version: '2.7'
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v1
|
||||
if: steps.cache-npm.outputs.cache-hit != 'true'
|
||||
with:
|
||||
node-version: '14.x'
|
||||
|
||||
- name: Install system dependencies
|
||||
if: steps.cache-pip.outputs.cache-hit != 'true'
|
||||
run: sudo apt-get install postgresql-client libpq-dev python-virtualenv
|
||||
|
||||
- name: Install python dependencies
|
||||
if: steps.cache-pip.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
virtualenv .venv
|
||||
source .venv/bin/activate
|
||||
pip install -U pip setuptools
|
||||
pip install wheel
|
||||
pip install git+https://github.com/indico/indico.git@${INDICO_BRANCH}#egg=indico
|
||||
pip install flake8 isort
|
||||
|
||||
- name: Activate virtualenv for later steps
|
||||
run: |
|
||||
echo "VIRTUAL_ENV=$(pwd)/.venv" >> $GITHUB_ENV
|
||||
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Re-install indico if cache was used
|
||||
if: steps.cache-pip.outputs.cache-hit == 'true'
|
||||
run: |
|
||||
pip uninstall -y indico
|
||||
pip install git+https://github.com/indico/indico.git@${INDICO_BRANCH}#egg=indico
|
||||
|
||||
- name: Install node dependencies
|
||||
if: steps.cache-npm.outputs.cache-hit != 'true'
|
||||
run: npm ci
|
||||
|
||||
lint:
|
||||
needs: setup
|
||||
runs-on: ubuntu-18.04
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Get upstream branch name
|
||||
run: |
|
||||
if [[ $GITHUB_EVENT_NAME == push ]]; then
|
||||
upstream_branch="${GITHUB_REF#refs/heads/}"
|
||||
elif [[ $GITHUB_EVENT_NAME == pull_request ]]; then
|
||||
upstream_branch="${GITHUB_HEAD_REF#refs/heads/}"
|
||||
else
|
||||
echo "unsupported event: $GITHUB_EVENT_NAME"
|
||||
exit 1
|
||||
fi
|
||||
if [[ $upstream_branch != master && $upstream_branch != *-maintenance ]]; then
|
||||
echo "assuming there is no branch named ${upstream_branch} in indico; defaulting to 2.3-maintenance"
|
||||
upstream_branch=2.3-maintenance
|
||||
else
|
||||
echo "using indico upstream branch ${upstream_branch}"
|
||||
fi
|
||||
echo "INDICO_BRANCH=${upstream_branch}" >> "$GITHUB_ENV"
|
||||
|
||||
- uses: actions/cache@v2
|
||||
id: cache-pip
|
||||
with:
|
||||
path: .venv
|
||||
key: indico-v2-${{ runner.os }}-pip
|
||||
|
||||
- uses: actions/cache@v2
|
||||
id: cache-npm
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('package*.json') }}
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: '2.7'
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '14.x'
|
||||
|
||||
- name: Activate virtualenv for later steps
|
||||
run: |
|
||||
echo "VIRTUAL_ENV=$(pwd)/.venv" >> $GITHUB_ENV
|
||||
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Check import sorting
|
||||
run: isort --diff --check-only .
|
||||
|
||||
- name: Check headers
|
||||
if: success() || failure()
|
||||
run: |
|
||||
wget "https://raw.githubusercontent.com/indico/indico/${INDICO_BRANCH}/bin/maintenance/update_header.py" -O /tmp/update_header.py
|
||||
echo '::add-matcher::.github/matchers/headers-problem-matcher.json'
|
||||
python /tmp/update_header.py --ci
|
||||
echo '::remove-matcher owner=headers::'
|
||||
|
||||
- name: Run flake8
|
||||
if: success() || failure()
|
||||
continue-on-error: true
|
||||
run: |
|
||||
echo '::add-matcher::.github/matchers/flake8-problem-matcher.json'
|
||||
flake8 --format '%(path)s:%(row)d:%(col)d: %(code)s %(text)s'
|
||||
echo '::remove-matcher owner=flake8::'
|
||||
|
||||
test-plugin:
|
||||
needs: setup
|
||||
runs-on: ubuntu-18.04
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:11
|
||||
env:
|
||||
POSTGRES_HOST_AUTH_METHOD: trust
|
||||
ports:
|
||||
- 5432
|
||||
options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- plugin: livesync
|
||||
- plugin: payment_paypal
|
||||
- plugin: vc_zoom
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Get upstream branch name
|
||||
run: |
|
||||
if [[ $GITHUB_EVENT_NAME == push ]]; then
|
||||
upstream_branch="${GITHUB_REF#refs/heads/}"
|
||||
elif [[ $GITHUB_EVENT_NAME == pull_request ]]; then
|
||||
upstream_branch="${GITHUB_HEAD_REF#refs/heads/}"
|
||||
else
|
||||
echo "unsupported event: $GITHUB_EVENT_NAME"
|
||||
exit 1
|
||||
fi
|
||||
if [[ $upstream_branch != master && $upstream_branch != *-maintenance ]]; then
|
||||
echo "assuming there is no branch named ${upstream_branch} in indico; defaulting to 2.3-maintenance"
|
||||
upstream_branch=2.3-maintenance
|
||||
else
|
||||
echo "using indico upstream branch ${upstream_branch}"
|
||||
fi
|
||||
echo "INDICO_BRANCH=${upstream_branch}" >> "$GITHUB_ENV"
|
||||
|
||||
- uses: actions/cache@v2
|
||||
id: cache-pip
|
||||
with:
|
||||
path: .venv
|
||||
key: indico-v2-${{ runner.os }}-pip
|
||||
|
||||
- uses: actions/cache@v2
|
||||
id: cache-npm
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-npm-${{ hashFiles('package*.json') }}
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: '2.7'
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '14.x'
|
||||
|
||||
- name: Activate virtualenv for later steps
|
||||
run: |
|
||||
echo "VIRTUAL_ENV=$(pwd)/.venv" >> $GITHUB_ENV
|
||||
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Install plugin
|
||||
run: |
|
||||
cd "${GITHUB_WORKSPACE}/${{ matrix.plugin }}"
|
||||
pip install -e .
|
||||
|
||||
- name: Setup database
|
||||
run: |
|
||||
export PGHOST=localhost
|
||||
export PGPORT=${{ job.services.postgres.ports[5432] }}
|
||||
export PGUSER=postgres
|
||||
createuser indicotest
|
||||
createdb -O indicotest indicotest
|
||||
psql indicotest -c 'CREATE EXTENSION unaccent;'
|
||||
psql indicotest -c 'CREATE EXTENSION pg_trgm;'
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
export INDICO_TEST_DATABASE_URI="postgresql://indicotest@localhost:${{ job.services.postgres.ports[5432] }}/indicotest"
|
||||
cd "${GITHUB_WORKSPACE}/${{ matrix.plugin }}"
|
||||
pytest --color=yes
|
||||
23
.travis.yml
23
.travis.yml
@ -1,23 +0,0 @@
|
||||
language: python
|
||||
python:
|
||||
- 2.7
|
||||
addons:
|
||||
postgresql: 9.6
|
||||
env:
|
||||
- PLUGIN=livesync
|
||||
- PLUGIN=payment_paypal
|
||||
before_install:
|
||||
- pip install -U pip setuptools
|
||||
- pip install -e git+https://github.com/indico/indico.git@${TRAVIS_BRANCH}#egg=indico
|
||||
install:
|
||||
- cd "${TRAVIS_BUILD_DIR}/${PLUGIN}"
|
||||
- pip install -e .
|
||||
script:
|
||||
- pytest
|
||||
notifications:
|
||||
email: false
|
||||
irc:
|
||||
channels:
|
||||
- 'chat.freenode.net#indico'
|
||||
use_notice: true
|
||||
skip_join: true
|
||||
@ -223,7 +223,9 @@ class ZoomPlugin(VCPluginMixin, IndicoPlugin):
|
||||
})
|
||||
elif room_assoc.link_object != old_link:
|
||||
# the booking should now be linked to something else
|
||||
new_schedule_args = get_schedule_args(room_assoc.link_object) if room_assoc.link_object.start_dt else {}
|
||||
new_schedule_args = (get_schedule_args(room_assoc.link_object)
|
||||
if room_assoc.link_object.start_dt
|
||||
else {})
|
||||
meeting = fetch_zoom_meeting(vc_room)
|
||||
current_schedule_args = {k: meeting[k] for k in {'start_time', 'duration'} if k in meeting}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user