feat(advanced): PER-8195 Phase 1 — add advanced example for percy-sel… #87
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: Tests | |
| # PER-8195: explicitly use `pull_request` only. `pull_request_target` is | |
| # forbidden — it checks out attacker-controlled code with full secret access. | |
| on: [push, pull_request] | |
| jobs: | |
| basic: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.x | |
| - uses: actions/setup-node@v1 | |
| with: | |
| node-version: 18 | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: v1/${{ runner.os }}/pip/${{ hashFiles('**/{requirements,development}.txt') }} | |
| restore-keys: v1/${{ runner.os }}/pip/ | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.npm | |
| key: v1/${{ runner.os }}/node-18/${{ hashFiles('**/package-lock.lock') }} | |
| restore-keys: v1/${{ runner.os }}/node-18/ | |
| - name: Run tests | |
| uses: percy/exec-action@v0.3.1 | |
| with: | |
| custom-command: "make test" | |
| env: | |
| PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} | |
| advanced: | |
| # PER-8195 advanced example. Runs in --testing mode so PR builds (including | |
| # forks and Dependabot) don't require a real PERCY_TOKEN. The `--testing` | |
| # flag is only valid on `percy exec` (not `exec:start`). | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| defaults: | |
| run: | |
| working-directory: advanced | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18 | |
| - name: Install jq + yq + percy CLI | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq jq | |
| sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
| sudo chmod +x /usr/local/bin/yq | |
| npm install --no-save @percy/cli@^1.31.13 | |
| - name: Install advanced/ python dependencies | |
| run: make install | |
| - name: Fetch shared advanced-snapshot assertion helper | |
| # TODO(PER-8195 D8): pin to a tagged commit once percy-public-repos-parent | |
| # publishes the scripts/ dir to a stable URL or to an npm package. | |
| run: | | |
| curl -fsSL -o /tmp/assert-advanced-snapshots.sh \ | |
| https://raw.githubusercontent.com/percy/percy-public-repos-parent/main/scripts/assert-advanced-snapshots.sh | |
| chmod +x /tmp/assert-advanced-snapshots.sh | |
| - name: Run pytest advanced (--testing) + capture /test/requests | |
| env: | |
| PERCY_TOKEN: fake_token | |
| run: make test-advanced-ci | |
| - name: Assert matrix-row coverage | |
| env: | |
| PERCY_REQUESTS_FILE: ${{ github.workspace }}/advanced/advanced-requests.json | |
| run: /tmp/assert-advanced-snapshots.sh ./matrix.yml |