Files
zitadel/.github/workflows/acceptance-tests.yml
2024-10-16 18:25:03 +02:00

58 lines
1.9 KiB
YAML

name: Acceptance Tests
on: pull_request
jobs:
acceptance-tests:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Run Docker Compose and Install Dependencies in Parallel
run: |
echo "Start docker-compose in the background"
docker compose -f ./acceptance/docker-compose.yaml up -d &
DOCKER_COMPOSE_PID=$!
echo "Docker Compose PID: $DOCKER_COMPOSE_PID"
echo "Install app dependencies in the foreground"
npm install -g pnpm && pnpm install
echo "Install Test Browsers in the background"
pnpm exec playwright install --with-deps &
INSTALL_BROWSERS_PID=$!
echo "Install browsers PID: $INSTALL_BROWSERS_PID"
echo "Generate gRPC stubs in the background"
pnpm generate &
GENERATE_PID=$!
echo "Generate stubs PID: $GENERATE_PID"
echo "Wait for all background processes to finish"
while true; do
wait -n $DOCKER_COMPOSE_PID $INSTALL_BROWSERS_PID $GENERATE_PID
EXIT_STATUS=$?
if [ $EXIT_STATUS -ne 0 ]; then
echo "A background process failed with exit code $EXIT_STATUS."
exit $EXIT_STATUS
fi
# Check if all processes have finished
if ! kill -0 $DOCKER_COMPOSE_PID 2>/dev/null && \
! kill -0 $INSTALL_BROWSERS_PID 2>/dev/null && \
! kill -0 GENERATE_PID 2>/dev/null; then
break
fi
done
echo "Generate and create a production build in the foreground"
pnpm build
- name: Run Playwright Tests
run: pnpm exec playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30