2021-08-30 19:21:15 +01:00
|
|
|
name: authentik-ci-main
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-09-03 09:53:39 +01:00
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- next
|
|
|
|
- version-*
|
2021-08-30 19:21:15 +01:00
|
|
|
paths-ignore:
|
|
|
|
- website
|
2021-09-03 09:53:39 +01:00
|
|
|
pull_request:
|
2021-09-07 09:06:30 +01:00
|
|
|
branches:
|
|
|
|
- master
|
2021-08-30 19:21:15 +01:00
|
|
|
|
|
|
|
env:
|
|
|
|
POSTGRES_DB: authentik
|
|
|
|
POSTGRES_USER: authentik
|
|
|
|
POSTGRES_PASSWORD: "EK-5jnKfjrGRm<77"
|
|
|
|
|
|
|
|
jobs:
|
2021-11-21 21:47:10 +00:00
|
|
|
lint:
|
|
|
|
strategy:
|
2021-11-21 22:44:09 +00:00
|
|
|
fail-fast: false
|
2021-11-21 21:47:10 +00:00
|
|
|
matrix:
|
|
|
|
job:
|
|
|
|
- pylint
|
|
|
|
- black
|
|
|
|
- isort
|
|
|
|
- bandit
|
|
|
|
- pyright
|
2021-12-03 09:05:21 +00:00
|
|
|
- pending-migrations
|
2021-08-30 19:21:15 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-02 08:56:53 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-03-01 08:18:14 +00:00
|
|
|
- uses: actions/setup-python@v3
|
2022-02-25 08:56:20 +00:00
|
|
|
- uses: actions/setup-node@v3.0.0
|
2021-08-30 19:21:15 +01:00
|
|
|
with:
|
2021-11-21 21:47:10 +00:00
|
|
|
node-version: '16'
|
2021-12-24 22:25:38 +00:00
|
|
|
- id: cache-poetry
|
2022-03-22 09:04:35 +00:00
|
|
|
uses: actions/cache@v3
|
2021-11-14 18:14:18 +00:00
|
|
|
with:
|
2021-12-24 22:25:38 +00:00
|
|
|
path: ~/.cache/pypoetry/virtualenvs
|
2022-01-24 08:37:04 +00:00
|
|
|
key: ${{ runner.os }}-poetry-cache-v2-${{ hashFiles('**/poetry.lock') }}
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: prepare
|
2021-11-14 18:14:18 +00:00
|
|
|
env:
|
2021-12-24 22:25:38 +00:00
|
|
|
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
|
2021-08-30 19:21:15 +01:00
|
|
|
run: scripts/ci_prepare.sh
|
2021-12-19 12:44:34 +00:00
|
|
|
- name: run job
|
2021-12-24 22:25:38 +00:00
|
|
|
run: poetry run make ci-${{ matrix.job }}
|
2021-08-30 19:21:15 +01:00
|
|
|
test-migrations:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-02 08:56:53 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-03-01 08:18:14 +00:00
|
|
|
- uses: actions/setup-python@v3
|
2021-12-24 22:25:38 +00:00
|
|
|
- id: cache-poetry
|
2022-03-22 09:04:35 +00:00
|
|
|
uses: actions/cache@v3
|
2021-11-14 18:14:18 +00:00
|
|
|
with:
|
2021-12-24 22:25:38 +00:00
|
|
|
path: ~/.cache/pypoetry/virtualenvs
|
2022-01-24 08:37:04 +00:00
|
|
|
key: ${{ runner.os }}-poetry-cache-v2-${{ hashFiles('**/poetry.lock') }}
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: prepare
|
2021-11-14 18:14:18 +00:00
|
|
|
env:
|
2021-12-24 22:25:38 +00:00
|
|
|
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
|
2021-08-30 19:21:15 +01:00
|
|
|
run: scripts/ci_prepare.sh
|
|
|
|
- name: run migrations
|
2021-12-24 22:25:38 +00:00
|
|
|
run: poetry run python -m lifecycle.migrate
|
2021-08-30 19:21:15 +01:00
|
|
|
test-migrations-from-stable:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-02 08:56:53 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-09-16 11:31:29 +01:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-03-01 08:18:14 +00:00
|
|
|
- uses: actions/setup-python@v3
|
2021-10-07 19:28:12 +01:00
|
|
|
- name: prepare variables
|
|
|
|
id: ev
|
2021-08-30 19:21:15 +01:00
|
|
|
run: |
|
2021-10-07 19:28:12 +01:00
|
|
|
python ./scripts/gh_env.py
|
2021-12-24 22:25:38 +00:00
|
|
|
sudo pip install -U pipenv
|
|
|
|
- id: cache-poetry
|
2022-03-22 09:04:35 +00:00
|
|
|
uses: actions/cache@v3
|
2021-11-14 18:14:18 +00:00
|
|
|
with:
|
2021-12-24 22:25:38 +00:00
|
|
|
path: ~/.cache/pypoetry/virtualenvs
|
2022-01-24 08:37:04 +00:00
|
|
|
key: ${{ runner.os }}-poetry-cache-v2-${{ hashFiles('**/poetry.lock') }}
|
2021-10-07 19:28:12 +01:00
|
|
|
- name: checkout stable
|
|
|
|
run: |
|
|
|
|
# Copy current, latest config to local
|
|
|
|
cp authentik/lib/default.yml local.env.yml
|
2021-12-08 20:00:58 +00:00
|
|
|
cp -R .github ..
|
|
|
|
cp -R scripts ..
|
2021-10-07 19:28:12 +01:00
|
|
|
git checkout $(git describe --abbrev=0 --match 'version/*')
|
2021-12-08 20:00:58 +00:00
|
|
|
rm -rf .github/ scripts/
|
2022-02-05 17:54:15 +00:00
|
|
|
mv ../.github ../scripts .
|
2021-10-07 21:32:08 +01:00
|
|
|
- name: prepare
|
2021-11-14 18:14:18 +00:00
|
|
|
env:
|
2021-12-24 22:25:38 +00:00
|
|
|
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
|
2021-10-15 22:26:29 +01:00
|
|
|
run: |
|
|
|
|
scripts/ci_prepare.sh
|
2022-01-06 21:22:50 +00:00
|
|
|
# install anyways since stable will have different dependencies
|
2021-12-24 22:25:38 +00:00
|
|
|
poetry install
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: run migrations to stable
|
2021-12-24 22:25:38 +00:00
|
|
|
run: poetry run python -m lifecycle.migrate
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: checkout current code
|
|
|
|
run: |
|
|
|
|
set -x
|
2021-09-08 19:04:56 +01:00
|
|
|
git fetch
|
2021-12-08 20:00:58 +00:00
|
|
|
git reset --hard HEAD
|
2021-12-24 22:25:38 +00:00
|
|
|
git checkout $GITHUB_SHA
|
|
|
|
poetry install
|
2021-10-07 21:32:08 +01:00
|
|
|
- name: prepare
|
2021-11-14 18:14:18 +00:00
|
|
|
env:
|
2021-12-24 22:25:38 +00:00
|
|
|
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
|
2021-10-07 21:32:08 +01:00
|
|
|
run: scripts/ci_prepare.sh
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: migrate to latest
|
2021-12-24 22:25:38 +00:00
|
|
|
run: poetry run python -m lifecycle.migrate
|
2021-08-30 19:21:15 +01:00
|
|
|
test-unittest:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-02 08:56:53 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-03-01 08:18:14 +00:00
|
|
|
- uses: actions/setup-python@v3
|
2021-12-24 22:25:38 +00:00
|
|
|
- id: cache-poetry
|
2022-03-22 09:04:35 +00:00
|
|
|
uses: actions/cache@v3
|
2021-11-14 18:14:18 +00:00
|
|
|
with:
|
2021-12-24 22:25:38 +00:00
|
|
|
path: ~/.cache/pypoetry/virtualenvs
|
2022-01-24 08:37:04 +00:00
|
|
|
key: ${{ runner.os }}-poetry-cache-v2-${{ hashFiles('**/poetry.lock') }}
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: prepare
|
2021-11-14 18:14:18 +00:00
|
|
|
env:
|
2021-12-24 22:25:38 +00:00
|
|
|
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
|
2021-08-30 19:21:15 +01:00
|
|
|
run: scripts/ci_prepare.sh
|
2021-09-01 21:33:10 +01:00
|
|
|
- uses: testspace-com/setup-testspace@v1
|
|
|
|
with:
|
|
|
|
domain: ${{github.repository_owner}}
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: run unittest
|
|
|
|
run: |
|
2021-12-24 22:25:38 +00:00
|
|
|
poetry run make test
|
|
|
|
poetry run coverage xml
|
2021-09-01 21:59:51 +01:00
|
|
|
- name: run testspace
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: |
|
2021-09-06 15:52:21 +01:00
|
|
|
testspace [unittest]unittest.xml --link=codecov
|
2021-09-01 21:59:51 +01:00
|
|
|
- if: ${{ always() }}
|
|
|
|
uses: codecov/codecov-action@v2
|
2021-08-30 19:21:15 +01:00
|
|
|
test-integration:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-02 08:56:53 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-03-01 08:18:14 +00:00
|
|
|
- uses: actions/setup-python@v3
|
2021-12-24 22:25:38 +00:00
|
|
|
- id: cache-poetry
|
2022-03-22 09:04:35 +00:00
|
|
|
uses: actions/cache@v3
|
2021-11-14 18:14:18 +00:00
|
|
|
with:
|
2021-12-24 22:25:38 +00:00
|
|
|
path: ~/.cache/pypoetry/virtualenvs
|
2022-01-24 08:37:04 +00:00
|
|
|
key: ${{ runner.os }}-poetry-cache-v2-${{ hashFiles('**/poetry.lock') }}
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: prepare
|
2021-11-14 18:14:18 +00:00
|
|
|
env:
|
2021-12-24 22:25:38 +00:00
|
|
|
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
|
2021-08-30 19:21:15 +01:00
|
|
|
run: scripts/ci_prepare.sh
|
2021-09-01 21:33:10 +01:00
|
|
|
- uses: testspace-com/setup-testspace@v1
|
|
|
|
with:
|
|
|
|
domain: ${{github.repository_owner}}
|
2021-09-04 15:06:44 +01:00
|
|
|
- name: Create k8s Kind Cluster
|
|
|
|
uses: helm/kind-action@v1.2.0
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: run integration
|
|
|
|
run: |
|
2021-12-24 22:25:38 +00:00
|
|
|
poetry run make test-integration
|
|
|
|
poetry run coverage xml
|
2021-09-01 21:59:51 +01:00
|
|
|
- name: run testspace
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: |
|
2021-09-06 15:52:21 +01:00
|
|
|
testspace [integration]unittest.xml --link=codecov
|
2021-09-01 21:59:51 +01:00
|
|
|
- if: ${{ always() }}
|
|
|
|
uses: codecov/codecov-action@v2
|
2021-12-17 19:49:32 +00:00
|
|
|
test-e2e-provider:
|
2021-08-30 19:21:15 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-02 08:56:53 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-03-01 08:18:14 +00:00
|
|
|
- uses: actions/setup-python@v3
|
2022-02-25 08:56:20 +00:00
|
|
|
- uses: actions/setup-node@v3.0.0
|
2021-08-30 19:21:15 +01:00
|
|
|
with:
|
|
|
|
node-version: '16'
|
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: web/package-lock.json
|
2021-09-01 21:33:10 +01:00
|
|
|
- uses: testspace-com/setup-testspace@v1
|
|
|
|
with:
|
|
|
|
domain: ${{github.repository_owner}}
|
2021-12-24 22:25:38 +00:00
|
|
|
- id: cache-poetry
|
2022-03-22 09:04:35 +00:00
|
|
|
uses: actions/cache@v3
|
2021-11-14 18:14:18 +00:00
|
|
|
with:
|
2021-12-24 22:25:38 +00:00
|
|
|
path: ~/.cache/pypoetry/virtualenvs
|
2022-01-24 08:37:04 +00:00
|
|
|
key: ${{ runner.os }}-poetry-cache-v2-${{ hashFiles('**/poetry.lock') }}
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: prepare
|
2021-11-14 18:14:18 +00:00
|
|
|
env:
|
2021-12-24 22:25:38 +00:00
|
|
|
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
|
2021-08-30 19:21:15 +01:00
|
|
|
run: |
|
|
|
|
scripts/ci_prepare.sh
|
2021-10-13 18:06:19 +01:00
|
|
|
docker-compose -f tests/e2e/docker-compose.yml up -d
|
2021-09-04 14:15:40 +01:00
|
|
|
- id: cache-web
|
2022-03-22 09:04:35 +00:00
|
|
|
uses: actions/cache@v3
|
2021-09-04 14:15:40 +01:00
|
|
|
with:
|
|
|
|
path: web/dist
|
|
|
|
key: ${{ runner.os }}-web-${{ hashFiles('web/package-lock.json', 'web/**') }}
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: prepare web ui
|
2021-09-04 14:15:40 +01:00
|
|
|
if: steps.cache-web.outputs.cache-hit != 'true'
|
2021-08-30 19:21:15 +01:00
|
|
|
run: |
|
|
|
|
cd web
|
|
|
|
npm i
|
|
|
|
npm run build
|
|
|
|
- name: run e2e
|
|
|
|
run: |
|
2021-12-24 22:25:38 +00:00
|
|
|
poetry run make test-e2e-provider
|
|
|
|
poetry run coverage xml
|
2021-09-01 21:59:51 +01:00
|
|
|
- name: run testspace
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: |
|
2021-12-17 19:49:32 +00:00
|
|
|
testspace [e2e-provider]unittest.xml --link=codecov
|
|
|
|
- if: ${{ always() }}
|
|
|
|
uses: codecov/codecov-action@v2
|
|
|
|
test-e2e-rest:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-02 08:56:53 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-03-01 08:18:14 +00:00
|
|
|
- uses: actions/setup-python@v3
|
2022-02-25 08:56:20 +00:00
|
|
|
- uses: actions/setup-node@v3.0.0
|
2021-12-17 19:49:32 +00:00
|
|
|
with:
|
|
|
|
node-version: '16'
|
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: web/package-lock.json
|
|
|
|
- uses: testspace-com/setup-testspace@v1
|
|
|
|
with:
|
|
|
|
domain: ${{github.repository_owner}}
|
2021-12-24 22:25:38 +00:00
|
|
|
- id: cache-poetry
|
2022-03-22 09:04:35 +00:00
|
|
|
uses: actions/cache@v3
|
2021-12-17 19:49:32 +00:00
|
|
|
with:
|
2021-12-24 22:25:38 +00:00
|
|
|
path: ~/.cache/pypoetry/virtualenvs
|
2022-01-24 08:37:04 +00:00
|
|
|
key: ${{ runner.os }}-poetry-cache-v2-${{ hashFiles('**/poetry.lock') }}
|
2021-12-17 19:49:32 +00:00
|
|
|
- name: prepare
|
|
|
|
env:
|
2021-12-24 22:25:38 +00:00
|
|
|
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
|
2021-12-17 19:49:32 +00:00
|
|
|
run: |
|
|
|
|
scripts/ci_prepare.sh
|
|
|
|
docker-compose -f tests/e2e/docker-compose.yml up -d
|
|
|
|
- id: cache-web
|
2022-03-22 09:04:35 +00:00
|
|
|
uses: actions/cache@v3
|
2021-12-17 19:49:32 +00:00
|
|
|
with:
|
|
|
|
path: web/dist
|
|
|
|
key: ${{ runner.os }}-web-${{ hashFiles('web/package-lock.json', 'web/**') }}
|
|
|
|
- name: prepare web ui
|
|
|
|
if: steps.cache-web.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
|
|
|
cd web
|
|
|
|
npm i
|
|
|
|
npm run build
|
|
|
|
- name: run e2e
|
|
|
|
run: |
|
2021-12-24 22:25:38 +00:00
|
|
|
poetry run make test-e2e-rest
|
|
|
|
poetry run coverage xml
|
2021-12-17 19:49:32 +00:00
|
|
|
- name: run testspace
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: |
|
|
|
|
testspace [e2e-rest]unittest.xml --link=codecov
|
2021-09-01 21:59:51 +01:00
|
|
|
- if: ${{ always() }}
|
|
|
|
uses: codecov/codecov-action@v2
|
2021-12-08 20:00:58 +00:00
|
|
|
ci-core-mark:
|
2021-08-30 19:21:15 +01:00
|
|
|
needs:
|
2021-11-21 21:47:10 +00:00
|
|
|
- lint
|
2021-08-30 19:21:15 +01:00
|
|
|
- test-migrations
|
|
|
|
- test-migrations-from-stable
|
|
|
|
- test-unittest
|
|
|
|
- test-integration
|
2021-12-17 19:49:32 +00:00
|
|
|
- test-e2e-rest
|
|
|
|
- test-e2e-provider
|
2021-08-30 19:21:15 +01:00
|
|
|
runs-on: ubuntu-latest
|
2021-12-08 20:00:58 +00:00
|
|
|
steps:
|
|
|
|
- run: echo mark
|
|
|
|
build:
|
|
|
|
needs: ci-core-mark
|
|
|
|
runs-on: ubuntu-latest
|
2021-11-10 08:31:56 +00:00
|
|
|
timeout-minutes: 120
|
2021-11-21 21:36:32 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
arch:
|
|
|
|
- 'linux/amd64'
|
2021-08-30 19:21:15 +01:00
|
|
|
steps:
|
2022-03-02 08:56:53 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-11-21 22:35:23 +00:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1.2.0
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: prepare variables
|
|
|
|
id: ev
|
2021-09-03 09:57:44 +01:00
|
|
|
env:
|
2021-12-18 16:01:51 +00:00
|
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
2021-08-30 19:21:15 +01:00
|
|
|
run: |
|
2021-10-07 19:20:59 +01:00
|
|
|
python ./scripts/gh_env.py
|
2021-09-01 14:03:27 +01:00
|
|
|
- name: Login to Container Registry
|
2021-08-30 19:21:15 +01:00
|
|
|
uses: docker/login-action@v1
|
2021-09-03 09:57:44 +01:00
|
|
|
if: ${{ steps.ev.outputs.shouldBuild == 'true' }}
|
2021-08-30 19:21:15 +01:00
|
|
|
with:
|
2021-10-11 13:08:34 +01:00
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2021-08-30 19:21:15 +01:00
|
|
|
- name: Building Docker Image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2021-09-03 09:57:44 +01:00
|
|
|
push: ${{ steps.ev.outputs.shouldBuild == 'true' }}
|
2021-08-30 19:21:15 +01:00
|
|
|
tags: |
|
2021-10-11 13:08:34 +01:00
|
|
|
ghcr.io/goauthentik/dev-server:gh-${{ steps.ev.outputs.branchNameContainer }}
|
|
|
|
ghcr.io/goauthentik/dev-server:gh-${{ steps.ev.outputs.branchNameContainer }}-${{ steps.ev.outputs.timestamp }}-${{ steps.ev.outputs.sha }}
|
2021-08-30 19:21:15 +01:00
|
|
|
build-args: |
|
2021-09-01 15:19:29 +01:00
|
|
|
GIT_BUILD_HASH=${{ steps.ev.outputs.sha }}
|
2021-11-21 21:36:32 +00:00
|
|
|
platforms: ${{ matrix.arch }}
|