-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #303 from eliobischof/main
chore: test accepance against QA and Prod
- Loading branch information
Showing
3 changed files
with
47 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,39 @@ | ||
name: Quality | ||
|
||
on: pull_request | ||
on: | ||
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: | ||
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: | ||
name: Ensure Quality | ||
|
||
|
@@ -13,15 +44,13 @@ jobs: | |
permissions: | ||
contents: "read" | ||
|
||
needs: | ||
- matrix | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
command: | ||
- format --check | ||
- lint | ||
- test:unit | ||
- test:integration | ||
- test:acceptance | ||
command: ${{ fromJson( needs.matrix.outputs.matrix ) }} | ||
|
||
steps: | ||
- name: Checkout Repo | ||
|
@@ -55,7 +84,7 @@ jobs: | |
# 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: ${{ matrix.command == 'test:acceptance' }} | ||
if: ${{ startsWith(matrix.command, 'test:acceptance') }} | ||
|
||
- uses: actions/[email protected] | ||
name: Setup Playwright binary cache | ||
|
@@ -65,11 +94,11 @@ jobs: | |
key: ${{ runner.os }}-playwright-binary-${{ env.PLAYWRIGHT_VERSION }} | ||
restore-keys: | | ||
${{ runner.os }}-playwright-binary- | ||
if: ${{ matrix.command == 'test:acceptance' }} | ||
if: ${{ startsWith(matrix.command, 'test:acceptance') }} | ||
|
||
- name: Install Playwright Browsers | ||
run: pnpm exec playwright install --with-deps | ||
if: ${{ matrix.command == 'test:acceptance' && steps.playwright-cache.outputs.cache-hit != 'true' }} | ||
if: ${{ startsWith(matrix.command, 'test:acceptance') && steps.playwright-cache.outputs.cache-hit != 'true' }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
@@ -79,10 +108,14 @@ jobs: | |
run: ZITADEL_DEV_UID=root pnpm run-zitadel | ||
if: ${{ matrix.command == 'test:acceptance' }} | ||
|
||
- name: Create Cloud Env File | ||
run: echo "${{ matrix.command == 'test:acceptance:prod' && secrets.ENV_FILE_CONTENT_ACCEPTANCE_PROD || secrets.ENV_FILE_CONTENT_ACCEPTANCE_QA }}" | tee apps/login/.env.local acceptance/tests/.env.local > /dev/null | ||
if: ${{ matrix.command == 'test:acceptance:qa' || matrix.command == 'test:acceptance:prod' }} | ||
|
||
- name: Create Production Build | ||
run: pnpm build | ||
if: ${{ matrix.command == 'test:acceptance' }} | ||
if: ${{ startsWith(matrix.command, 'test:acceptance') }} | ||
|
||
- name: Check | ||
id: check | ||
run: pnpm ${{ matrix.command }} | ||
run: pnpm ${{ contains(matrix.command, 'test:acceptance') && 'test:acceptance' || matrix.command }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters