-
Notifications
You must be signed in to change notification settings - Fork 2
132 lines (110 loc) · 3.17 KB
/
Copy pathtest.yml
File metadata and controls
132 lines (110 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
actions: write
checks: write
pull-requests: write
jobs:
lint-test:
name: Lint Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Cache node modules
uses: actions/cache@v5
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci
- name: Run lint tests
run: npm run test:lint
mocha-test:
name: Mocha Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Cache node modules
uses: actions/cache@v5
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci
- name: Run tests
run: npx mocha --reporter json --reporter-option output=reports/test-results.json
- name: Upload test report
uses: actions/upload-artifact@v7
with:
name: test-results
path: 'reports/test-results.json'
- uses: dorny/test-reporter@v3
if: always()
with:
artifact: test-results
name: Mocha Tests
path: 'test-results.json'
reporter: mocha-json
comment-pr:
name: Comment on PR
needs: mocha-test
if: ${{ (success() || failure()) && github.event.pull_request.head.repo.full_name == github.repository}}
runs-on: ubuntu-latest
steps:
- name: Comment on PR
uses: marocchino/sticky-pull-request-comment@v3.0.4
with:
GITHUB_TOKEN: ${{ github.token }}
header: test-results
message: |
**Test Results:** [Open Results!](https://github.com/hasadna/open-bus-backend/actions/runs/${{ github.run_id }}#user-content-r0)
coverage-test:
name: Test Whit Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Cache node modules
uses: actions/cache@v5
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install dependencies
run: npm ci
- name: Run Coverage Tests
run: npm run test:coverage
- name: Upload coverage report
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: coverage/
- name: Upload to Coveralls
if: always()
uses: coverallsapp/github-action@v2
with:
path-to-lcov: ./coverage/lcov.info