Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: test accepance against QA and Prod #303

Merged
merged 35 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5381084
test: test acceptance against cloud
eliobischof Nov 27, 2024
80fd39f
quotes
eliobischof Nov 27, 2024
6a03c58
GITHUB_OUTPUT
eliobischof Nov 27, 2024
1f1310b
minutely
eliobischof Nov 27, 2024
16a1bcb
minutely
eliobischof Nov 27, 2024
0bae8d9
json
eliobischof Nov 27, 2024
64b2dc4
dispatch
eliobischof Nov 27, 2024
c95f5cd
inputs
eliobischof Nov 27, 2024
f39e972
elif
eliobischof Nov 27, 2024
1fb6dec
enum
eliobischof Nov 27, 2024
95a2cd7
json
eliobischof Nov 27, 2024
be6e63e
json
eliobischof Nov 27, 2024
565041f
debug
eliobischof Nov 27, 2024
def3174
debug
eliobischof Nov 27, 2024
e12d3c7
quote
eliobischof Nov 27, 2024
c386897
quote
eliobischof Nov 27, 2024
d489894
quote
eliobischof Nov 27, 2024
74db49e
quote
eliobischof Nov 27, 2024
71d9f99
id
eliobischof Nov 27, 2024
fab9206
debug
eliobischof Nov 27, 2024
ef7fd86
no dashes
eliobischof Nov 27, 2024
cf47029
needs matrix
eliobischof Nov 27, 2024
b1f3d72
-n
eliobischof Nov 27, 2024
857dd91
acceptance
eliobischof Nov 27, 2024
6600ca2
cleanup
eliobischof Nov 27, 2024
30f4347
overwritable image
eliobischof Nov 27, 2024
c7cfbb6
debug
eliobischof Nov 27, 2024
9b37650
debug
eliobischof Nov 27, 2024
01fc92e
dont build
eliobischof Nov 27, 2024
d887493
tee
eliobischof Nov 27, 2024
3c54583
Merge branch 'main' into main
peintnermax Nov 27, 2024
6c7a1b9
lint
eliobischof Nov 27, 2024
b38c9ab
Merge branch 'main' of github.com:eliobischof/typescript
eliobischof Nov 27, 2024
16902a0
Merge branch 'main' into main
stebenz Dec 5, 2024
ad1731d
Merge branch 'main' into main
eliobischof Dec 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 45 additions & 12 deletions .github/workflows/test.yml
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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }}
2 changes: 1 addition & 1 deletion acceptance/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
zitadel:
user: "${ZITADEL_DEV_UID}"
image: ghcr.io/zitadel/zitadel:v2.65.0
image: "${ZITADEL_IMAGE:-ghcr.io/zitadel/zitadel:v2.65.0}"
eliobischof marked this conversation as resolved.
Show resolved Hide resolved
command: 'start-from-init --masterkey "MasterkeyNeedsToHave32Characters" --tlsMode disabled --config /zitadel.yaml --steps /zitadel.yaml'
ports:
- "8080:8080"
Expand Down
1 change: 1 addition & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default defineConfig({
],

/* Run local dev server before starting the tests */

webServer: {
command: "pnpm start:built",
url: "http://127.0.0.1:3000",
Expand Down
Loading