generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 1
140 lines (113 loc) · 3.62 KB
/
ci.yml
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
133
134
135
136
137
138
139
140
name: CI
on:
pull_request:
env:
NODE_ENV: test
API_CLIENT_ID: approved-premises
API_CLIENT_SECRET: clientsecret
jobs:
type_checking:
name: "Type check 🔎"
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version-file: '.node-version'
cache: 'npm'
- name: Installing dependencies
run: npm ci
- name: Pulling the latest type from the API repo
run: npm run generate-types
- name: Typechecking the code
run: npm run typecheck
linting:
name: "Linting 🔎"
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version-file: '.node-version'
cache: 'npm'
- name: Installing dependencies
run: npm ci
- name: Running Lint checks
run: npm run lint
- name: Running shell scripts linting checks
run: npm run shellcheck
unit_test:
name: "Unit testing 🧪"
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/[email protected]
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version-file: '.node-version'
cache: 'npm'
- name: Installing dependencies
run: npm ci
- name: Running Unit tests
run: npm run test:ci
- name: Check coverage
run: |
npx nyc report -t ./coverage --reporter=text --reporter=text-summary
npx nyc check-coverage -t ./coverage
integration_test:
name: "Integration testing 🧪"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ci_node_index: [ 0, 1, 2, 3 ]
steps:
- name: Check out code
uses: actions/[email protected]
- name: Setup Node.js environment
uses: actions/[email protected]
with:
node-version-file: '.node-version'
cache: 'npm'
- name: Installing dependencies
run: npm ci
- name: Building source
run: npm run build
- uses: dawidd6/action-download-artifact@v2
with:
#branch: main
if_no_artifact_found: 'ignore'
allow_forks: false
name: integration-test-junit-xml-reports-.*
name_is_regexp: true
path: tmp/junit-xml-reports-downloaded
continue-on-error: true
- uses: r7kamura/split-tests-by-timings@v0
id: split-tests
with:
reports: tmp/junit-xml-reports-downloaded
glob: integration_tests/tests/**/*.cy.ts
index: ${{ matrix.ci_node_index }}
total: 4
- name: Running Integration tests
run: TEST_RUN_ARGS="--spec $(echo ${{ steps.split-tests.outputs.paths }} | sed -E 's/ /,/g')" npm run test:integration
- name: Store Integration tests reports
uses: actions/upload-artifact@v4
with:
name: integration-test-junit-xml-reports-${{ matrix.ci_node_index }}
path: test_results/cypress
- name: Store Integration tests videos
uses: actions/upload-artifact@v4
with:
name: integration-tests-videos-${{ matrix.ci_node_index }}
path: integration_tests/videos
- name: Store Integration tests screenshots
uses: actions/upload-artifact@v4
with:
name: integration-tests-screenshots-${{ matrix.ci_node_index }}
path: integration_tests/screenshots