-
Notifications
You must be signed in to change notification settings - Fork 1
127 lines (110 loc) · 2.78 KB
/
_internal-setup-node.yml
File metadata and controls
127 lines (110 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: setup-node Test
on:
pull_request:
branches:
- main
paths:
- 'setup-node/**'
- '.github/workflows/_internal-setup-node.yml'
push:
branches:
- main
paths:
- 'setup-node/**'
- '.github/workflows/_internal-setup-node.yml'
jobs:
minimal:
name: Minimal (node-version only)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: ./setup-node
with:
node-version: '24'
- name: Assert node + npm available
shell: bash
run: |
node -v
npm -v
node-version-matrix:
name: node-version=${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['22', '24']
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: ./setup-node
with:
node-version: ${{ matrix.node }}
- name: Assert major matches
shell: bash
env:
EXPECTED: ${{ matrix.node }}
run: |
ACTUAL=$(node -v | sed 's/^v\([0-9]*\).*/\1/')
test "$ACTUAL" = "$EXPECTED"
npm-version:
name: npm-version pinned
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: ./setup-node
with:
node-version: '22'
npm-version: '11.5.0'
- name: Assert npm version matches
shell: bash
run: |
test "$(npm -v)" = "11.5.0"
stamp-cache:
name: use-stamp-cache=true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: ./setup-node
with:
node-version: '24'
use-stamp-cache: 'true'
- name: Assert node_modules populated
shell: bash
run: |
test -d node_modules
test -d node_modules/typescript
working-directory:
name: working-directory=subdir
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Seed isolated project
shell: bash
run: |
mkdir -p subproject
cat > subproject/package.json <<'JSON'
{
"name": "subproject",
"version": "1.0.0",
"dependencies": { "is-odd": "3.0.1" }
}
JSON
(cd subproject && npm install --package-lock-only --no-audit)
- uses: ./setup-node
with:
node-version: '24'
working-directory: subproject
- name: Assert install ran in subdir
shell: bash
run: |
test -d subproject/node_modules/is-odd
test ! -d node_modules/is-odd || (echo "install leaked to root" && exit 1)