Skip to content

Commit 1468fe8

Browse files
authored
Merge pull request #2929 from nextcloud/artonge/fix/test
2 parents 00d88ca + 8f3b6e0 commit 1468fe8

4 files changed

Lines changed: 839 additions & 30 deletions

File tree

.github/workflows/node-test.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
4+
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+
#
6+
# SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
8+
9+
name: Node tests
10+
11+
on:
12+
pull_request:
13+
push:
14+
branches:
15+
- main
16+
- master
17+
- stable*
18+
19+
permissions:
20+
contents: read
21+
22+
concurrency:
23+
group: node-tests-${{ github.head_ref || github.run_id }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
changes:
28+
runs-on: ubuntu-latest-low
29+
permissions:
30+
contents: read
31+
pull-requests: read
32+
33+
outputs:
34+
src: ${{ steps.changes.outputs.src}}
35+
36+
steps:
37+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
38+
id: changes
39+
continue-on-error: true
40+
with:
41+
filters: |
42+
src:
43+
- '.github/workflows/**'
44+
- '__tests__/**'
45+
- '__mocks__/**'
46+
- 'src/**'
47+
- 'appinfo/info.xml'
48+
- 'package.json'
49+
- 'package-lock.json'
50+
- 'tsconfig.json'
51+
- '**.js'
52+
- '**.ts'
53+
- '**.vue'
54+
55+
test:
56+
runs-on: ubuntu-latest
57+
58+
needs: changes
59+
if: needs.changes.outputs.src != 'false'
60+
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
64+
with:
65+
persist-credentials: false
66+
67+
- name: Read package.json node and npm engines version
68+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
69+
id: versions
70+
with:
71+
fallbackNode: '^20'
72+
fallbackNpm: '^10'
73+
74+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
75+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
76+
with:
77+
node-version: ${{ steps.versions.outputs.nodeVersion }}
78+
79+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
80+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
81+
82+
- name: Install dependencies & build
83+
env:
84+
CYPRESS_INSTALL_BINARY: 0
85+
run: |
86+
npm ci
87+
npm run build --if-present
88+
89+
- name: Test
90+
run: npm run test --if-present
91+
92+
- name: Test and process coverage
93+
run: npm run test:coverage --if-present
94+
95+
- name: Collect coverage
96+
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
97+
with:
98+
files: ./coverage/lcov.info
99+
100+
summary:
101+
permissions:
102+
contents: none
103+
runs-on: ubuntu-latest-low
104+
needs: [changes, test]
105+
106+
if: always()
107+
108+
name: test-summary
109+
110+
steps:
111+
- name: Summary status
112+
run: if ${{ needs.changes.outputs.src != 'false' && needs.test.result != 'success' }}; then exit 1; fi

0 commit comments

Comments
 (0)