Files
pnpm/.github/workflows/test.yml
Zoltan Kochan cd2dc7d481 refactor: prefix internal scripts with . to hide them (#11051)
* fix: ensure PNPM_HOME/bin is in PATH during pnpm setup

When upgrading from old pnpm (global bin = PNPM_HOME) to new pnpm
(global bin = PNPM_HOME/bin), `pnpm setup` would fail because the
spawned `pnpm add -g` checks that the global bin dir is in PATH.
Prepend PNPM_HOME/bin to PATH in the spawned process env so the
check passes during the transition.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: update pnpm to v11 beta 2

* chore: update pnpm to v11 beta 2

* chore: update pnpm to v11 beta 2

* chore: update pnpm to v11 beta 2

* fix: lint

* refactor: rename _-prefixed scripts to .-prefixed scripts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: update root package.json to use .test instead of _test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* ci: update action-setup

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 14:30:56 +01:00

74 lines
2.3 KiB
YAML

name: Test (reusable)
on:
workflow_call:
inputs:
node:
required: true
type: string
platform:
required: true
type: string
permissions:
contents: read
jobs:
test:
name: Test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.platform }}-${{ inputs.node }}
cancel-in-progress: true
runs-on: ${{ inputs.platform }}
steps:
- name: Configure Git
run: |
git config --global core.autocrlf false
git config --global user.name "xyz"
git config --global user.email "x@y.z"
- name: Checkout Commit
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install pnpm
uses: pnpm/action-setup@58e6119fe4f3092a76a7771efb55e04d25b6b26f
with:
standalone: true
- name: Setup Node
run: pnpm runtime -g set node ${{ inputs.node }}
timeout-minutes: 2
# npm is needed for preparing git-hosted dependencies (e.g. in dlx tests)
- name: Verify npm
run: npm --version
- name: pnpm install
run: pnpm install
timeout-minutes: 3
- name: Download compiled artifacts
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: compiled-packages
- name: Extract compiled artifacts
run: tar -xzf compiled.tar.gz
- name: Determine test scope
id: test-scope
shell: bash
run: |
if [[ "${{ github.ref_name }}" == "main" || "${{ github.ref_name }}" == "chore/update-lockfile" ]]; then
echo "script=ci:test-all" >> "$GITHUB_OUTPUT"
echo "scope=all" >> "$GITHUB_OUTPUT"
else
git remote set-branches --add origin main && git fetch origin main --depth=1
if [ -n "$(git diff --name-only origin/main HEAD -- pnpm-workspace.yaml)" ]; then
echo "script=ci:test-all" >> "$GITHUB_OUTPUT"
echo "scope=all — pnpm-workspace.yaml modified" >> "$GITHUB_OUTPUT"
else
echo "script=ci:test-branch" >> "$GITHUB_OUTPUT"
echo "scope=affected packages" >> "$GITHUB_OUTPUT"
fi
fi
- name: Run tests (${{ steps.test-scope.outputs.scope }})
timeout-minutes: 70
run: pnpm run ${{ steps.test-scope.outputs.script }}
env:
PNPM_WORKERS: 3