Release v3.2.2 #600
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
- '*.x' | |
pull_request: | |
branches: | |
- master | |
- '*.x' | |
jobs: | |
setup: | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
- 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_BASE_REF#refs/heads/}" | |
else | |
echo "unsupported event: $GITHUB_EVENT_NAME" | |
exit 1 | |
fi | |
if [[ $upstream_branch != master && $upstream_branch != *.x ]]; then | |
echo "assuming there is no branch named ${upstream_branch} in indico; defaulting to master" | |
upstream_branch=master | |
else | |
echo "using indico upstream branch ${upstream_branch}" | |
fi | |
echo "INDICO_BRANCH=${upstream_branch}" >> "$GITHUB_ENV" | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install system dependencies | |
run: sudo apt-get install postgresql-client libpq-dev | |
- name: Create virtualenv | |
run: | | |
python3.11 -m venv .venv | |
source .venv/bin/activate | |
pip install -U pip setuptools wheel | |
- name: Activate virtualenv for later steps | |
run: | | |
echo "VIRTUAL_ENV=$(pwd)/.venv" >> $GITHUB_ENV | |
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH | |
- name: Get pip cache dir | |
id: pip-cache | |
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: Cache pip | |
id: cache-pip | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: pip|${{ runner.os }}|3.11|${{ hashFiles('**/setup.cfg') }} | |
- uses: actions/cache@v3 | |
id: cache-npm | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-npm-${{ hashFiles('package*.json') }} | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
with: | |
node-version: '18.x' | |
- name: Install Indico | |
run: | | |
pip install Babel | |
pip install git+https://github.com/indico/indico.git@${INDICO_BRANCH}#egg=indico[dev] | |
- name: Install node dependencies | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Archive environment | |
run: tar cf /tmp/env.tar .venv node_modules | |
- name: Upload environment | |
uses: actions/upload-artifact@v3 | |
with: | |
name: environment | |
retention-days: 1 | |
path: /tmp/env.tar | |
lint: | |
needs: setup | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v3 | |
- 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_BASE_REF#refs/heads/}" | |
else | |
echo "unsupported event: $GITHUB_EVENT_NAME" | |
exit 1 | |
fi | |
if [[ $upstream_branch != master && $upstream_branch != *.x ]]; then | |
echo "assuming there is no branch named ${upstream_branch} in indico; defaulting to master" | |
upstream_branch=master | |
else | |
echo "using indico upstream branch ${upstream_branch}" | |
fi | |
echo "INDICO_BRANCH=${upstream_branch}" >> "$GITHUB_ENV" | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Download environment | |
uses: actions/download-artifact@v3 | |
with: | |
name: environment | |
path: /tmp | |
- name: Restore environment | |
run: tar xf /tmp/env.tar | |
- 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() | |
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-22.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: citadel | |
- plugin: livesync | |
- plugin: payment_paypal | |
- plugin: storage_s3 | |
- plugin: vc_zoom | |
- plugin: prometheus | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Download environment | |
uses: actions/download-artifact@v3 | |
with: | |
name: environment | |
path: /tmp | |
- name: Restore environment | |
run: tar xf /tmp/env.tar | |
- name: Activate virtualenv for later steps | |
run: | | |
echo "VIRTUAL_ENV=$(pwd)/.venv" >> $GITHUB_ENV | |
echo "$(pwd)/.venv/bin" >> $GITHUB_PATH | |
- name: Install extra dependencies | |
if: matrix.plugin == 'citadel' || matrix.plugin == 'prometheus' | |
run: | | |
pip install -e "${GITHUB_WORKSPACE}/livesync/" | |
- name: Install plugin | |
run: | | |
cd "${GITHUB_WORKSPACE}/${{ matrix.plugin }}" | |
pip install -e . | |
- name: Install redis | |
run: sudo apt-get install redis-server | |
- 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 |