|
3 | 3 | name: CI
|
4 | 4 |
|
5 | 5 | on:
|
| 6 | + workflow_dispatch: |
6 | 7 | pull_request:
|
| 8 | + branches: |
| 9 | + - '*' |
7 | 10 | push:
|
8 | 11 | branches:
|
9 | 12 | - main
|
10 | 13 | - latest
|
11 | 14 | schedule:
|
12 |
| - # "At 02:00 on Monday" https://crontab.guru/#0_1_*_*_1 |
| 15 | + # "At 02:00 on Monday" https://crontab.guru/#0_2_*_*_1 |
13 | 16 | - cron: "0 2 * * 1"
|
14 | 17 |
|
15 | 18 | jobs:
|
16 | 19 | lint:
|
17 | 20 | runs-on: ubuntu-latest
|
18 | 21 | steps:
|
19 |
| - - uses: actions/checkout@v2 |
20 |
| - - uses: actions/setup-node@v2 |
| 22 | + - uses: actions/checkout@v3 |
| 23 | + - name: Setup git user |
| 24 | + run: | |
| 25 | + git config --global user.email "ops+npm-cli@npmjs.com" |
| 26 | + git config --global user.name "npm cli ops bot" |
| 27 | + - uses: actions/setup-node@v3 |
21 | 28 | with:
|
22 |
| - node-version: '16' |
23 |
| - - run: npm i --prefer-online -g npm@latest |
24 |
| - - run: npm i |
| 29 | + node-version: 16.x |
| 30 | + - name: Update npm to latest |
| 31 | + run: npm i --prefer-online --no-fund --no-audit -g npm@latest |
| 32 | + - run: npm -v |
| 33 | + - run: npm i --ignore-scripts |
25 | 34 | - run: npm run lint
|
26 | 35 |
|
27 | 36 | test:
|
28 | 37 | strategy:
|
29 | 38 | fail-fast: false
|
30 | 39 | matrix:
|
31 |
| - node-version: [12.13.0, 12.x, 14.15.0, 14.x, 16.13.0, 16.x] |
| 40 | + node-version: |
| 41 | + - 12.13.0 |
| 42 | + - 12.x |
| 43 | + - 14.15.0 |
| 44 | + - 14.x |
| 45 | + - 16.0.0 |
| 46 | + - 16.x |
32 | 47 | platform:
|
33 |
| - - os: ubuntu-latest |
34 |
| - shell: bash |
35 |
| - - os: macos-latest |
36 |
| - shell: bash |
| 48 | + - os: ubuntu-latest |
| 49 | + shell: bash |
| 50 | + - os: macos-latest |
| 51 | + shell: bash |
37 | 52 | runs-on: ${{ matrix.platform.os }}
|
38 | 53 | defaults:
|
39 | 54 | run:
|
40 | 55 | shell: ${{ matrix.platform.shell }}
|
41 | 56 | steps:
|
42 |
| - - uses: actions/checkout@v2 |
43 |
| - - uses: actions/setup-node@v2 |
| 57 | + - uses: actions/checkout@v3 |
| 58 | + - name: Setup git user |
| 59 | + run: | |
| 60 | + git config --global user.email "ops+npm-cli@npmjs.com" |
| 61 | + git config --global user.name "npm cli ops bot" |
| 62 | + - uses: actions/setup-node@v3 |
44 | 63 | with:
|
45 | 64 | node-version: ${{ matrix.node-version }}
|
46 |
| - - run: npm i --prefer-online -g npm@latest |
47 |
| - - run: npm i |
| 65 | + - name: Update to workable npm (windows) |
| 66 | + # node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows |
| 67 | + if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.')) |
| 68 | + run: | |
| 69 | + curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz |
| 70 | + tar xf npm-7.5.4.tgz |
| 71 | + cd package |
| 72 | + node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz |
| 73 | + cd .. |
| 74 | + rmdir /s /q package |
| 75 | + - name: Update npm to 7 |
| 76 | + # If we do test on npm 10 it needs npm7 |
| 77 | + if: startsWith(matrix.node-version, '10.') |
| 78 | + run: npm i --prefer-online --no-fund --no-audit -g npm@7 |
| 79 | + - name: Update npm to latest |
| 80 | + if: ${{ !startsWith(matrix.node-version, '10.') }} |
| 81 | + run: npm i --prefer-online --no-fund --no-audit -g npm@latest |
| 82 | + - run: npm -v |
| 83 | + - run: npm i --ignore-scripts |
48 | 84 | - run: npm test --ignore-scripts
|
0 commit comments