Update Playwright configuration for Windows and add snapshot files fo… #20
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
| # Combined workflow for testing and deploying Jekyll site to GitHub Pages | |
| # Tests must pass before deployment proceeds | |
| name: Test and Deploy Jekyll site to Pages | |
| on: | |
| # Runs on pushes targeting the default branch | |
| push: | |
| branches: ["master"] | |
| pull_request: | |
| branches: ["master"] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| inputs: | |
| update_snapshots: | |
| description: 'Update Playwright snapshots' | |
| required: false | |
| default: false | |
| type: boolean | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| # Test job - runs Playwright tests on Windows (matches local dev environment) | |
| test: | |
| timeout-minutes: 60 | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.1' | |
| bundler-cache: true | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install Node dependencies | |
| run: npm ci | |
| - name: Install Playwright Browsers | |
| run: npx playwright install --with-deps chromium | |
| - name: Run Playwright tests | |
| if: ${{ !inputs.update_snapshots }} | |
| run: npx playwright test | |
| env: | |
| BASE_URL: http://127.0.0.1:4000 | |
| - name: Update Playwright Snapshots | |
| if: ${{ inputs.update_snapshots }} | |
| run: npx playwright test --update-snapshots | |
| env: | |
| BASE_URL: http://127.0.0.1:4000 | |
| - name: Upload Playwright Report | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 30 | |
| - name: Upload Test Results | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: test-results | |
| path: test-results/ | |
| retention-days: 30 | |
| - name: Upload Updated Snapshots | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ inputs.update_snapshots }} | |
| with: | |
| name: updated-snapshots | |
| path: | | |
| tests/**/*.png | |
| tests/**/*.txt | |
| retention-days: 30 | |
| # Build job - only runs after tests pass | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| # Only build on push to master (not on PRs) | |
| if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.update_snapshots) | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.1' | |
| bundler-cache: true | |
| - name: Setup Pages | |
| id: pages | |
| uses: actions/configure-pages@v5 | |
| - name: Build with Jekyll | |
| run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" | |
| env: | |
| JEKYLL_ENV: production | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| # Deployment job - only runs after build succeeds | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |