Skip to content

Commit

Permalink
fix: only reference matrix in relavent actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Mar 17, 2022
1 parent d5d546e commit f951c95
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 252 deletions.
15 changes: 0 additions & 15 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12') || startsWith(matrix.node-version, '14'))
run: |
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
tar xf npm-7.5.4.tgz
cd package
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
cd ..
rmdir /s /q package
- name: Update npm to 7
# If we do test on npm 10 it needs npm7
if: matrix.node-version <= 10
run: npm i --prefer-online --no-fund --no-audit -g npm@7
- name: Update npm to latest
if: matrix.node-version > 10
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --package-lock
Expand Down
21 changes: 3 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12') || startsWith(matrix.node-version, '14'))
run: |
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
tar xf npm-7.5.4.tgz
cd package
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
cd ..
rmdir /s /q package
- name: Update npm to 7
# If we do test on npm 10 it needs npm7
if: matrix.node-version <= 10
run: npm i --prefer-online --no-fund --no-audit -g npm@7
- name: Update npm to latest
if: matrix.node-version > 10
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i
Expand Down Expand Up @@ -81,7 +66,7 @@ jobs:
node-version: ${{ matrix.node-version }}
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12') || startsWith(matrix.node-version, '14'))
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
run: |
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
tar xf npm-7.5.4.tgz
Expand All @@ -91,10 +76,10 @@ jobs:
rmdir /s /q package
- name: Update npm to 7
# If we do test on npm 10 it needs npm7
if: matrix.node-version <= 10
if: startsWith(matrix.node-version, '10.')
run: npm i --prefer-online --no-fund --no-audit -g npm@7
- name: Update npm to latest
if: matrix.node-version > 10
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/post-dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12') || startsWith(matrix.node-version, '14'))
run: |
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
tar xf npm-7.5.4.tgz
cd package
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
cd ..
rmdir /s /q package
- name: Update npm to 7
# If we do test on npm 10 it needs npm7
if: matrix.node-version <= 10
run: npm i --prefer-online --no-fund --no-audit -g npm@7
- name: Update npm to latest
if: matrix.node-version > 10
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- name: Dependabot metadata
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12') || startsWith(matrix.node-version, '14'))
run: |
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
tar xf npm-7.5.4.tgz
cd package
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
cd ..
rmdir /s /q package
- name: Update npm to 7
# If we do test on npm 10 it needs npm7
if: matrix.node-version <= 10
run: npm i --prefer-online --no-fund --no-audit -g npm@7
- name: Update npm to latest
if: matrix.node-version > 10
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- name: Install deps
Expand Down
2 changes: 1 addition & 1 deletion lib/content/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ jobs:
runs-on: ubuntu-latest
steps:
{{> setupGit}}
{{> setupNode }}
{{> setupNode}}
- run: npm i --package-lock
- run: npm audit
2 changes: 1 addition & 1 deletion lib/content/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ jobs:
shell: $\{{ matrix.platform.shell }}
steps:
{{> setupGit}}
{{> setupNode nodeVersion="${{ matrix.node-version }}"}}
{{> setupNode useMatrix=true}}
- run: npm i
- run: npm test --ignore-scripts {{~#if isWorkspace}} -w {{pkgName}}{{/if}}
2 changes: 1 addition & 1 deletion lib/content/post-dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
github-token: "$\{{ secrets.GITHUB_TOKEN }}"
- name: npm install and commit
if: contains(steps.metadata.outputs.dependency-names, '@npmcli/template-oss')
if: contains(steps.metadata.outputs.dependency-names, '{{__NAME__}}')
env:
GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
12 changes: 8 additions & 4 deletions lib/content/setup-node.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
- uses: actions/setup-node@v3
with:
node-version: {{#if nodeVersion}}{{nodeVersion}}{{else}}{{#each ciVersions}}{{#if @last}}{{.}}{{/if}}{{/each}}{{/if}}
node-version: {{#if useMatrix}}$\{{ matrix.node-version }}{{else}}{{#each ciVersions}}{{#if @last}}{{.}}{{/if}}{{/each}}{{/if}}
{{#if useMatrix}}
- name: Update to workable npm (windows)
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12') || startsWith(matrix.node-version, '14'))
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
run: |
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
tar xf npm-7.5.4.tgz
Expand All @@ -13,9 +14,12 @@
rmdir /s /q package
- name: Update npm to 7
# If we do test on npm 10 it needs npm7
if: matrix.node-version <= 10
if: startsWith(matrix.node-version, '10.')
run: npm i --prefer-online --no-fund --no-audit -g npm@7
- name: Update npm to latest
if: matrix.node-version > 10
if: $\{{ !startsWith(matrix.node-version, '10.') }}
{{else}}
- name: Update npm to latest
{{/if}}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
Loading

0 comments on commit f951c95

Please sign in to comment.