Update pre-commit/playwright #6
This file contains hidden or 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 E2E Tests | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| workflow_call: | |
| inputs: | |
| ref: | |
| required: true | |
| type: string | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-playwright | |
| cancel-in-progress: true | |
| jobs: | |
| playwright-e2e-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Checkout streamlit-pivot-table code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ inputs.ref }} | |
| persist-credentials: false | |
| submodules: "recursive" | |
| fetch-depth: 2 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: ".nvmrc" | |
| cache: "npm" | |
| cache-dependency-path: "**/package-lock.json" | |
| - name: Install frontend dependencies | |
| run: | | |
| cd streamlit_pivot_table/frontend | |
| npm ci | |
| - name: Build frontend | |
| run: | | |
| cd streamlit_pivot_table/frontend | |
| npm run build | |
| - name: Create Python environment cache key | |
| run: | | |
| md5sum $(which python) > $GITHUB_WORKSPACE/python_cache_key.md5 | |
| md5sum e2e_playwright/test-requirements.txt >> $GITHUB_WORKSPACE/python_cache_key.md5 | |
| md5sum pyproject.toml >> $GITHUB_WORKSPACE/python_cache_key.md5 | |
| date +%F >> $GITHUB_WORKSPACE/python_cache_key.md5 | |
| shell: bash | |
| - name: Restore virtualenv from cache | |
| id: cache-virtualenv | |
| uses: actions/cache@v4 | |
| with: | |
| path: venv | |
| key: v1-python-venv-${{ hashFiles('**/python_cache_key.md5') }} | |
| - name: Build the package | |
| run: | | |
| python -m venv venv | |
| source venv/bin/activate | |
| pip install --upgrade pip setuptools wheel build | |
| python -m build | |
| - name: Install Python test dependencies | |
| run: | | |
| source venv/bin/activate | |
| pip install --upgrade pip | |
| pip install -r e2e_playwright/test-requirements.txt | |
| python -m playwright install --with-deps | |
| - name: Run playwright tests | |
| run: | | |
| source venv/bin/activate | |
| cd e2e_playwright | |
| pytest --browser webkit --browser chromium --browser firefox --video retain-on-failure --screenshot only-on-failure -n auto --output ./test-results/ | |
| - name: Upload failed test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright_test_results | |
| path: e2e_playwright/test-results |