From b965a197442bbeffc113a758180acd1d7e3589f5 Mon Sep 17 00:00:00 2001 From: Elio Bischof Date: Wed, 18 Jun 2025 19:10:09 +0200 Subject: [PATCH] acceptance --- .github/workflows/test.yml | 26 +++++++++++++++++++++----- Makefile | 19 +++++++++---------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2aa01f28e6..50516a3799 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,16 @@ name: Quality on: pull_request: + workflow_dispatch: + inputs: + ref-tag: + description: 'The tag to use for the build cache' + required: false + default: 'latest' + clean-run-caches: + description: 'Whether to clean the run caches' + required: false + default: 'true' jobs: quality: name: Ensure Quality @@ -10,6 +20,8 @@ jobs: contents: read id-token: write packages: write + env: + CACHE_DIR: ${{ runner.temp }}/login-run-caches steps: - name: Login to GitHub Container Registry uses: docker/login-action@v3 @@ -37,19 +49,23 @@ jobs: uses: actions/cache/restore@v4 id: run-caches-restore with: - path: ${{ runner.temp }}/login-make-cache - key: login-make-cache-${{ github.ref == 'refs/heads/main' && 'latest' || fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} - restore-keys: login-make-cache-latest + path: ${{ github.env.CACHE_DIR }} + key: login-run-caches-${{ github.ref == 'refs/heads/main' && 'latest' || fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} + restore-keys: login-run-caches-latest + - name: Clean up Run Caches +# if: ${{ github.event.inputs.clean-run-caches == 'true' }} + run: make clean-run-caches + - name: Show Run Caches + run: make show-run-caches - run: make login-quality env: # latest if branch is main, otherwise image version which is the pull request number BAKE_CLI: depot bake --file docker-bake.hcl --file docker-bake-ci.hcl --file ./apps/login-test-acceptance/docker-compose.yaml --file ./apps/login-test-acceptance/docker-compose-ci.yaml DEPOT_PROJECT_ID: jp837jn3fm REF_TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} - CACHE_DIR: ${{ runner.temp }}/login-make-cache - name: Save Run Caches uses: actions/cache/save@v4 with: - path: ${{ runner.temp }}/login-make-cache + path: ${{ github.env.CACHE_DIR }} key: ${{ steps.run-caches-restore.outputs.cache-primary-key }} if: always() diff --git a/Makefile b/Makefile index f48e3729fd..e62517c0f9 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,8 @@ export BAKE_CLI ?= docker buildx bake --file ./docker-bake.hcl --file ./apps/log export REF_TAG ?= local export LOGIN_TAG := login:${REF_TAG} export LOGIN_TEST_UNIT_TAG := login-test-unit:${REF_TAG} -export LOGIN_TEST_INTEGRATION_TAG ?= login-test-integration:${REF_TAG} -export LOGIN_TEST_ACCEPTANCE_BUILD_CONTEXT ?= apps/login-test-acceptance +export LOGIN_TEST_INTEGRATION_TAG := login-test-integration:${REF_TAG} +export LOGIN_TEST_ACCEPTANCE_BUILD_CONTEXT := apps/login-test-acceptance export LOGIN_TEST_ACCEPTANCE_TAG := login-test-acceptance:${REF_TAG} export LOGIN_TEST_ACCEPTANCE_SETUP_TAG := login-test-acceptance-setup:${REF_TAG} export LOGIN_TEST_ACCEPTANCE_SINK_TAG := login-test-acceptance-sink:${REF_TAG} @@ -16,7 +16,6 @@ export LOGIN_TEST_ACCEPTANCE_SAMLSP_TAG := login-test-acceptance-samlsp:${REF_TA export LOGIN_TEST_ACCEPTANCE_SAMLIDP_TAG := login-test-acceptance-samlidp:${REF_TAG} export POSTGRES_TAG := postgres:17.0-alpine3.19 export GOLANG_TAG := golang:1.24-alpine -# TODO: use ghcr.io/zitadel/zitadel:latest export ZITADEL_TAG ?= ghcr.io/zitadel/zitadel:02617cf17fdde849378c1a6b5254bbfb2745b164 export CORE_MOCK_TAG := core-mock:${REF_TAG} @@ -31,8 +30,8 @@ login-help: @echo " login-test-unit - Run unit tests. Tests without any dependencies. FORCE=true prevents skipping." @echo " login-test-integration - Run integration tests. Tests a login production build against a mocked Zitadel core API. FORCE=true prevents skipping." @echo " login-test-acceptance - Run acceptance tests. Tests a login production build with a local Zitadel instance behind a reverse proxy. FORCE=true prevents skipping." - @echo " show-cache-keys - Show all cache keys with image ids and exit codes." - @echo " clean-cache-keys - Remove all cache keys." + @echo " show-run-caches - Show all run caches with image ids and exit codes." + @echo " clean-run-caches - Remove all run caches." login-lint: $(BAKE_CLI) login-lint @@ -87,14 +86,14 @@ login-quality: login-lint login-test-integration login-test-acceptance login-standalone-build: $(BAKE_CLI) login-standalone -.PHONY: clean-cache-keys -clean-cache-keys: +.PHONY: clean-run-caches +clean-run-caches: @echo "Removing cache directory: $(CACHE_DIR)" rm -rf "$(CACHE_DIR)" -.PHONY: show-cache-keys -show-cache-keys: - @echo "Showing cache keys with docker image ids and exit codes in $(CACHE_DIR):" +.PHONY: show-run-caches +show-run-caches: + @echo "Showing run caches with docker image ids and exit codes in $(CACHE_DIR):" @find "$(CACHE_DIR)" -type f 2>/dev/null | while read file; do \ echo "$$file: $$(cat $$file)"; \ done