* test: remove cypress + migrate existing tests to playwright + update workflows * ci: remove leftover condition in ci-run-tests workflow * ci: add missing matrix to tests-playwright-legacy * ci: run playwright legacy as user 1001 * ci: set home var for firefox * ci: allow firefox to run as root for tests
177 lines
4.8 KiB
YAML
177 lines
4.8 KiB
YAML
name: Run All Tests
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- 'main'
|
|
- 'feat/tzaware'
|
|
paths:
|
|
- 'ietf/**'
|
|
- 'requirements.txt'
|
|
- 'package.json'
|
|
|
|
jobs:
|
|
tests-python:
|
|
name: Run Tests (Python)
|
|
runs-on: ubuntu-latest
|
|
container: ghcr.io/ietf-tools/datatracker-app-base:latest
|
|
|
|
services:
|
|
db:
|
|
image: ghcr.io/ietf-tools/datatracker-db:latest
|
|
volumes:
|
|
- mariadb-data:/var/lib/mysql
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: ietf
|
|
MYSQL_DATABASE: ietf_utf8
|
|
MYSQL_USER: django
|
|
MYSQL_PASSWORD: RkTkDPFnKpko
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Prepare for tests
|
|
run: |
|
|
chmod +x ./dev/tests/prepare.sh
|
|
sh ./dev/tests/prepare.sh
|
|
|
|
- name: Ensure DB is ready
|
|
run: |
|
|
/usr/local/bin/wait-for db:3306 -- echo "DB ready"
|
|
|
|
- name: Run all tests
|
|
run: |
|
|
echo "Running checks..."
|
|
./ietf/manage.py check
|
|
echo "Running migrations with USE_TZ=False..."
|
|
./ietf/manage.py migrate || true
|
|
echo "USE_TZ = True" >> ./ietf/settings_local.py
|
|
echo "Running migrations with USE_TZ=True..."
|
|
./ietf/manage.py migrate
|
|
echo "Validating migrations..."
|
|
if ! ( ietf/manage.py makemigrations --dry-run --check --verbosity 3 ) ; then
|
|
echo "Model changes without migrations found."
|
|
echo ${MSG}
|
|
exit 1
|
|
fi
|
|
echo "Running tests..."
|
|
./ietf/manage.py test --settings=settings_sqlitetest
|
|
coverage xml
|
|
|
|
- name: Upload Coverage Results to Codecov
|
|
uses: codecov/codecov-action@v2.1.0
|
|
with:
|
|
files: coverage.xml
|
|
|
|
- name: Convert Coverage Results
|
|
if: ${{ always() }}
|
|
run: |
|
|
mv latest-coverage.json coverage.json
|
|
|
|
- name: Upload Coverage Results as Build Artifact
|
|
uses: actions/upload-artifact@v3.0.0
|
|
if: ${{ always() }}
|
|
with:
|
|
name: coverage
|
|
path: coverage.json
|
|
|
|
tests-playwright:
|
|
name: Run Tests (Playwright)
|
|
runs-on: macos-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
project: [chromium, firefox]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Run all tests
|
|
run: |
|
|
echo "Installing dependencies..."
|
|
yarn
|
|
echo "Installing Playwright..."
|
|
cd playwright
|
|
mkdir test-results
|
|
npm ci
|
|
npx playwright install --with-deps ${{ matrix.project }}
|
|
echo "Running tests..."
|
|
npx playwright test --project=${{ matrix.project }}
|
|
|
|
- name: Upload Report
|
|
uses: actions/upload-artifact@v3.0.0
|
|
if: ${{ always() }}
|
|
continue-on-error: true
|
|
with:
|
|
name: playwright-results-${{ matrix.project }}
|
|
path: playwright/test-results/
|
|
if-no-files-found: ignore
|
|
|
|
tests-playwright-legacy:
|
|
name: Run Tests (Playwright Legacy)
|
|
runs-on: ubuntu-latest
|
|
container: ghcr.io/ietf-tools/datatracker-app-base:latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
project: [chromium, firefox]
|
|
|
|
services:
|
|
db:
|
|
image: ghcr.io/ietf-tools/datatracker-db:latest
|
|
volumes:
|
|
- mariadb-data:/var/lib/mysql
|
|
env:
|
|
MYSQL_ROOT_PASSWORD: ietf
|
|
MYSQL_DATABASE: ietf_utf8
|
|
MYSQL_USER: django
|
|
MYSQL_PASSWORD: RkTkDPFnKpko
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Prepare for tests
|
|
run: |
|
|
chmod +x ./dev/tests/prepare.sh
|
|
sh ./dev/tests/prepare.sh
|
|
|
|
- name: Ensure DB is ready
|
|
run: |
|
|
/usr/local/bin/wait-for db:3306 -- echo "DB ready"
|
|
|
|
- name: Start Datatracker
|
|
run: |
|
|
echo "Running checks..."
|
|
./ietf/manage.py check
|
|
echo "Starting datatracker..."
|
|
./ietf/manage.py runserver 0.0.0.0:8000 --settings=settings_local &
|
|
echo "Waiting for datatracker to be ready..."
|
|
/usr/local/bin/wait-for localhost:8000 -- echo "Datatracker ready"
|
|
|
|
- name: Run all tests
|
|
env:
|
|
HOME: ""
|
|
run: |
|
|
echo "Installing dependencies..."
|
|
yarn
|
|
echo "Installing Playwright..."
|
|
cd playwright
|
|
mkdir test-results
|
|
npm ci
|
|
npx playwright install --with-deps ${{ matrix.project }}
|
|
echo "Running tests..."
|
|
npx playwright test --project=${{ matrix.project }} -c playwright-legacy.config.js
|
|
|
|
- name: Upload Report
|
|
uses: actions/upload-artifact@v3
|
|
if: ${{ always() }}
|
|
continue-on-error: true
|
|
with:
|
|
name: playwright-legacy-results-${{ matrix.project }}
|
|
path: playwright/test-results/
|
|
if-no-files-found: ignore
|