ci: use matrix for tests

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-21 22:47:10 +01:00
parent 4cbeeb9a0c
commit 605ed94ba2
3 changed files with 33 additions and 77 deletions

View File

@ -18,13 +18,24 @@ env:
POSTGRES_PASSWORD: "EK-5jnKfjrGRm<77" POSTGRES_PASSWORD: "EK-5jnKfjrGRm<77"
jobs: jobs:
lint-pylint: lint:
strategy:
matrix:
job:
- pylint
- black
- isort
- bandit
- pyright
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
with: with:
python-version: '3.9' python-version: '3.9'
- uses: actions/setup-node@v2
with:
node-version: '16'
- id: cache-pipenv - id: cache-pipenv
uses: actions/cache@v2.1.6 uses: actions/cache@v2.1.6
with: with:
@ -35,77 +46,7 @@ jobs:
INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }} INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
run: scripts/ci_prepare.sh run: scripts/ci_prepare.sh
- name: run pylint - name: run pylint
run: pipenv run pylint authentik tests lifecycle run: pipenv run make ci-${{ matrix.job }}
lint-black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- id: cache-pipenv
uses: actions/cache@v2.1.6
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
- name: prepare
env:
INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
run: scripts/ci_prepare.sh
- name: run black
run: pipenv run black --check authentik tests lifecycle
lint-isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- id: cache-pipenv
uses: actions/cache@v2.1.6
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
- name: prepare
env:
INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
run: scripts/ci_prepare.sh
- name: run isort
run: pipenv run isort --check authentik tests lifecycle
lint-bandit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- id: cache-pipenv
uses: actions/cache@v2.1.6
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
- name: prepare
env:
INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
run: scripts/ci_prepare.sh
- name: run bandit
run: pipenv run bandit -r authentik tests lifecycle
lint-pyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: prepare
run: |
scripts/ci_prepare.sh
npm install -g pyright@1.1.136
- name: run bandit
run: pipenv run pyright e2e lifecycle
test-migrations: test-migrations:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -279,11 +220,7 @@ jobs:
uses: codecov/codecov-action@v2 uses: codecov/codecov-action@v2
build: build:
needs: needs:
- lint-pylint - lint
- lint-black
- lint-isort
- lint-bandit
- lint-pyright
- test-migrations - test-migrations
- test-migrations-from-stable - test-migrations-from-stable
- test-unittest - test-unittest

View File

@ -94,3 +94,21 @@ web-lint:
web-extract: web-extract:
cd web && npm run extract cd web && npm run extract
# These targets are use by GitHub actions to allow usage of matrix
# which makes the YAML File a lot smaller
ci-pylint:
pylint authentik tests lifecycle
ci-black:
black --check authentik tests lifecycle
ci-isort:
isort --check authentik tests lifecycle
ci-bandit:
bandit -r authentik tests lifecycle
ci-pyright:
pyright e2e lifecycle

View File

@ -7,3 +7,4 @@ if [[ "$INSTALL" != "true" ]]; then
pipenv install --dev pipenv install --dev
fi fi
pipenv run python -m scripts.generate_ci_config pipenv run python -m scripts.generate_ci_config
npm install -g pyright@1.1.136