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
name: Playwright Tests for App Built with Starter Kit | |
on: [push, pull_request] | |
env: | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
DEBUG: 0 | |
ALLOWED_HOSTS: '*' | |
CSRF_TRUSTED_ORIGINS: ${{ vars.CSRF_TRUSTED_ORIGINS }} | |
EMAIL_BACKEND: ${{ secrets.EMAIL_BACKEND }} | |
EMAIL_HOST: ${{ secrets.EMAIL_HOST }} | |
EMAIL_PORT: ${{ secrets.EMAIL_PORT }} | |
EMAIL_HOST_USER: ${{ secrets.EMAIL_HOST_USER }} | |
EMAIL_HOST_PASSWORD: ${{ secrets.EMAIL_HOST_PASSWORD }} | |
EMAIL_USE_TLS: 1 | |
PLAYWRIGHT_USERNAME: ${{ secrets.PLAYWRIGHT_USERNAME }} | |
PLAYWRIGHT_PASSWORD: ${{ secrets.PLAYWRIGHT_PASSWORD }} | |
jobs: | |
test: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install Django bits | |
run: | | |
mkdir test_project | |
cd test_project | |
python3 -m venv --prompt . .venv | |
.venv/bin/pip install -U pip setuptools wheel | |
.venv/bin/python -m pip install Django uv | |
.venv/bin/django-admin startproject --template=https://github.com/piepworks/django-starter/archive/${BRANCH_NAME}.zip test_project . | |
.venv/bin/uv sync --no-dev --locked | |
.venv/bin/python manage.py makemigrations | |
.venv/bin/python manage.py migrate --noinput | |
.venv/bin/python manage.py loaddata e2e/django-fixtures.json | |
.venv/bin/python manage.py collectstatic --noinput | |
npm install | |
npm run build | |
- name: Install dependencies | |
run: cd test_project && npm ci | |
- name: Install Playwright Browsers | |
run: cd test_project && npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: cd test_project && CREATE_USER=True npx playwright test --ignore-snapshots | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: artifacts | |
path: | | |
test_project/playwright-report/ | |
test_project/test-results/ | |
retention-days: 2 |