Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,26 @@ jobs:
run: npx playwright install --with-deps chromium
- name: Build
run: npm run build --workspaces=true
# Fork PRs don't have access to secrets, so live E2E tests (e.g. Netlify
# deploy tests) must be skipped.
- name: Flag fork PR
if:
${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name !=
'netlify/primitives' }}
run: echo "SKIP_LIVE_TESTS=true" >> "$GITHUB_ENV"
Comment thread
serhalp marked this conversation as resolved.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Write SKIP_LIVE_TESTS using a shell-agnostic command

This step executes in the test matrix on windows-latest as well, but echo "SKIP_LIVE_TESTS=true" >> "$GITHUB_ENV" uses Bash-style variable expansion. Because no shell override is set, Windows runners use PowerShell, where this expression does not resolve the environment file path correctly, so fork PR jobs can fail here instead of skipping live tests. Please either force shell: bash or use PowerShell-compatible syntax (and apply the same fix to the later $GITHUB_STEP_SUMMARY writes).

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GHA defaults to bash even on Windows runners!

- name: Tests
run: npm run test --workspaces=true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- name: Warn if live tests were skipped
if: ${{ env.SKIP_LIVE_TESTS == 'true' }}
run: |
echo "::warning::Live E2E tests were skipped because secrets are not available (likely a fork PR)."
echo "## ⚠️ Live E2E tests were skipped" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "This workflow run does not have access to secrets (likely a fork PR)." >> "$GITHUB_STEP_SUMMARY"
echo "Live tests that deploy to Netlify were skipped." >> "$GITHUB_STEP_SUMMARY"
echo "Maintainers: before merging, verify that these tests pass or aren't relevant." >> "$GITHUB_STEP_SUMMARY"
test-node18:
name: Test Node.js 18 for specific packages
runs-on: ${{ matrix.os }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ const FIXTURES_DIR = fileURLToPath(new URL('../fixtures', import.meta.url))
const isSupportedNode = semver.gte(process.versions.node, '22.12.0')
// TODO(serhalp) e2e fixture deploy fails on Windows - investigate and re-enable
const isWindows = process.platform === 'win32'
// Live tests require secrets (e.g. NETLIFY_AUTH_TOKEN) which are unavailable in fork PRs.
// CI sets SKIP_LIVE_TESTS=true in that case. See .github/workflows/test.yaml.
const skipLiveTests = process.env.SKIP_LIVE_TESTS === 'true'

describe.runIf(isSupportedNode && !isWindows)('build output when deployed to Netlify', () => {
describe.runIf(isSupportedNode && !isWindows && !skipLiveTests)('build output when deployed to Netlify', () => {
let fixture: Fixture
let baseUrl: string
beforeAll(async () => {
Expand Down
Loading