This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/.github/workflows/ci-main.yml

321 lines
9.8 KiB
YAML
Raw Permalink Normal View History

2021-08-30 18:21:15 +00:00
name: authentik-ci-main
on:
push:
branches:
- master
- next
- version-*
2021-08-30 18:21:15 +00:00
paths-ignore:
- website
pull_request:
branches:
- master
2021-08-30 18:21:15 +00:00
env:
POSTGRES_DB: authentik
POSTGRES_USER: authentik
POSTGRES_PASSWORD: "EK-5jnKfjrGRm<77"
jobs:
lint:
strategy:
fail-fast: false
matrix:
job:
- pylint
- black
- isort
- bandit
- pyright
- pending-migrations
2021-08-30 18:21:15 +00:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/setup-node@v2
2021-08-30 18:21:15 +00:00
with:
node-version: '16'
2021-12-24 22:25:38 +00:00
- id: cache-poetry
uses: actions/cache@v2.1.7
with:
2021-12-24 22:25:38 +00:00
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-cache-v3-${{ hashFiles('**/poetry.lock') }}
2021-08-30 18:21:15 +00:00
- name: prepare
env:
2021-12-24 22:25:38 +00:00
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
2021-08-30 18:21:15 +00:00
run: scripts/ci_prepare.sh
- name: run job
2021-12-24 22:25:38 +00:00
run: poetry run make ci-${{ matrix.job }}
2021-08-30 18:21:15 +00:00
test-migrations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
2021-12-24 22:25:38 +00:00
- id: cache-poetry
uses: actions/cache@v2.1.7
with:
2021-12-24 22:25:38 +00:00
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-cache-v3-${{ hashFiles('**/poetry.lock') }}
2021-08-30 18:21:15 +00:00
- name: prepare
env:
2021-12-24 22:25:38 +00:00
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
2021-08-30 18:21:15 +00: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 18:21:15 +00:00
test-migrations-from-stable:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
2021-08-30 18:21:15 +00:00
- uses: actions/setup-python@v2
- name: prepare variables
id: ev
2021-08-30 18:21:15 +00:00
run: |
python ./scripts/gh_env.py
2021-12-24 22:25:38 +00:00
sudo pip install -U pipenv
- id: cache-poetry
uses: actions/cache@v2.1.7
with:
2021-12-24 22:25:38 +00:00
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-cache-v3-${{ hashFiles('**/poetry.lock') }}
- name: checkout stable
run: |
# Copy current, latest config to local
cp authentik/lib/default.yml local.env.yml
cp -R .github ..
cp -R scripts ..
2021-12-24 22:25:38 +00:00
cp -R poetry.lock pyproject.toml ..
git checkout $(git describe --abbrev=0 --match 'version/*')
rm -rf .github/ scripts/
2021-12-24 22:25:38 +00:00
mv ../.github ../scripts ../poetry.lock ../pyproject.toml .
- name: prepare
env:
2021-12-24 22:25:38 +00:00
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
build(deps): bump webauthn from 0.4.7 to 1.0.0 (#1625) * build(deps): bump webauthn from 0.4.7 to 1.0.0 Bumps [webauthn](https://github.com/duo-labs/py_webauthn) from 0.4.7 to 1.0.0. - [Release notes](https://github.com/duo-labs/py_webauthn/releases) - [Commits](https://github.com/duo-labs/py_webauthn/compare/v0.4.7...v1.0.0) --- updated-dependencies: - dependency-name: webauthn dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * stages/authenticator_webauthn: migrate to new library version Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * stages/authenticator_validate: migrate to new version Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * stages/authenticator_webauthn: add bytes_to_base64url_dict for json encoding Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * actually don't do that Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * fix missing response on web Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * more double json Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * fix Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * more base64 stuff Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * working Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * ci: always sync Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * fix Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jens Langhammer <jens.langhammer@beryju.org>
2021-10-15 21:26:29 +00:00
run: |
scripts/ci_prepare.sh
# Sync anyways since stable will have different dependencies
2021-12-24 22:25:38 +00:00
# TODO: Remove after next stable release
if [[ -f "Pipfile.lock" ]]; then
pipenv install --dev
fi
poetry install
2021-08-30 18:21:15 +00:00
- name: run migrations to stable
2021-12-24 22:25:38 +00:00
run: poetry run python -m lifecycle.migrate
2021-08-30 18:21:15 +00:00
- name: checkout current code
run: |
set -x
outposts/proxyv2 (#1365) * outposts/proxyv2: initial commit Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> add rs256 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> more stuff Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> add forward auth an sign_out Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> match cookie name Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> re-add support for rs256 for backwards compat Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> add error handler Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> ensure unique user-agent is used Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> set cookie duration based on id_token expiry Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> build proxy v2 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> add ssl Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> add basic auth and custom header support Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> add application cert loading Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> implement whitelist Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> add redis Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> migrate embedded outpost to v2 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> remove old proxy Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> providers/proxy: make token expiration configurable Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> add metrics Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> fix tests Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * providers/proxy: only allow one redirect URI Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * fix docker build for proxy Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * remove default port offset Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * add AUTHENTIK_HOST_BROWSER Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * tests: fix e2e/integration tests not using proper tags Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * remove references of old port Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * fix user_attributes not being loaded correctly Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * cleanup dependencies Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org> * cleanup Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
2021-09-08 18:04:56 +00:00
git fetch
git reset --hard HEAD
2021-12-24 22:25:38 +00:00
# TODO: Remove after next stable release
rm -f poetry.lock
git checkout $GITHUB_SHA
# TODO: Remove after next stable release
if [[ -f "Pipfile.lock" ]]; then
pipenv install --dev
fi
poetry install
- name: prepare
env:
2021-12-24 22:25:38 +00:00
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
run: scripts/ci_prepare.sh
2021-08-30 18:21:15 +00:00
- name: migrate to latest
2021-12-24 22:25:38 +00:00
run: poetry run python -m lifecycle.migrate
2021-08-30 18:21:15 +00:00
test-unittest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
2021-12-24 22:25:38 +00:00
- id: cache-poetry
uses: actions/cache@v2.1.7
with:
2021-12-24 22:25:38 +00:00
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-cache-v3-${{ hashFiles('**/poetry.lock') }}
2021-08-30 18:21:15 +00:00
- name: prepare
env:
2021-12-24 22:25:38 +00:00
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
2021-08-30 18:21:15 +00:00
run: scripts/ci_prepare.sh
- uses: testspace-com/setup-testspace@v1
with:
domain: ${{github.repository_owner}}
2021-08-30 18:21:15 +00:00
- name: run unittest
run: |
2021-12-24 22:25:38 +00:00
poetry run make test
poetry run coverage xml
- name: run testspace
if: ${{ always() }}
run: |
testspace [unittest]unittest.xml --link=codecov
- 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
2021-12-24 22:25:38 +00:00
- id: cache-poetry
uses: actions/cache@v2.1.7
with:
2021-12-24 22:25:38 +00:00
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-cache-v3-${{ hashFiles('**/poetry.lock') }}
2021-08-30 18:21:15 +00:00
- name: prepare
env:
2021-12-24 22:25:38 +00:00
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
2021-08-30 18:21:15 +00:00
run: scripts/ci_prepare.sh
- uses: testspace-com/setup-testspace@v1
with:
domain: ${{github.repository_owner}}
- name: Create k8s Kind Cluster
uses: helm/kind-action@v1.2.0
2021-08-30 18:21:15 +00:00
- name: run integration
run: |
2021-12-24 22:25:38 +00:00
poetry run make test-integration
poetry run coverage xml
- name: run testspace
if: ${{ always() }}
run: |
testspace [integration]unittest.xml --link=codecov
- if: ${{ always() }}
uses: codecov/codecov-action@v2
test-e2e-provider:
2021-08-30 18:21:15 +00:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/setup-node@v2
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
uses: actions/cache@v2.1.7
with:
2021-12-24 22:25:38 +00:00
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-cache-v3-${{ hashFiles('**/poetry.lock') }}
2021-08-30 18:21:15 +00:00
- name: prepare
env:
2021-12-24 22:25:38 +00:00
INSTALL: ${{ steps.cache-poetry.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
- id: cache-web
uses: actions/cache@v2.1.7
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
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: |
2021-12-24 22:25:38 +00:00
poetry run make test-e2e-provider
poetry run coverage xml
- name: run testspace
if: ${{ always() }}
run: |
testspace [e2e-provider]unittest.xml --link=codecov
- if: ${{ always() }}
uses: codecov/codecov-action@v2
test-e2e-rest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/setup-node@v2
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
uses: actions/cache@v2.1.7
with:
2021-12-24 22:25:38 +00:00
path: ~/.cache/pypoetry/virtualenvs
key: ${{ runner.os }}-poetry-cache-v3-${{ hashFiles('**/poetry.lock') }}
- name: prepare
env:
2021-12-24 22:25:38 +00:00
INSTALL: ${{ steps.cache-poetry.outputs.cache-hit }}
run: |
scripts/ci_prepare.sh
docker-compose -f tests/e2e/docker-compose.yml up -d
- id: cache-web
uses: actions/cache@v2.1.7
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
- name: run testspace
if: ${{ always() }}
run: |
testspace [e2e-rest]unittest.xml --link=codecov
- if: ${{ always() }}
uses: codecov/codecov-action@v2
ci-core-mark:
2021-08-30 18:21:15 +00:00
needs:
- lint
2021-08-30 18:21:15 +00:00
- test-migrations
- test-migrations-from-stable
- test-unittest
- test-integration
- test-e2e-rest
- test-e2e-provider
2021-08-30 18:21:15 +00:00
runs-on: ubuntu-latest
steps:
- run: echo mark
build:
needs: ci-core-mark
runs-on: ubuntu-latest
timeout-minutes: 120
strategy:
fail-fast: false
matrix:
arch:
- 'linux/amd64'
2021-08-30 18:21:15 +00:00
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1.2.0
2021-08-30 18:21:15 +00:00
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: prepare variables
id: ev
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
2021-08-30 18:21:15 +00:00
run: |
python ./scripts/gh_env.py
- name: Login to Container Registry
2021-08-30 18:21:15 +00:00
uses: docker/login-action@v1
if: ${{ steps.ev.outputs.shouldBuild == 'true' }}
2021-08-30 18:21:15 +00:00
with:
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:
push: ${{ steps.ev.outputs.shouldBuild == 'true' }}
2021-08-30 18:21:15 +00:00
tags: |
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: |
GIT_BUILD_HASH=${{ steps.ev.outputs.sha }}
platforms: ${{ matrix.arch }}