diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index acbf0e320..6e5bd99e6 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -2,7 +2,7 @@ name: "Setup authentik testing environment" description: "Setup authentik testing environment" inputs: - postgresql_tag: + postgresql_version: description: "Optional postgresql image tag" default: "12" @@ -33,9 +33,8 @@ runs: - name: Setup dependencies shell: bash run: | - export PSQL_TAG=${{ inputs.postgresql_tag }} + export PSQL_TAG=${{ inputs.postgresql_version }} docker-compose -f .github/actions/setup/docker-compose.yml up -d - poetry env use python3.12 poetry install cd web && npm ci - name: Generate config diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index 9fa00800b..26baa3556 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -48,16 +48,27 @@ jobs: - name: run migrations run: poetry run python -m lifecycle.migrate test-migrations-from-stable: + name: test-migrations-from-stable - PostgreSQL ${{ matrix.psql }} runs-on: ubuntu-latest - continue-on-error: true + strategy: + fail-fast: false + matrix: + psql: + - 12-alpine + - 15-alpine + - 16-alpine steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup authentik env uses: ./.github/actions/setup + with: + postgresql_version: ${{ matrix.psql }} - name: checkout stable run: | + # Delete all poetry envs + rm -rf /home/runner/.cache/pypoetry # Copy current, latest config to local cp authentik/lib/default.yml local.env.yml cp -R .github .. @@ -67,6 +78,8 @@ jobs: mv ../.github ../scripts . - name: Setup authentik env (ensure stable deps are installed) uses: ./.github/actions/setup + with: + postgresql_version: ${{ matrix.psql }} - name: run migrations to stable run: poetry run python -m lifecycle.migrate - name: checkout current code @@ -76,9 +89,13 @@ jobs: git reset --hard HEAD git clean -d -fx . git checkout $GITHUB_SHA + # Delete previous poetry env + rm -rf $(poetry env info --path) poetry install - name: Setup authentik env (ensure latest deps are installed) uses: ./.github/actions/setup + with: + postgresql_version: ${{ matrix.psql }} - name: migrate to latest run: poetry run python -m lifecycle.migrate test-unittest: @@ -97,7 +114,7 @@ jobs: - name: Setup authentik env uses: ./.github/actions/setup with: - postgresql_tag: ${{ matrix.psql }} + postgresql_version: ${{ matrix.psql }} - name: run unittest run: | poetry run make test diff --git a/authentik/events/utils.py b/authentik/events/utils.py index 2bc3587d6..a7c3bdf3e 100644 --- a/authentik/events/utils.py +++ b/authentik/events/utils.py @@ -164,9 +164,10 @@ def sanitize_item(value: Any) -> Any: if isinstance(value, (bool, int, float, NoneType, list, tuple, dict)): return value try: - return DjangoJSONEncoder.default(value) - finally: + return DjangoJSONEncoder().default(value) + except TypeError: return str(value) + return str(value) def sanitize_dict(source: dict[Any, Any]) -> dict[Any, Any]: