Skip to content

Commit 92783fa

Browse files
authored
Merge pull request #166 from nextcloud/feat/run-tests-with-jest-for-code-coverage
2 parents fab6dd3 + b88f6c4 commit 92783fa

8 files changed

Lines changed: 5680 additions & 998 deletions

File tree

.github/workflows/node-test.yml

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

33
on:
44
pull_request:
@@ -8,32 +8,52 @@ on:
88
- master
99
- stable*
1010

11+
permissions:
12+
contents: read
13+
14+
concurrency:
15+
group: node-tests-${{ github.head_ref || github.run_id }}
16+
cancel-in-progress: true
17+
1118
jobs:
1219
test:
1320
runs-on: ubuntu-latest
14-
permissions:
15-
checks: write
16-
pull-requests: write
17-
strategy:
18-
matrix:
19-
node-version: [ 20 ]
20-
21-
name: test
21+
2222
steps:
2323
- name: Checkout
24-
uses: actions/checkout@v3
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'
2532

26-
- name: Set up node ${{ matrix.node-version }}
27-
uses: actions/setup-node@v3
33+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
34+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
2835
with:
29-
node-version: ${{ matrix.node-version }}
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 }}"
3040

31-
- name: Install dependencies
32-
run: npm ci
41+
- name: Install dependencies & build
42+
run: |
43+
npm ci
44+
npm run build --if-present
3345
3446
- name: Test
3547
run: npm run test --if-present
3648

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
56+
3757
summary:
3858
runs-on: ubuntu-latest
3959
needs: test

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
/dist
22
/src/fonts
33

4-
.DS_Store
4+
# development
55
node_modules/
6+
coverage/
7+
8+
.DS_Store
69
npm-debug.log*
710
yarn-debug.log*
811
yarn-error.log*

0 commit comments

Comments
 (0)