1- name : ' Test stage'
1+ name : " Test stage"
22
33on :
44 workflow_call :
55 inputs :
66 build_datetime :
7- description : ' Build datetime, set by the CI/CD pipeline workflow'
7+ description : " Build datetime, set by the CI/CD pipeline workflow"
88 required : true
99 type : string
1010 build_timestamp :
11- description : ' Build timestamp, set by the CI/CD pipeline workflow'
11+ description : " Build timestamp, set by the CI/CD pipeline workflow"
1212 required : true
1313 type : string
1414 build_epoch :
15- description : ' Build epoch, set by the CI/CD pipeline workflow'
15+ description : " Build epoch, set by the CI/CD pipeline workflow"
1616 required : true
1717 type : string
1818 nodejs_version :
19- description : ' Node.js version, set by the CI/CD pipeline workflow'
19+ description : " Node.js version, set by the CI/CD pipeline workflow"
2020 required : true
2121 type : string
2222 python_version :
23- description : ' Python version, set by the CI/CD pipeline workflow'
23+ description : " Python version, set by the CI/CD pipeline workflow"
2424 required : true
2525 type : string
2626 terraform_version :
27- description : ' Terraform version, set by the CI/CD pipeline workflow'
27+ description : " Terraform version, set by the CI/CD pipeline workflow"
2828 required : true
2929 type : string
3030 version :
31- description : ' Version of the software, set by the CI/CD pipeline workflow'
31+ description : " Version of the software, set by the CI/CD pipeline workflow"
3232 required : true
3333 type : string
3434
@@ -38,197 +38,203 @@ env:
3838
3939permissions :
4040 id-token : write # This is required for requesting the JWT
41- contents : read # This is required for actions/checkout
41+ contents : read # This is required for actions/checkout
4242
4343jobs :
44- setup -dependencies :
45- name : ' Setup dependencies'
44+ install -dependencies :
45+ name : " Install dependencies"
4646 runs-on : ubuntu-latest
47- timeout-minutes : 10
48- outputs :
49- cache-hit : ${{ steps.cache-nodemodules.outputs.cache-hit }}
47+ timeout-minutes : 5
5048 steps :
51- - name : ' Checkout code'
49+ - name : " Checkout code"
525053-
54- - name : ' Setup Node.js'
51+ - name : " Use Node.js"
5552 uses : actions/setup-node@v4
5653 with :
57- node-version : ${{ inputs.nodejs_version }}
58- cache : ' npm'
59-
60- - name : ' Cache node_modules'
61- id : cache-nodemodules
54+ node-version : " ${{ inputs.nodejs_version }}"
55+ cache : " npm"
56+ cache-dependency-path : " **/package-lock.json "
57+ - name : " Restore node_modules from cache "
58+ id : cache-node-modules
6259 uses : actions/cache@v4
6360 with :
64- path : node_modules
65- key : ${{ runner.os }}-node-modules-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}-${{ github.sha }}
61+ path : |
62+ node_modules
63+ **/node_modules
64+ key : ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
65+ restore-keys : |
66+ ${{ runner.os }}-node-${{ inputs.nodejs_version }}-
67+ - name : " Install dependencies (cache miss)"
68+ if : steps.cache-node-modules.outputs.cache-hit != 'true'
69+ run : |
70+ npm ci
6671
67- - name : ' Install dependencies'
68- if : steps.cache-nodemodules.outputs.cache-hit != 'true'
69- run : npm ci
7072 check-generated-dependencies :
71- name : ' Check generated dependencies'
72- needs : [setup-dependencies]
73+ name : " Check generated dependencies"
7374 runs-on : ubuntu-latest
7475 timeout-minutes : 5
76+ needs : [install-dependencies]
7577 steps :
76- - name : ' Checkout code'
78+ - name : " Checkout code"
777978-
79- - name : ' Setup Node.js'
80+ - name : " Use Node.js"
8081 uses : actions/setup-node@v4
8182 with :
82- node-version : ${{ inputs.nodejs_version }}
83-
84- - name : ' Restore dependencies'
85- uses : actions/cache/restore@v4
83+ node-version : " ${{ inputs.nodejs_version }}"
84+ cache : " npm"
85+ cache-dependency-path : " **/package-lock.json"
86+ - name : " Restore node_modules from cache"
87+ uses : actions/cache@v4
8688 with :
8789 path : |
8890 node_modules
89- key : ${{ runner.os }}-node-modules-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}-${{ github.sha }}
90- fail-on-cache-miss : true
91-
92- - name : ' Generate dependencies'
91+ **/node_modules
92+ key : ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
93+ restore-keys : |
94+ ${{ runner.os }}-node-${{ inputs.nodejs_version }}-
95+ - name : " Generate dependencies"
9396 run : |
9497 npm run generate-dependencies --workspaces --if-present
9598 git diff --exit-code
99+
96100 test-unit :
97- name : ' Unit tests'
98- needs : [setup-dependencies]
101+ name : " Unit tests"
99102 runs-on : ubuntu-latest
100103 timeout-minutes : 5
104+ needs : [install-dependencies]
101105 steps :
102- - name : ' Checkout code'
106+ - name : " Checkout code"
103107104-
105- - name : ' Setup Node.js'
108+ - name : " Use Node.js"
106109 uses : actions/setup-node@v4
107110 with :
108- node-version : ${{ inputs.nodejs_version }}
109-
110- - name : ' Restore dependencies'
111- uses : actions/cache/restore@v4
111+ node-version : " ${{ inputs.nodejs_version }}"
112+ cache : " npm"
113+ cache-dependency-path : " **/package-lock.json"
114+ - name : " Restore node_modules from cache"
115+ uses : actions/cache@v4
112116 with :
113117 path : |
114118 node_modules
115- key : ${{ runner.os }}-node-modules-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}-${{ github.sha }}
116- fail-on-cache-miss : true
117-
118- - name : ' Generate dependencies'
119+ **/node_modules
120+ key : ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
121+ restore-keys : |
122+ ${{ runner.os }}-node-${{ inputs.nodejs_version }}-
123+ - name : " Generate dependencies"
119124 run : |
120125 npm run generate-dependencies --workspaces --if-present
121-
122- - name : ' Run unit test suite'
126+ - name : " Run unit test suite"
123127 run : |
124128 make test-unit
125-
126- - name : ' Save the result of fast test suite'
129+ - name : " Save the result of fast test suite"
127130 uses : actions/upload-artifact@v4
128131 with :
129132 name : unit-tests
130- path : ' **/.reports/unit'
133+ path : " **/.reports/unit"
131134 include-hidden-files : true
132135 if : always()
133-
134- - name : ' Save the result of code coverage'
136+ - name : " Save the result of code coverage"
135137 uses : actions/upload-artifact@v4
136138 with :
137139 name : code-coverage-report
138- path : ' .reports/lcov.info'
140+ path : " .reports/lcov.info"
139141 if : always()
142+
140143 test-lint :
141- name : ' Linting'
142- needs : [setup-dependencies]
144+ name : " Linting"
143145 runs-on : ubuntu-latest
144146 timeout-minutes : 5
147+ needs : [install-dependencies]
145148 steps :
146- - name : ' Checkout code'
149+ - name : " Checkout code"
147150148-
149- - name : ' Setup Node.js'
151+ - name : " Use Node.js"
150152 uses : actions/setup-node@v4
151153 with :
152- node-version : ${{ inputs.nodejs_version }}
153-
154- - name : ' Restore dependencies'
155- uses : actions/cache/restore@v4
154+ node-version : " ${{ inputs.nodejs_version }}"
155+ cache : " npm"
156+ cache-dependency-path : " **/package-lock.json"
157+ - name : " Restore node_modules from cache"
158+ uses : actions/cache@v4
156159 with :
157160 path : |
158161 node_modules
159- key : ${{ runner.os }}-node-modules-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}-${{ github.sha }}
160- fail-on-cache-miss : true
161-
162- - name : ' Generate dependencies'
162+ **/node_modules
163+ key : ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
164+ restore-keys : |
165+ ${{ runner.os }}-node-${{ inputs.nodejs_version }}-
166+ - name : " Generate dependencies"
163167 run : |
164168 npm run generate-dependencies --workspaces --if-present
165-
166- - name : ' Run linting'
169+ - name : " Run linting"
167170 run : |
168171 make test-lint
172+
169173 test-typecheck :
170- name : ' Typecheck'
171- needs : [setup-dependencies]
174+ name : " Typecheck"
172175 runs-on : ubuntu-latest
173176 timeout-minutes : 5
177+ needs : [install-dependencies]
174178 steps :
175- - name : ' Checkout code'
179+ - name : " Checkout code"
176180177-
178- - name : ' Setup Node.js'
181+ - name : " Use Node.js"
179182 uses : actions/setup-node@v4
180183 with :
181- node-version : ${{ inputs.nodejs_version }}
182-
183- - name : ' Restore dependencies'
184- uses : actions/cache/restore@v4
184+ node-version : " ${{ inputs.nodejs_version }}"
185+ cache : " npm"
186+ cache-dependency-path : " **/package-lock.json"
187+ - name : " Restore node_modules from cache"
188+ uses : actions/cache@v4
185189 with :
186190 path : |
187191 node_modules
188- key : ${{ runner.os }}-node-modules-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}-${{ github.sha }}
189- fail-on-cache-miss : true
190-
191- - name : ' Generate dependencies'
192+ **/node_modules
193+ key : ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
194+ restore-keys : |
195+ ${{ runner.os }}-node-${{ inputs.nodejs_version }}-
196+ - name : " Generate dependencies"
192197 run : |
193198 npm run generate-dependencies --workspaces --if-present
194- - name : ' Run typecheck'
199+ - name : " Run typecheck"
195200 run : |
196201 make test-typecheck
197- test-coverage :
198- name : ' Test coverage'
199202
203+ test-coverage :
204+ name : " Test coverage"
200205 needs : [test-unit]
201206 runs-on : ubuntu-latest
202207 timeout-minutes : 5
203208 steps :
204- - name : ' Checkout code'
209+ - name : " Checkout code"
205210206- - name : ' Run test coverage check'
211+ - name : " Run test coverage check"
207212 run : |
208213 make test-coverage
209- - name : ' Save the coverage check result'
214+ - name : " Save the coverage check result"
210215 run : |
211216 echo "Nothing to save"
217+
212218 perform-static-analysis :
213- name : ' Perform static analysis'
219+ name : " Perform static analysis"
214220 needs : [test-unit]
215221 runs-on : ubuntu-latest
216222 permissions :
217223 id-token : write
218224 contents : read
219225 timeout-minutes : 5
220226 steps :
221- - name : ' Checkout code'
227+ - name : " Checkout code"
222228223229 with :
224230 fetch-depth : 0 # Full history is needed to improving relevancy of reporting
225- - name : ' Download coverage report for SONAR'
231+ - name : " Download coverage report for SONAR"
226232 uses : actions/download-artifact@v5
227233 with :
228234 name : code-coverage-report
229- - name : ' Perform static analysis'
235+ - name : " Perform static analysis"
230236 uses : ./.github/actions/perform-static-analysis
231237 with :
232- sonar_organisation_key : ' ${{ vars.SONAR_ORGANISATION_KEY }}'
233- sonar_project_key : ' ${{ vars.SONAR_PROJECT_KEY }}'
234- sonar_token : ' ${{ secrets.SONAR_TOKEN }}'
238+ sonar_organisation_key : " ${{ vars.SONAR_ORGANISATION_KEY }}"
239+ sonar_project_key : " ${{ vars.SONAR_PROJECT_KEY }}"
240+ sonar_token : " ${{ secrets.SONAR_TOKEN }}"
0 commit comments