2025 DevOps Dozen Awards #80
Workflow file for this run
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: PR Preview | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'docs/**' | |
| - 'adrs/**' | |
| - '.gemini/**' | |
| - '**/README.md' | |
| workflow_dispatch: | |
| permissions: | |
| checks: write | |
| contents: read | |
| pull-requests: write | |
| # Default to bash | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build_drafts_off: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| preview_url: ${{ steps.deploy.outputs.details_url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Hugo | |
| uses: peaceiris/actions-hugo@v3 | |
| with: | |
| hugo-version: '0.147.9' | |
| extended: true | |
| - name: Build Svelte components | |
| run: | | |
| # Build Svelte apps and move generated files into position | |
| ./svelte/build.sh | |
| - name: Build with Hugo | |
| env: | |
| HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache | |
| HUGO_ENVIRONMENT: production | |
| run: | | |
| hugo --source=./hugo --logLevel=debug --minify | |
| - name: Deploy to Firebase | |
| id: deploy | |
| uses: FirebaseExtended/action-hosting-deploy@v0 | |
| with: | |
| repoToken: ${{ secrets.GITHUB_TOKEN }} | |
| firebaseServiceAccount: ${{ secrets.SERVICE_ACCOUNT }} | |
| expires: 30d | |
| projectId: ${{ vars.GOOGLE_CLOUD_PROJECT }} | |
| channelId: pr${{ github.event.pull_request.number || 'manual' }}_drafts_off | |
| build_drafts_on: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| preview_url: ${{ steps.deploy.outputs.details_url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Hugo | |
| uses: peaceiris/actions-hugo@v3 | |
| with: | |
| hugo-version: '0.147.9' | |
| extended: true | |
| - name: Build Svelte components | |
| run: | | |
| # Build Svelte apps and move generated files into position | |
| ./svelte/build.sh | |
| - name: Build with Hugo | |
| env: | |
| HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache | |
| HUGO_ENVIRONMENT: production | |
| run: | | |
| hugo --source=./hugo --logLevel=debug --buildDrafts --minify | |
| - name: Deploy to Firebase | |
| id: deploy | |
| uses: FirebaseExtended/action-hosting-deploy@v0 | |
| with: | |
| repoToken: ${{ secrets.GITHUB_TOKEN }} | |
| firebaseServiceAccount: ${{ secrets.SERVICE_ACCOUNT }} | |
| expires: 30d | |
| projectId: ${{ vars.GOOGLE_CLOUD_PROJECT }} | |
| channelId: pr${{ github.event.pull_request.number || 'manual' }}_drafts_on | |
| # shard tests across multiple workers | |
| test: | |
| strategy: | |
| matrix: | |
| shard: [1, 2, 3, 4] | |
| runs-on: ubuntu-latest | |
| needs: build_drafts_on | |
| defaults: | |
| run: | |
| shell: bash | |
| working-directory: ./test/playwright | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up node. | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24.x' | |
| - name: Restore cache - playwright binaries | |
| uses: actions/cache/restore@v5 | |
| id: playwright-cache | |
| with: | |
| path: | | |
| ~/.cache/ms-playwright | |
| key: ${{ runner.os }}-playwright-${{ hashFiles('./test/playwright/package-lock.json') }} | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Install Playwright Browsers | |
| if: always() && steps.playwright-cache.outputs.cache-hit != 'true' | |
| run: npx playwright install --with-deps | |
| - name: Save cache - playwright binaries | |
| if: always() && steps.playwright-cache.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v5 | |
| with: | |
| path: | | |
| ~/.cache/ms-playwright | |
| key: ${{ runner.os }}-playwright-${{ hashFiles('./test/playwright/package-lock.json') }} | |
| - name: Playwright tests | |
| env: | |
| PLAYWRIGHT_BASE_URL: ${{needs.build_drafts_on.outputs.preview_url}} | |
| run: | | |
| set -u | |
| npx playwright test --max-failures=1 --shard=${{ matrix.shard }}/${{ strategy.job-total }} | |
| test_redirects: | |
| runs-on: ubuntu-latest | |
| needs: build_drafts_on | |
| defaults: | |
| run: | |
| working-directory: ./test/redirects | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24.x' | |
| - name: Install dependencies | |
| run: npm ci --registry=https://registry.npmjs.org/ | |
| - name: Run redirect tests | |
| env: | |
| BASE_URL: ${{ needs.build_drafts_on.outputs.preview_url }} | |
| run: npx mocha test-redirects.js |