Skip to content

Commit f905544

Browse files
committed
feat!: postinstall for dependabot template-oss PR
BREAKING CHANGE: `nopt` is now compatible with the following semver range for node: `^14.17.0 || ^16.13.0 || >=18.0.0`
1 parent 75630c1 commit f905544

14 files changed

+650
-135
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version: 2
44

55
updates:
66
- package-ecosystem: npm
7-
directory: "/"
7+
directory: /
88
schedule:
99
interval: daily
1010
allow:

.github/matchers/tap.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"//@npmcli/template-oss": "This file is automatically added by @npmcli/template-oss. Do not edit.",
3+
"problemMatcher": [
4+
{
5+
"owner": "tap",
6+
"pattern": [
7+
{
8+
"regexp": "^\\s*not ok \\d+ - (.*)",
9+
"message": 1
10+
},
11+
{
12+
"regexp": "^\\s*---"
13+
},
14+
{
15+
"regexp": "^\\s*at:"
16+
},
17+
{
18+
"regexp": "^\\s*line:\\s*(\\d+)",
19+
"line": 1
20+
},
21+
{
22+
"regexp": "^\\s*column:\\s*(\\d+)",
23+
"column": 1
24+
},
25+
{
26+
"regexp": "^\\s*file:\\s*(.*)",
27+
"file": 1
28+
}
29+
]
30+
}
31+
]
32+
}

.github/workflows/audit.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,33 @@ name: Audit
55
on:
66
workflow_dispatch:
77
schedule:
8-
# "At 01:00 on Monday" https://crontab.guru/#0_1_*_*_1
9-
- cron: "0 1 * * 1"
8+
# "At 08:00 UTC (01:00 PT) on Monday" https://crontab.guru/#0_8_*_*_1
9+
- cron: "0 8 * * 1"
1010

1111
jobs:
1212
audit:
13+
name: Audit Dependencies
14+
if: github.repository_owner == 'npm'
1315
runs-on: ubuntu-latest
16+
defaults:
17+
run:
18+
shell: bash
1419
steps:
15-
- uses: actions/checkout@v3
16-
- name: Setup git user
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
- name: Setup Git User
1723
run: |
1824
git config --global user.email "[email protected]"
1925
git config --global user.name "npm CLI robot"
20-
- uses: actions/setup-node@v3
26+
- name: Setup Node
27+
uses: actions/setup-node@v3
2128
with:
22-
node-version: 16.x
23-
- name: Update npm to latest
29+
node-version: 18.x
30+
- name: Install npm@latest
2431
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
25-
- run: npm -v
26-
- run: npm i --ignore-scripts --no-audit --no-fund --package-lock
27-
- run: npm audit
32+
- name: npm Version
33+
run: npm -v
34+
- name: Install Dependencies
35+
run: npm i --ignore-scripts --no-audit --no-fund --package-lock
36+
- name: Run Audit
37+
run: npm audit

.github/workflows/ci-release.yml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
name: CI - Release
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
ref:
9+
required: true
10+
type: string
11+
check-sha:
12+
required: true
13+
type: string
14+
15+
jobs:
16+
lint-all:
17+
name: Lint All
18+
if: github.repository_owner == 'npm'
19+
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
shell: bash
23+
steps:
24+
- name: Create Check
25+
uses: LouisBrunner/[email protected]
26+
id: check
27+
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
status: in_progress
31+
name: Lint All
32+
sha: ${{ inputs.check-sha }}
33+
# XXX: this does not work when using the default GITHUB_TOKEN.
34+
# Instead we post the main job url to the PR as a comment which
35+
# will link to all the other checks. To work around this we would
36+
# need to create a GitHub that would create on-demand tokens.
37+
# https://github.com/LouisBrunner/checks-action/issues/18
38+
# details_url:
39+
- name: Checkout
40+
uses: actions/checkout@v3
41+
with:
42+
ref: ${{ inputs.ref }}
43+
- name: Setup Git User
44+
run: |
45+
git config --global user.email "[email protected]"
46+
git config --global user.name "npm CLI robot"
47+
- name: Setup Node
48+
uses: actions/setup-node@v3
49+
with:
50+
node-version: 18.x
51+
- name: Install npm@latest
52+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
53+
- name: npm Version
54+
run: npm -v
55+
- name: Install Dependencies
56+
run: npm i --ignore-scripts --no-audit --no-fund
57+
- name: Lint
58+
run: npm run lint --ignore-scripts
59+
- name: Post Lint
60+
run: npm run postlint --ignore-scripts
61+
- name: Conclude Check
62+
uses: LouisBrunner/[email protected]
63+
if: always()
64+
with:
65+
token: ${{ secrets.GITHUB_TOKEN }}
66+
conclusion: ${{ job.status }}
67+
check_id: ${{ steps.check.outputs.check_id }}
68+
69+
test-all:
70+
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
71+
if: github.repository_owner == 'npm'
72+
strategy:
73+
fail-fast: false
74+
matrix:
75+
platform:
76+
- name: Linux
77+
os: ubuntu-latest
78+
shell: bash
79+
- name: macOS
80+
os: macos-latest
81+
shell: bash
82+
node-version:
83+
- 14.17.0
84+
- 14.x
85+
- 16.13.0
86+
- 16.x
87+
- 18.0.0
88+
- 18.x
89+
runs-on: ${{ matrix.platform.os }}
90+
defaults:
91+
run:
92+
shell: ${{ matrix.platform.shell }}
93+
steps:
94+
- name: Create Check
95+
uses: LouisBrunner/[email protected]
96+
id: check
97+
98+
with:
99+
token: ${{ secrets.GITHUB_TOKEN }}
100+
status: in_progress
101+
name: Test All - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
102+
sha: ${{ inputs.check-sha }}
103+
# XXX: this does not work when using the default GITHUB_TOKEN.
104+
# Instead we post the main job url to the PR as a comment which
105+
# will link to all the other checks. To work around this we would
106+
# need to create a GitHub that would create on-demand tokens.
107+
# https://github.com/LouisBrunner/checks-action/issues/18
108+
# details_url:
109+
- name: Checkout
110+
uses: actions/checkout@v3
111+
with:
112+
ref: ${{ inputs.ref }}
113+
- name: Setup Git User
114+
run: |
115+
git config --global user.email "[email protected]"
116+
git config --global user.name "npm CLI robot"
117+
- name: Setup Node
118+
uses: actions/setup-node@v3
119+
with:
120+
node-version: ${{ matrix.node-version }}
121+
- name: Update Windows npm
122+
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
123+
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
124+
run: |
125+
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
126+
tar xf npm-7.5.4.tgz
127+
cd package
128+
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
129+
cd ..
130+
rmdir /s /q package
131+
- name: Install npm@7
132+
if: startsWith(matrix.node-version, '10.')
133+
run: npm i --prefer-online --no-fund --no-audit -g npm@7
134+
- name: Install npm@latest
135+
if: ${{ !startsWith(matrix.node-version, '10.') }}
136+
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
137+
- name: npm Version
138+
run: npm -v
139+
- name: Install Dependencies
140+
run: npm i --ignore-scripts --no-audit --no-fund
141+
- name: Add Problem Matcher
142+
run: echo "::add-matcher::.github/matchers/tap.json"
143+
- name: Test
144+
run: npm test --ignore-scripts -ws -iwr --if-present
145+
- name: Conclude Check
146+
uses: LouisBrunner/[email protected]
147+
if: always()
148+
with:
149+
token: ${{ secrets.GITHUB_TOKEN }}
150+
conclusion: ${{ job.status }}
151+
check_id: ${{ steps.check.outputs.check_id }}

.github/workflows/ci.yml

Lines changed: 51 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,64 +5,80 @@ name: CI
55
on:
66
workflow_dispatch:
77
pull_request:
8-
branches:
9-
- '*'
108
push:
119
branches:
1210
- main
1311
- latest
1412
schedule:
15-
# "At 02:00 on Monday" https://crontab.guru/#0_2_*_*_1
16-
- cron: "0 2 * * 1"
13+
# "At 09:00 UTC (02:00 PT) on Monday" https://crontab.guru/#0_9_*_*_1
14+
- cron: "0 9 * * 1"
1715

1816
jobs:
1917
lint:
18+
name: Lint
19+
if: github.repository_owner == 'npm'
2020
runs-on: ubuntu-latest
21+
defaults:
22+
run:
23+
shell: bash
2124
steps:
22-
- uses: actions/checkout@v3
23-
- name: Setup git user
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
- name: Setup Git User
2428
run: |
2529
git config --global user.email "[email protected]"
2630
git config --global user.name "npm CLI robot"
27-
- uses: actions/setup-node@v3
31+
- name: Setup Node
32+
uses: actions/setup-node@v3
2833
with:
29-
node-version: 16.x
30-
- name: Update npm to latest
34+
node-version: 18.x
35+
- name: Install npm@latest
3136
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
32-
- run: npm -v
33-
- run: npm i --ignore-scripts --no-audit --no-fund
34-
- run: npm run lint
37+
- name: npm Version
38+
run: npm -v
39+
- name: Install Dependencies
40+
run: npm i --ignore-scripts --no-audit --no-fund
41+
- name: Lint
42+
run: npm run lint --ignore-scripts
43+
- name: Post Lint
44+
run: npm run postlint --ignore-scripts
3545

3646
test:
47+
name: Test - ${{ matrix.platform.name }} - ${{ matrix.node-version }}
48+
if: github.repository_owner == 'npm'
3749
strategy:
3850
fail-fast: false
3951
matrix:
40-
node-version:
41-
- 12.13.0
42-
- 12.x
43-
- 14.15.0
44-
- 14.x
45-
- 16.0.0
46-
- 16.x
4752
platform:
48-
- os: ubuntu-latest
53+
- name: Linux
54+
os: ubuntu-latest
4955
shell: bash
50-
- os: macos-latest
56+
- name: macOS
57+
os: macos-latest
5158
shell: bash
59+
node-version:
60+
- 14.17.0
61+
- 14.x
62+
- 16.13.0
63+
- 16.x
64+
- 18.0.0
65+
- 18.x
5266
runs-on: ${{ matrix.platform.os }}
5367
defaults:
5468
run:
5569
shell: ${{ matrix.platform.shell }}
5670
steps:
57-
- uses: actions/checkout@v3
58-
- name: Setup git user
71+
- name: Checkout
72+
uses: actions/checkout@v3
73+
- name: Setup Git User
5974
run: |
6075
git config --global user.email "[email protected]"
6176
git config --global user.name "npm CLI robot"
62-
- uses: actions/setup-node@v3
77+
- name: Setup Node
78+
uses: actions/setup-node@v3
6379
with:
6480
node-version: ${{ matrix.node-version }}
65-
- name: Update to workable npm (windows)
81+
- name: Update Windows npm
6682
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
6783
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
6884
run: |
@@ -72,13 +88,17 @@ jobs:
7288
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
7389
cd ..
7490
rmdir /s /q package
75-
- name: Update npm to 7
76-
# If we do test on npm 10 it needs npm7
91+
- name: Install npm@7
7792
if: startsWith(matrix.node-version, '10.')
7893
run: npm i --prefer-online --no-fund --no-audit -g npm@7
79-
- name: Update npm to latest
94+
- name: Install npm@latest
8095
if: ${{ !startsWith(matrix.node-version, '10.') }}
8196
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
82-
- run: npm -v
83-
- run: npm i --ignore-scripts --no-audit --no-fund
84-
- run: npm test --ignore-scripts
97+
- name: npm Version
98+
run: npm -v
99+
- name: Install Dependencies
100+
run: npm i --ignore-scripts --no-audit --no-fund
101+
- name: Add Problem Matcher
102+
run: echo "::add-matcher::.github/matchers/tap.json"
103+
- name: Test
104+
run: npm test --ignore-scripts -iwr

0 commit comments

Comments
 (0)