Skip to content

Commit aab85b6

Browse files
authored
ci: upgrade and debug package managers (#400)
upgrade package managers debug package managers --------- Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
1 parent 1e869a3 commit aab85b6

1 file changed

Lines changed: 68 additions & 2 deletions

File tree

.github/workflows/nodejs.yml

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,24 @@ jobs:
6161
with:
6262
node-version: ${{ matrix.node-version }}
6363
package-manager-cache: false # must not usecaches. we want the latest, always
64+
- name: bump npm
65+
shell: bash
66+
env:
67+
NODE_VERSION: '${{ matrix.node-version }}'
68+
run: |
69+
set -eux
70+
case "$NODE_VERSION" in
71+
'26' )
72+
npm install -g npm@latest
73+
;;
74+
'24')
75+
npm i -g npm@^11
76+
;;
77+
'20' | '20.18.0')
78+
npm i -g npm@^10
79+
;;
80+
esac
81+
npm --version
6482
- name: install project
6583
run: >
6684
npm install
@@ -102,9 +120,38 @@ jobs:
102120
with:
103121
node-version: ${{ matrix.node-version }}
104122
package-manager-cache: false # must not usecaches. we want the latest, always
123+
- name: Setup Yarn
124+
shell: bash
125+
run: |
126+
set -eux
127+
npm uninstall -g yarn
128+
corepack enable yarn
129+
case "$NODE_VERSION" in
130+
'14' | '16')
131+
corepack prepare --activate yarn@3.8.7
132+
;;
133+
'18')
134+
corepack prepare --activate yarn@4.0.0
135+
;;
136+
*)
137+
corepack install --global yarn@stable
138+
;;
139+
esac
140+
yarn --version
141+
env:
142+
NODE_VERSION: ${{ matrix.node-version }}
143+
working-directory: .. # prevent evaluation of package.json
105144
- name: install project
106-
run: >
107-
yarn install
145+
shell: bash
146+
run: |
147+
set -eux
148+
YARN_VERSION=$(yarn --version)
149+
YARN_MAJOR=${YARN_VERSION%%.*}
150+
if [ "$YARN_MAJOR" -ge 4 ]; then
151+
export YARN_ENABLE_HARDENED_MODE=0
152+
fi
153+
yarn install \
154+
--no-immutable \
108155
--inline-builds
109156
# proven: the package can be installed. that's enough for a meta-package
110157
test-pnpm-install:
@@ -148,11 +195,30 @@ jobs:
148195
with:
149196
node-version: ${{ matrix.node-version }}
150197
package-manager-cache: false # must not usecaches. we want the latest, always
198+
- name: Remove PNPM from PATH (Windows)
199+
if: ${{ runner.os == 'Windows' }}
200+
shell: pwsh
201+
run: |
202+
Set-PSDebug -Trace 1
203+
# find pnpm
204+
Get-Alias pnpm -ErrorAction SilentlyContinue
205+
Get-ChildItem Function:\pnpm -ErrorAction SilentlyContinue
206+
Get-Command pnpm -ErrorAction SilentlyContinue
207+
# remove pnpm
208+
Remove-Item Alias:\pnpm -Verbose -ErrorAction SilentlyContinue
209+
Remove-Item Function:\pnpm -Verbose -ErrorAction SilentlyContinue
210+
Remove-Item "C:\npm\prefix\pnpm*" -Verbose -Force -ErrorAction SilentlyContinue
211+
# verify
212+
Get-Alias pnpm -ErrorAction SilentlyContinue
213+
Get-ChildItem Function:\pnpm -ErrorAction SilentlyContinue
214+
Get-Command pnpm -ErrorAction SilentlyContinue
151215
- name: setup pnpm
152216
## see https://github.com/pnpm/action-setup
153217
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0
154218
with:
155219
version: ${{ matrix.pnpm-version }}
220+
- name: test pnpm
221+
run: pnpm --version
156222
- name: install project
157223
run: >
158224
pnpm install

0 commit comments

Comments
 (0)