Skip to content

Commit f0e9195

Browse files
authored
Merge pull request #629 from nextcloud/feat/node-test-ci
fix: Use organization workflow for node test ci
2 parents 04aee49 + fa2225c commit f0e9195

1 file changed

Lines changed: 45 additions & 16 deletions

File tree

.github/workflows/node-test.yml

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,64 @@
1-
name: Node
1+
name: Node tests
22

33
on:
44
pull_request:
55
push:
66
branches:
7-
- 'master'
7+
- main
8+
- master
9+
- stable*
10+
11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: node-tests-${{ github.head_ref || github.run_id }}
16+
cancel-in-progress: true
817

918
jobs:
1019
test:
1120
runs-on: ubuntu-latest
12-
strategy:
13-
matrix:
14-
node: [ 16, 18 ]
15-
name: Test Node v${{ matrix.node }}
21+
1622
steps:
17-
- uses: actions/checkout@v3
18-
- uses: actions/setup-node@v3
23+
- name: Checkout
24+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
25+
26+
- name: Read package.json node and npm engines version
27+
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
28+
id: versions
29+
with:
30+
fallbackNode: '^20'
31+
fallbackNpm: '^9'
32+
33+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
34+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
1935
with:
20-
node-version: ${{ matrix.node }}
21-
cache: 'npm'
22-
- name: install dependencies
23-
run: npm ci
24-
- name: build package
25-
run: npm run build
26-
- name: run tests
27-
run: npm run test
36+
node-version: ${{ steps.versions.outputs.nodeVersion }}
37+
38+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
39+
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
40+
41+
- name: Install dependencies & build
42+
run: |
43+
npm ci
44+
npm run build --if-present
45+
46+
- name: Test
47+
run: npm run test --if-present
48+
49+
- name: Test and process coverage
50+
run: npm run test:coverage --if-present
51+
52+
- name: Collect coverage
53+
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
54+
with:
55+
files: ./coverage/lcov.info
2856

2957
summary:
3058
runs-on: ubuntu-latest
3159
needs: test
3260
if: always()
61+
3362
name: test-summary
3463
steps:
3564
- name: Summary status

0 commit comments

Comments
 (0)