Files
mealie/.github/workflows/e2e.yml
T

89 lines
3.2 KiB
YAML

name: E2E Tests
on:
workflow_call:
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tests/e2e
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Set up tools
uses: ./.github/actions/setup-tools
with:
tools: node pnpm
cache-pnpm-store: true
- name: Install dependencies
run: pnpm install
# This install takes about 50 seconds and needs nothing the image build
# produces, so the two run at the same time.
- name: Start Playwright browser install
run: |
rm -f /tmp/playwright-install.status
nohup bash -c 'pnpm playwright install --with-deps; echo $? > /tmp/playwright-install.status' \
> /tmp/playwright-install.log 2>&1 &
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
- name: Retrieve Python package
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8
with:
name: backend-dist
path: dist
- name: Build Image
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7
with:
file: ./docker/Dockerfile
context: .
build-contexts: |
packages=dist
push: false
load: true
tags: mealie:e2e
# Read-only: the nightly workflow writes this cache from mealie-next,
# which every PR and merge queue ref can read. A cache that a PR or
# merge queue ref writes is visible to that ref only, and the export
# costs about 2 minutes per run.
cache-from: type=gha
- name: Deploy E2E Test Environment
run: |
docker compose up -d --wait
# The mock OIDC server has no shell, so compose cannot health check it.
for _ in $(seq 1 60); do
curl -fsS http://localhost:8080/default/.well-known/openid-configuration > /dev/null && exit 0
sleep 1
done
echo "the mock OIDC server did not answer"
exit 1
working-directory: ./tests/e2e/docker
- name: Finish Playwright browser install
run: |
for _ in $(seq 1 300); do
[ -f /tmp/playwright-install.status ] && break
sleep 1
done
cat /tmp/playwright-install.log
exit "$(cat /tmp/playwright-install.status 2>/dev/null || echo 1)"
- name: Check test environment
run: docker ps
- name: Run Playwright tests
run: pnpm playwright test
- name: Archive Playwright report
if: failure()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7
with:
name: playwright-report
path: |
tests/e2e/playwright-report
tests/e2e/test-results
retention-days: 5
- name: Dump server logs
if: failure()
run: docker logs mealie-e2e
- name: Destroy Test Environment
if: always()
run: docker compose down --volumes
working-directory: ./tests/e2e/docker