2021-08-30 18:21:15 +00:00
|
|
|
name: authentik-ci-main
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-09-03 08:53:39 +00:00
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- next
|
|
|
|
- version-*
|
2021-08-30 18:21:15 +00:00
|
|
|
paths-ignore:
|
|
|
|
- website
|
2021-09-03 08:53:39 +00:00
|
|
|
pull_request:
|
2021-09-07 08:06:30 +00:00
|
|
|
branches:
|
|
|
|
- master
|
2021-08-30 18:21:15 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
POSTGRES_DB: authentik
|
|
|
|
POSTGRES_USER: authentik
|
|
|
|
POSTGRES_PASSWORD: "EK-5jnKfjrGRm<77"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint-pylint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
2021-11-10 10:45:47 +00:00
|
|
|
# - id: cache-pipenv
|
|
|
|
# uses: actions/cache@v2.1.6
|
|
|
|
# with:
|
|
|
|
# path: ~/.local/share/virtualenvs
|
|
|
|
# key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: prepare
|
2021-11-10 10:45:47 +00:00
|
|
|
# env:
|
|
|
|
# INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
|
2021-08-30 18:21:15 +00:00
|
|
|
run: scripts/ci_prepare.sh
|
|
|
|
- name: run pylint
|
|
|
|
run: pipenv run pylint authentik tests lifecycle
|
|
|
|
lint-black:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
2021-11-10 10:45:47 +00:00
|
|
|
# - id: cache-pipenv
|
|
|
|
# uses: actions/cache@v2.1.6
|
|
|
|
# with:
|
|
|
|
# path: ~/.local/share/virtualenvs
|
|
|
|
# key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: prepare
|
2021-11-10 10:45:47 +00:00
|
|
|
# env:
|
|
|
|
# INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
|
2021-08-30 18:21:15 +00:00
|
|
|
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'
|
2021-11-10 10:45:47 +00:00
|
|
|
# - id: cache-pipenv
|
|
|
|
# uses: actions/cache@v2.1.6
|
|
|
|
# with:
|
|
|
|
# path: ~/.local/share/virtualenvs
|
|
|
|
# key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: prepare
|
2021-11-10 10:45:47 +00:00
|
|
|
# env:
|
|
|
|
# INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
|
2021-08-30 18:21:15 +00:00
|
|
|
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'
|
2021-11-10 10:45:47 +00:00
|
|
|
# - id: cache-pipenv
|
|
|
|
# uses: actions/cache@v2.1.6
|
|
|
|
# with:
|
|
|
|
# path: ~/.local/share/virtualenvs
|
|
|
|
# key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: prepare
|
2021-11-10 10:45:47 +00:00
|
|
|
# env:
|
|
|
|
# INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
|
2021-08-30 18:21:15 +00:00
|
|
|
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:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
2021-11-10 10:45:47 +00:00
|
|
|
# - id: cache-pipenv
|
|
|
|
# uses: actions/cache@v2.1.6
|
|
|
|
# with:
|
|
|
|
# path: ~/.local/share/virtualenvs
|
|
|
|
# key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: prepare
|
2021-11-10 10:45:47 +00:00
|
|
|
# env:
|
|
|
|
# INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
|
2021-08-30 18:21:15 +00:00
|
|
|
run: scripts/ci_prepare.sh
|
|
|
|
- name: run migrations
|
|
|
|
run: pipenv run python -m lifecycle.migrate
|
|
|
|
test-migrations-from-stable:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-09-16 10:31:29 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-08-30 18:21:15 +00:00
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
2021-10-07 18:28:12 +00:00
|
|
|
- name: prepare variables
|
|
|
|
id: ev
|
2021-08-30 18:21:15 +00:00
|
|
|
run: |
|
2021-10-07 18:28:12 +00:00
|
|
|
python ./scripts/gh_env.py
|
2021-11-10 10:45:47 +00:00
|
|
|
# - id: cache-pipenv
|
|
|
|
# uses: actions/cache@v2.1.6
|
|
|
|
# with:
|
|
|
|
# path: ~/.local/share/virtualenvs
|
|
|
|
# key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
|
2021-10-07 18:28:12 +00:00
|
|
|
- name: checkout stable
|
|
|
|
run: |
|
|
|
|
# Copy current, latest config to local
|
|
|
|
cp authentik/lib/default.yml local.env.yml
|
|
|
|
git checkout $(git describe --abbrev=0 --match 'version/*')
|
2021-11-06 12:06:51 +00:00
|
|
|
git checkout ${{ steps.ev.outputs.branchName }} -- .github
|
|
|
|
git checkout ${{ steps.ev.outputs.branchName }} -- scripts
|
2021-10-07 20:32:08 +00:00
|
|
|
- name: prepare
|
2021-11-10 10:45:47 +00:00
|
|
|
# env:
|
|
|
|
# INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
|
2021-10-15 21:26:29 +00:00
|
|
|
run: |
|
|
|
|
scripts/ci_prepare.sh
|
|
|
|
# Sync anyways since stable will have different dependencies
|
|
|
|
pipenv sync --dev
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: run migrations to stable
|
|
|
|
run: pipenv run python -m lifecycle.migrate
|
|
|
|
- name: checkout current code
|
|
|
|
run: |
|
|
|
|
set -x
|
2021-09-08 18:04:56 +00:00
|
|
|
git fetch
|
|
|
|
git checkout ${{ steps.ev.outputs.branchName }}
|
2021-08-30 18:21:15 +00:00
|
|
|
pipenv sync --dev
|
2021-10-07 20:32:08 +00:00
|
|
|
- name: prepare
|
2021-11-10 10:45:47 +00:00
|
|
|
# env:
|
|
|
|
# INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
|
2021-10-07 20:32:08 +00:00
|
|
|
run: scripts/ci_prepare.sh
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: migrate to latest
|
|
|
|
run: pipenv run python -m lifecycle.migrate
|
|
|
|
test-unittest:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
2021-11-10 10:45:47 +00:00
|
|
|
# - id: cache-pipenv
|
|
|
|
# uses: actions/cache@v2.1.6
|
|
|
|
# with:
|
|
|
|
# path: ~/.local/share/virtualenvs
|
|
|
|
# key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: prepare
|
2021-11-10 10:45:47 +00:00
|
|
|
# env:
|
|
|
|
# INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
|
2021-08-30 18:21:15 +00:00
|
|
|
run: scripts/ci_prepare.sh
|
2021-09-01 20:33:10 +00:00
|
|
|
- uses: testspace-com/setup-testspace@v1
|
|
|
|
with:
|
|
|
|
domain: ${{github.repository_owner}}
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: run unittest
|
|
|
|
run: |
|
|
|
|
pipenv run make test
|
|
|
|
pipenv run coverage xml
|
2021-09-01 20:59:51 +00:00
|
|
|
- name: run testspace
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: |
|
2021-09-06 14:52:21 +00:00
|
|
|
testspace [unittest]unittest.xml --link=codecov
|
2021-09-01 20:59:51 +00:00
|
|
|
- if: ${{ always() }}
|
|
|
|
uses: codecov/codecov-action@v2
|
2021-08-30 18:21:15 +00:00
|
|
|
test-integration:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
2021-11-10 10:45:47 +00:00
|
|
|
# - id: cache-pipenv
|
|
|
|
# uses: actions/cache@v2.1.6
|
|
|
|
# with:
|
|
|
|
# path: ~/.local/share/virtualenvs
|
|
|
|
# key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: prepare
|
2021-11-10 10:45:47 +00:00
|
|
|
# env:
|
|
|
|
# INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
|
2021-08-30 18:21:15 +00:00
|
|
|
run: scripts/ci_prepare.sh
|
2021-09-01 20:33:10 +00:00
|
|
|
- uses: testspace-com/setup-testspace@v1
|
|
|
|
with:
|
|
|
|
domain: ${{github.repository_owner}}
|
2021-09-04 14:06:44 +00:00
|
|
|
- name: Create k8s Kind Cluster
|
|
|
|
uses: helm/kind-action@v1.2.0
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: run integration
|
|
|
|
run: |
|
|
|
|
pipenv run make test-integration
|
|
|
|
pipenv run coverage xml
|
2021-09-01 20:59:51 +00:00
|
|
|
- name: run testspace
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: |
|
2021-09-06 14:52:21 +00:00
|
|
|
testspace [integration]unittest.xml --link=codecov
|
2021-09-01 20:59:51 +00:00
|
|
|
- if: ${{ always() }}
|
|
|
|
uses: codecov/codecov-action@v2
|
2021-08-30 18:21:15 +00:00
|
|
|
test-e2e:
|
|
|
|
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'
|
|
|
|
cache: 'npm'
|
|
|
|
cache-dependency-path: web/package-lock.json
|
2021-09-01 20:33:10 +00:00
|
|
|
- uses: testspace-com/setup-testspace@v1
|
|
|
|
with:
|
|
|
|
domain: ${{github.repository_owner}}
|
2021-11-10 10:45:47 +00:00
|
|
|
# - id: cache-pipenv
|
|
|
|
# uses: actions/cache@v2.1.6
|
|
|
|
# with:
|
|
|
|
# path: ~/.local/share/virtualenvs
|
|
|
|
# key: ${{ runner.os }}-pipenv-v2-${{ hashFiles('**/Pipfile.lock') }}
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: prepare
|
2021-11-10 10:45:47 +00:00
|
|
|
# env:
|
|
|
|
# INSTALL: ${{ steps.cache-pipenv.outputs.cache-hit }}
|
2021-08-30 18:21:15 +00:00
|
|
|
run: |
|
|
|
|
scripts/ci_prepare.sh
|
2021-10-13 17:06:19 +00:00
|
|
|
docker-compose -f tests/e2e/docker-compose.yml up -d
|
2021-09-04 13:15:40 +00:00
|
|
|
- id: cache-web
|
2021-09-06 06:36:32 +00:00
|
|
|
uses: actions/cache@v2.1.6
|
2021-09-04 13:15:40 +00:00
|
|
|
with:
|
|
|
|
path: web/dist
|
|
|
|
key: ${{ runner.os }}-web-${{ hashFiles('web/package-lock.json', 'web/**') }}
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: prepare web ui
|
2021-09-04 13:15:40 +00:00
|
|
|
if: steps.cache-web.outputs.cache-hit != 'true'
|
2021-08-30 18:21:15 +00:00
|
|
|
run: |
|
|
|
|
cd web
|
|
|
|
npm i
|
|
|
|
npm run build
|
|
|
|
- name: run e2e
|
|
|
|
run: |
|
|
|
|
pipenv run make test-e2e
|
|
|
|
pipenv run coverage xml
|
2021-09-01 20:59:51 +00:00
|
|
|
- name: run testspace
|
|
|
|
if: ${{ always() }}
|
|
|
|
run: |
|
2021-09-06 14:52:21 +00:00
|
|
|
testspace [e2e]unittest.xml --link=codecov
|
2021-09-01 20:59:51 +00:00
|
|
|
- if: ${{ always() }}
|
|
|
|
uses: codecov/codecov-action@v2
|
2021-08-30 18:21:15 +00:00
|
|
|
build:
|
|
|
|
needs:
|
|
|
|
- lint-pylint
|
|
|
|
- lint-black
|
|
|
|
- lint-isort
|
|
|
|
- lint-bandit
|
|
|
|
- lint-pyright
|
|
|
|
- test-migrations
|
|
|
|
- test-migrations-from-stable
|
|
|
|
- test-unittest
|
|
|
|
- test-integration
|
|
|
|
- test-e2e
|
|
|
|
runs-on: ubuntu-latest
|
2021-11-10 08:31:56 +00:00
|
|
|
timeout-minutes: 120
|
2021-08-30 18:21:15 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: prepare variables
|
|
|
|
id: ev
|
2021-09-03 08:57:44 +00:00
|
|
|
env:
|
|
|
|
DOCKER_USERNAME: ${{ secrets.HARBOR_USERNAME }}
|
2021-08-30 18:21:15 +00:00
|
|
|
run: |
|
2021-10-07 18:20:59 +00:00
|
|
|
python ./scripts/gh_env.py
|
2021-09-01 13:03:27 +00:00
|
|
|
- name: Login to Container Registry
|
2021-08-30 18:21:15 +00:00
|
|
|
uses: docker/login-action@v1
|
2021-09-03 08:57:44 +00:00
|
|
|
if: ${{ steps.ev.outputs.shouldBuild == 'true' }}
|
2021-08-30 18:21:15 +00:00
|
|
|
with:
|
2021-10-11 12:08:34 +00:00
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2021-08-30 18:21:15 +00:00
|
|
|
- name: Building Docker Image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2021-09-03 08:57:44 +00:00
|
|
|
push: ${{ steps.ev.outputs.shouldBuild == 'true' }}
|
2021-08-30 18:21:15 +00:00
|
|
|
tags: |
|
2021-10-11 12:08:34 +00: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 18:21:15 +00:00
|
|
|
build-args: |
|
2021-09-01 14:19:29 +00:00
|
|
|
GIT_BUILD_HASH=${{ steps.ev.outputs.sha }}
|