mirror of
https://github.com/pnpm/action-setup.git
synced 2026-04-19 13:29:54 +08:00
Compare commits
2 Commits
v6.0.1
...
test-repro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdf0af2a9d | ||
|
|
71c92474e7 |
76
.github/workflows/test.yaml
vendored
76
.github/workflows/test.yaml
vendored
@@ -129,6 +129,82 @@ jobs:
|
||||
pnpm add is-odd
|
||||
shell: bash
|
||||
|
||||
test_version_respects_request:
|
||||
name: 'Test version input is actually installed (${{ matrix.version }}, ${{ matrix.os }})'
|
||||
# Regression test for #225 / #230: the bootstrap pnpm on PATH was shadowing the self-updated binary,
|
||||
# so a user requesting e.g. `version: 9.15.5` would silently get the bootstrap version.
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
version:
|
||||
- '9.15.5'
|
||||
- '10.33.0'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
|
||||
- name: Run the action
|
||||
uses: ./
|
||||
with:
|
||||
version: ${{ matrix.version }}
|
||||
|
||||
- name: 'Test: exact version installed'
|
||||
run: |
|
||||
required='${{ matrix.version }}'
|
||||
actual="$(pnpm --version)"
|
||||
echo "pnpm version: ${actual}"
|
||||
if [ "${actual}" != "${required}" ]; then
|
||||
echo "Expected pnpm version ${required}, but got ${actual}"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
test_package_manager_field:
|
||||
name: 'Test packageManager field is respected (${{ matrix.version }}, ${{ matrix.os }})'
|
||||
# Reproduces #227: when `packageManager` is set in package.json and no `version:` input is given,
|
||||
# the action should install the version specified there.
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
version:
|
||||
- '9.15.5'
|
||||
- '10.33.0'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
|
||||
- name: Set up package.json with packageManager field
|
||||
run: echo '{"packageManager":"pnpm@${{ matrix.version }}"}' > package.json
|
||||
shell: bash
|
||||
|
||||
- name: Run the action
|
||||
uses: ./
|
||||
|
||||
- name: 'Test: exact version installed'
|
||||
run: |
|
||||
required='${{ matrix.version }}'
|
||||
actual="$(pnpm --version)"
|
||||
echo "pnpm version: ${actual}"
|
||||
if [ "${actual}" != "${required}" ]; then
|
||||
echo "Expected pnpm version ${required}, but got ${actual}"
|
||||
exit 1
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
test_dev_engines:
|
||||
name: Test with devEngines.packageManager
|
||||
|
||||
|
||||
299
dist/index.js
vendored
299
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -40,11 +40,13 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||
const pnpmHome = standalone && process.platform === 'win32'
|
||||
? path.join(dest, 'node_modules', '@pnpm', 'exe')
|
||||
: path.join(dest, 'node_modules', '.bin')
|
||||
// pnpm expects PNPM_HOME/bin in PATH for global binaries (e.g. node
|
||||
// installed via `pnpm runtime`). Add it first so the next addPath
|
||||
// (pnpmHome itself, which contains pnpm.exe) has higher precedence.
|
||||
addPath(path.join(pnpmHome, 'bin'))
|
||||
// PNPM_HOME/bin is where `pnpm self-update` places the target version
|
||||
// binary. It must have higher PATH precedence than pnpmHome (which
|
||||
// contains the bootstrap binary) so the self-updated version is found
|
||||
// first. The bootstrap pnpm is invoked via absolute path, not PATH,
|
||||
// so this ordering does not affect the bootstrap step.
|
||||
addPath(pnpmHome)
|
||||
addPath(path.join(pnpmHome, 'bin'))
|
||||
exportVariable('PNPM_HOME', pnpmHome)
|
||||
|
||||
// Ensure pnpm bin link exists — npm ci sometimes doesn't create it
|
||||
|
||||
Reference in New Issue
Block a user