feat(QAWTO-194): first workflow approach #1
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Build and run Playwright tests | |
on: | |
push: | |
branches: | |
- master | |
- QAWTO-194/feat/enable-playwright-tests-in-actions | |
pull_request: | |
branches: master | |
jobs: | |
build-and-test: | |
name: Build and Test (Python ${{ matrix.python-version }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Install playwright browsers | |
run: | | |
playwright install | |
- name: Playwright test with pytest | |
run: | | |
cd web_playwright | |
python -m pytest tests/test_web_playwright_pytest.py --browser chromium --junitxml="test-result-browser-chromium.xml" | |
python -m pytest tests/test_web_playwright_library_sync.py --junitxml="test-result-sync.xml" | |
python -m pytest tests/test_web_playwright_library_async.py --junitxml="test-result-async.xml" | |
- name: Upload Playwright Test Results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
continue-on-error: true | |
with: | |
name: playwright-tests-results-python-${{ matrix.python-version }} | |
path: web_playwright/test-result*.xml | |
retention-days: 7 | |
publish-playwright-test-results: | |
name: "Publish Playwright Tests Results" | |
needs: build-and-test | |
runs-on: ubuntu-latest | |
if: success() || failure() | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Download Playwright test Artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: playwright-tests-results-python-${{ matrix.python-version }} | |
path: playwright-tests-results-python-${{ matrix.python-version }} | |
- name: Publish Playwright Test Results ${{ matrix.python-version }} | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: | | |
playwright-tests-results-python-${{ matrix.python-version }}/**/*.xml | |
comment_title: "Playwright Tests Results Python ${{ matrix.python-version }}" |