mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 11:07:32 +00:00
test pipeline
This commit is contained in:
115
.github/workflows/test.yml
vendored
115
.github/workflows/test.yml
vendored
@@ -1,123 +1,16 @@
|
|||||||
name: Quality
|
name: Quality
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
# schedule:
|
|
||||||
# Every morning at 6:00 AM CET
|
|
||||||
# - cron: '0 4 * * *'
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
target-env:
|
|
||||||
description: 'Zitadel target environment to run the acceptance tests against.'
|
|
||||||
required: true
|
|
||||||
type: choice
|
|
||||||
options:
|
|
||||||
- 'qa'
|
|
||||||
- 'prod'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
matrix:
|
|
||||||
# If the workflow is triggered by a schedule event, only the acceptance tests run against QA and Prod.
|
|
||||||
name: Matrix
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
outputs:
|
|
||||||
matrix: ${{ steps.matrix.outputs.matrix }}
|
|
||||||
steps:
|
|
||||||
- name: Matrix
|
|
||||||
id: matrix
|
|
||||||
run: |
|
|
||||||
if [ -n "${{ github.event.schedule }}" ]; then
|
|
||||||
echo 'matrix=["test:acceptance:qa", "test:acceptance:prod"]' >> $GITHUB_OUTPUT
|
|
||||||
elif [ -n "${{ github.event.inputs.target-env }}" ]; then
|
|
||||||
echo 'matrix=["test:acceptance:${{ github.event.inputs.target-env }}"]' >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo 'matrix=["format --check", "lint", "test:unit", "test:integration", "test:acceptance"]' >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
quality:
|
quality:
|
||||||
name: Ensure Quality
|
name: Ensure Quality
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: "read"
|
contents: "read"
|
||||||
|
|
||||||
needs:
|
|
||||||
- matrix
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
command: ${{ fromJson( needs.matrix.outputs.matrix ) }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Buf
|
|
||||||
uses: bufbuild/buf-setup-action@v1.45.0
|
|
||||||
|
|
||||||
- name: Setup pnpm
|
|
||||||
uses: pnpm/action-setup@v4.0.0
|
|
||||||
|
|
||||||
- name: Setup Node.js 20.x
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
with:
|
||||||
node-version: 20.x
|
fetch-depth: 0
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
- name: Install Dependencies
|
- run: make quality
|
||||||
run: pnpm install --frozen-lockfile
|
|
||||||
|
|
||||||
# We can cache the Playwright binary independently from the pnpm cache, because we install it separately.
|
|
||||||
# After pnpm install --frozen-lockfile, we can get the version so we only have to download the binary once per version.
|
|
||||||
- run: echo "PLAYWRIGHT_VERSION=$(npx playwright --version | cut -d ' ' -f 2)" >> $GITHUB_ENV
|
|
||||||
if: ${{ startsWith(matrix.command, 'test:acceptance') }}
|
|
||||||
|
|
||||||
- name: Setup Playwright binary cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
id: playwright-cache
|
|
||||||
with:
|
|
||||||
path: ~/.cache/ms-playwright
|
|
||||||
key: ${{ runner.os }}-playwright-binary-${{ env.PLAYWRIGHT_VERSION }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-playwright-binary-
|
|
||||||
if: ${{ startsWith(matrix.command, 'test:acceptance') }}
|
|
||||||
|
|
||||||
- name: Install Playwright Browsers
|
|
||||||
run: pnpm exec playwright install --with-deps
|
|
||||||
if: ${{ startsWith(matrix.command, 'test:acceptance') && steps.playwright-cache.outputs.cache-hit != 'true' }}
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
if: ${{ matrix.command == 'test:acceptance' }}
|
|
||||||
|
|
||||||
- name: Run ZITADEL
|
|
||||||
run: ZITADEL_DEV_UID=root pnpm run-sink
|
|
||||||
if: ${{ matrix.command == 'test:acceptance' }}
|
|
||||||
|
|
||||||
- name: Create Cloud Env File
|
|
||||||
run: |
|
|
||||||
if [ "${{ matrix.command }}" == "test:acceptance:prod" ]; then
|
|
||||||
echo "${{ secrets.ENV_FILE_CONTENT_ACCEPTANCE_PROD }}" | tee apps/login/.env.local acceptance/tests/.env.local > /dev/null
|
|
||||||
else
|
|
||||||
echo "${{ secrets.ENV_FILE_CONTENT_ACCEPTANCE_QA }}" | tee apps/login/.env.local acceptance/tests/.env.local > /dev/null
|
|
||||||
fi
|
|
||||||
if: ${{ matrix.command == 'test:acceptance:qa' || matrix.command == 'test:acceptance:prod' }}
|
|
||||||
|
|
||||||
- name: Create Production Build
|
|
||||||
run: pnpm build
|
|
||||||
if: ${{ startsWith(matrix.command, 'test:acceptance') }}
|
|
||||||
|
|
||||||
- name: Run SAML SP
|
|
||||||
run: ZITADEL_DEV_UID=root pnpm run-samlsp
|
|
||||||
if: ${{ matrix.command == 'test:acceptance' }}
|
|
||||||
|
|
||||||
- name: Run OIDC RP
|
|
||||||
run: ZITADEL_DEV_UID=root pnpm run-oidcrp
|
|
||||||
if: ${{ matrix.command == 'test:acceptance' }}
|
|
||||||
|
|
||||||
- name: Check
|
|
||||||
id: check
|
|
||||||
run: pnpm ${{ contains(matrix.command, 'test:acceptance') && 'test:acceptance' || matrix.command }}
|
|
||||||
|
16
Makefile
16
Makefile
@@ -24,12 +24,12 @@ login-help:
|
|||||||
@echo "Makefile for the login service"
|
@echo "Makefile for the login service"
|
||||||
@echo "Available targets:"
|
@echo "Available targets:"
|
||||||
@echo " login-help - Show this help message."
|
@echo " login-help - Show this help message."
|
||||||
@echo " login-lint - Run linting and formatting checks. FORCE=true prevents skipping."
|
@echo " login-quality - Run all quality checks (login-lint, login-test-unit, login-test-integration, login-test-acceptance)."
|
||||||
@echo " login-test-unit - Run unit tests. FORCE=true prevents skipping."
|
|
||||||
@echo " login-test-integration - Run integration tests. FORCE=true prevents skipping."
|
|
||||||
@echo " login-standalone-build - Build the docker image for production login containers."
|
@echo " login-standalone-build - Build the docker image for production login containers."
|
||||||
@echo " login-quality - Run all quality checks (login-lint, login-unit, login-integration)."
|
@echo " login-lint - Run linting and formatting checks. FORCE=true prevents skipping."
|
||||||
@echo " login-ci - Run all CI tasks. Run it with the -j flag to parallelize: make -j ci."
|
@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 " show-cache-keys - Show all cache keys with image ids and exit codes."
|
||||||
@echo " clean-cache-keys - Remove all cache keys."
|
@echo " clean-cache-keys - Remove all cache keys."
|
||||||
|
|
||||||
@@ -97,11 +97,7 @@ login-test-acceptance: login-standalone-build login-test-acceptance-build
|
|||||||
$(LOGIN_TEST_ACCEPTANCE_SAMLIDP_TAG)"
|
$(LOGIN_TEST_ACCEPTANCE_SAMLIDP_TAG)"
|
||||||
|
|
||||||
.PHONY: login-quality
|
.PHONY: login-quality
|
||||||
login-quality: login-lint login-test-unit login-test-integration
|
login-quality: login-lint login-test-unit login-test-integration login-test-acceptance
|
||||||
@:
|
|
||||||
|
|
||||||
.PHONY: login-ci
|
|
||||||
login-ci: login-quality login-standalone-build
|
|
||||||
@:
|
@:
|
||||||
|
|
||||||
.PHONY: login-standalone-build
|
.PHONY: login-standalone-build
|
||||||
|
Reference in New Issue
Block a user