|
1 | 1 | name: legacy
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| -- pull_request |
5 |
| -- push |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - develop |
| 8 | + - '4.x' |
| 9 | + - '5.x' |
| 10 | + - '5.0' |
| 11 | + paths-ignore: |
| 12 | + - '*.md' |
| 13 | + pull_request: |
| 14 | + paths-ignore: |
| 15 | + - '*.md' |
| 16 | + |
| 17 | +# Cancel in progress workflows |
| 18 | +# in the scenario where we already had a run going for that PR/branch/tag but then triggered a new run |
| 19 | +concurrency: |
| 20 | + group: "${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}" |
| 21 | + cancel-in-progress: true |
6 | 22 |
|
7 | 23 | jobs:
|
8 | 24 | test:
|
9 |
| - runs-on: ubuntu-latest |
10 | 25 | strategy:
|
11 | 26 | fail-fast: false
|
12 | 27 | matrix:
|
13 |
| - name: |
14 |
| - - Node.js 11.x |
15 |
| - - Node.js 12.x |
16 |
| - - Node.js 13.x |
17 |
| - - Node.js 14.x |
18 |
| - - Node.js 15.x |
19 |
| - - Node.js 16.x |
20 |
| - - Node.js 17.x |
21 |
| - |
22 |
| - include: |
23 |
| - - name: Node.js 11.x |
24 |
| - node-version: "11.15" |
25 |
| - |
26 |
| - |
27 |
| - - name: Node.js 12.x |
28 |
| - node-version: "12.22" |
29 |
| - |
30 |
| - |
31 |
| - - name: Node.js 13.x |
32 |
| - node-version: "13.14" |
33 |
| - |
| 28 | + os: [ubuntu-latest, windows-latest] |
| 29 | + node-version: [16, 17] |
| 30 | + # Node.js release schedule: https://nodejs.org/en/about/releases/ |
34 | 31 |
|
35 |
| - - name: Node.js 14.x |
36 |
| - node-version: "14.20" |
37 |
| - |
38 |
| - - name: Node.js 15.x |
39 |
| - node-version: "15.14" |
40 |
| - |
41 |
| - - name: Node.js 16.x |
42 |
| - node-version: "16.20" |
43 |
| - |
44 |
| - - name: Node.js 17.x |
45 |
| - node-version: "17.9" |
| 32 | + name: Node.js ${{ matrix.node-version }} |
46 | 33 |
|
| 34 | + runs-on: ${{ matrix.os }} |
47 | 35 | steps:
|
48 |
| - - uses: actions/checkout@v4 |
49 |
| - |
50 |
| - - name: Install Node.js ${{ matrix.node-version }} |
51 |
| - shell: bash -eo pipefail -l {0} |
52 |
| - run: | |
53 |
| - nvm install --default ${{ matrix.node-version }} |
54 |
| - dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH" |
55 |
| -
|
56 |
| - - name: Configure npm |
57 |
| - run: | |
58 |
| - npm config set loglevel error |
59 |
| - if [[ "$(npm config get package-lock)" == "true" ]]; then |
60 |
| - npm config set package-lock false |
61 |
| - else |
62 |
| - npm config set shrinkwrap false |
63 |
| - fi |
64 |
| -
|
65 |
| - - name: Install npm module(s) ${{ matrix.npm-i }} |
66 |
| - run: npm install --save-dev ${{ matrix.npm-i }} |
67 |
| - if: matrix.npm-i != '' |
68 |
| - |
69 |
| - - name: Remove non-test dependencies |
70 |
| - run: npm rm --silent --save-dev connect-redis |
71 |
| - |
72 |
| - - name: Setup Node.js version-specific dependencies |
73 |
| - shell: bash |
74 |
| - run: | |
75 |
| - # eslint for linting |
76 |
| - # - remove on Node.js < 12 |
77 |
| - if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; then |
78 |
| - node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \ |
79 |
| - grep -E '^eslint(-|$)' | \ |
80 |
| - sort -r | \ |
81 |
| - xargs -n1 npm rm --silent --save-dev |
82 |
| - fi |
83 |
| -
|
84 |
| - - name: Install Node.js dependencies |
85 |
| - run: npm install |
86 |
| - |
87 |
| - - name: List environment |
88 |
| - id: list_env |
89 |
| - shell: bash |
90 |
| - run: | |
91 |
| - echo "node@$(node -v)" |
92 |
| - echo "npm@$(npm -v)" |
93 |
| - npm -s ls ||: |
94 |
| - (npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT" |
95 |
| -
|
96 |
| - - name: Run tests |
97 |
| - shell: bash |
98 |
| - run: | |
99 |
| - npm run test-ci |
100 |
| - cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov" |
101 |
| -
|
102 |
| - - name: Lint code |
103 |
| - if: steps.list_env.outputs.eslint != '' |
104 |
| - run: npm run lint |
105 |
| - |
106 |
| - - name: Collect code coverage |
107 |
| - run: | |
108 |
| - mv ./coverage "./${{ matrix.name }}" |
109 |
| - mkdir ./coverage |
110 |
| - mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}" |
111 |
| -
|
112 |
| - - name: Upload code coverage |
113 |
| - uses: actions/upload-artifact@v3 |
114 |
| - with: |
115 |
| - name: coverage |
116 |
| - path: ./coverage |
117 |
| - retention-days: 1 |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + persist-credentials: false |
| 39 | + |
| 40 | + - name: Setup Node.js ${{ matrix.node-version }} |
| 41 | + uses: actions/setup-node@v4 |
| 42 | + with: |
| 43 | + node-version: ${{ matrix.node-version }} |
| 44 | + |
| 45 | + - name: Configure npm loglevel |
| 46 | + run: | |
| 47 | + npm config set loglevel error |
| 48 | + shell: bash |
| 49 | + |
| 50 | + - name: Install dependencies |
| 51 | + run: npm install |
| 52 | + |
| 53 | + - name: Output Node and NPM versions |
| 54 | + run: | |
| 55 | + echo "Node.js version: $(node -v)" |
| 56 | + echo "NPM version: $(npm -v)" |
| 57 | +
|
| 58 | + - name: Run tests |
| 59 | + shell: bash |
| 60 | + run: | |
| 61 | + npm run test-ci |
| 62 | + cp coverage/lcov.info "coverage/${{ matrix.node-version }}.lcov" |
| 63 | +
|
| 64 | + - name: Collect code coverage |
| 65 | + run: | |
| 66 | + mv ./coverage "./${{ matrix.node-version }}" |
| 67 | + mkdir ./coverage |
| 68 | + mv "./${{ matrix.node-version }}" "./coverage/${{ matrix.node-version }}" |
| 69 | +
|
| 70 | + - name: Upload code coverage |
| 71 | + uses: actions/upload-artifact@v3 |
| 72 | + with: |
| 73 | + name: coverage |
| 74 | + path: ./coverage |
| 75 | + retention-days: 1 |
118 | 76 |
|
119 | 77 | coverage:
|
120 | 78 | needs: test
|
|
0 commit comments