screenshots.yml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: Visual Regression Tests
  2. on:
  3. pull_request:
  4. types: [labeled, synchronize, opened, reopened]
  5. paths-ignore:
  6. - 'docs/**'
  7. concurrency:
  8. group: ${{ github.workflow }}-${{ github.ref }}
  9. cancel-in-progress: true
  10. permissions:
  11. contents: read
  12. jobs:
  13. selenium-screenshots:
  14. if: contains(join(github.event.pull_request.labels.*.name, '|'), 'screenshots')
  15. runs-on: ubuntu-latest
  16. name: Screenshots
  17. steps:
  18. - name: Checkout
  19. uses: actions/checkout@v4
  20. - name: Set up Python
  21. uses: actions/setup-python@v5
  22. with:
  23. python-version: '3.11'
  24. cache: 'pip'
  25. cache-dependency-path: 'tests/requirements/py3.txt'
  26. - name: Install and upgrade packaging tools
  27. run: python -m pip install --upgrade pip setuptools wheel
  28. - run: python -m pip install -r tests/requirements/py3.txt -e .
  29. - name: Run Selenium tests with screenshots
  30. id: generate-screenshots
  31. working-directory: ./tests/
  32. run: |
  33. python -Wall runtests.py --verbosity 2 --noinput --selenium=chrome --headless --screenshots --settings=test_sqlite --parallel 2
  34. echo "date=$(date)" >> $GITHUB_OUTPUT
  35. echo "🖼️ **Screenshots created**" >> $GITHUB_STEP_SUMMARY
  36. echo "Generated screenshots for ${{ github.event.pull_request.head.sha }} at $(date)" >> $GITHUB_STEP_SUMMARY
  37. - name: Upload screenshots
  38. uses: actions/upload-artifact@v4
  39. with:
  40. name: screenshots-${{ github.event.pull_request.head.sha }}
  41. path: tests/screenshots/