2023-10-16 12:02:39 +02:00
|
|
|
name: Visual Regression Tests
|
|
|
|
|
|
|
|
on:
|
2023-12-12 17:22:32 +01:00
|
|
|
pull_request:
|
2023-10-16 12:02:39 +02:00
|
|
|
types: [labeled, synchronize, opened, reopened]
|
|
|
|
paths-ignore:
|
|
|
|
- 'docs/**'
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
selenium-screenshots:
|
|
|
|
if: contains(join(github.event.pull_request.labels.*.name, '|'), 'screenshots')
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Screenshots
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
2024-01-26 13:41:52 +01:00
|
|
|
uses: actions/setup-python@v5
|
2023-10-16 12:02:39 +02:00
|
|
|
with:
|
|
|
|
python-version: '3.11'
|
|
|
|
cache: 'pip'
|
|
|
|
cache-dependency-path: 'tests/requirements/py3.txt'
|
|
|
|
- name: Install and upgrade packaging tools
|
|
|
|
run: python -m pip install --upgrade pip setuptools wheel
|
|
|
|
- run: python -m pip install -r tests/requirements/py3.txt -e .
|
2024-05-01 10:22:04 +02:00
|
|
|
|
2023-10-16 12:02:39 +02:00
|
|
|
- name: Run Selenium tests with screenshots
|
|
|
|
working-directory: ./tests/
|
2024-05-01 10:22:04 +02:00
|
|
|
run: python -Wall runtests.py --verbosity=2 --noinput --selenium=chrome --headless --screenshots --settings=test_sqlite --parallel=2
|
2023-10-16 12:02:39 +02:00
|
|
|
|
2024-05-01 10:46:19 +02:00
|
|
|
- name: Cache oxipng
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: ~/.cargo/
|
|
|
|
key: ${{ runner.os }}-cargo
|
|
|
|
|
|
|
|
- name: Install oxipng
|
|
|
|
run: which oxipng || cargo install oxipng
|
|
|
|
|
|
|
|
- name: Optimize screenshots
|
|
|
|
run: oxipng --interlace=0 --opt=4 --strip=safe tests/screenshots/*.png
|
|
|
|
|
2024-05-01 10:56:49 +02:00
|
|
|
- name: Organize screenshots
|
|
|
|
run: |
|
|
|
|
mkdir --parents "/tmp/screenshots/${{ github.event.pull_request.head.sha }}"
|
|
|
|
mv tests/screenshots/* "/tmp/screenshots/${{ github.event.pull_request.head.sha }}/"
|
|
|
|
|
2023-10-16 12:02:39 +02:00
|
|
|
- name: Upload screenshots
|
2024-01-26 13:41:52 +01:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-10-16 12:02:39 +02:00
|
|
|
with:
|
|
|
|
name: screenshots-${{ github.event.pull_request.head.sha }}
|
2024-05-01 10:56:49 +02:00
|
|
|
path: /tmp/screenshots/
|
|
|
|
if-no-files-found: error
|