Skip to content

Commit 2b879e8

Browse files
customise integration tests
1 parent 63928a4 commit 2b879e8

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Integration tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
node_version_file:
7+
description: "Passed to setup-node action to specify where to source the version of node from"
8+
required: false
9+
type: string
10+
default: ".nvmrc"
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
integration_test:
17+
name: Run the integration tests
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Use Node.js ${{ inputs.node_version_file }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version-file: ${{ inputs.node_version_file }}
25+
- name: download artifacts
26+
uses: actions/download-artifact@v4
27+
with:
28+
name: npm_build_artifacts
29+
- name: restore cache
30+
id: restore-cache
31+
uses: actions/cache/restore@v4
32+
env:
33+
cache-name: node-modules
34+
with:
35+
path: |
36+
./node_modules
37+
~/.cache/Cypress
38+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
39+
- name: download the artifacts
40+
uses: actions/download-artifact@v4
41+
with:
42+
name: npm_build_artifacts
43+
path: |
44+
build/
45+
dist/
46+
assets/stylesheets/
47+
- name: Prepare and run integration tests
48+
id: integration-tests
49+
shell: bash
50+
run: |
51+
nohup npm run start-feature &
52+
sleep 5
53+
npm run int-test
54+
# continue-on-error: true
55+
# replacing the above with if: always()
56+
- name: upload results
57+
if: always()
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: npm_integration_test_artifacts
61+
path: |
62+
integration_tests/videos/
63+
integration_tests/screenshots/
64+
coverage/
65+
test_results/
66+
ctrf/
67+
- name: fail the action if the tests failed
68+
if: ${{ steps.integration-tests.outcome == 'failure' }}
69+
uses: actions/github-script@v7
70+
with:
71+
script: |
72+
core.setFailed('Integration tests failed')

.github/workflows/pipeline.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
secrets: inherit
3434
node_integration_tests:
3535
name: node integration tests
36-
uses: ministryofjustice/hmpps-github-actions/.github/workflows/node_integration_tests.yml@v2 # WORKFLOW_VERSION
36+
uses: ./.github/workflows/node_integration_tests.yml@v2 # WORKFLOW_VERSION
3737
needs: [node_build]
3838
secrets: inherit
3939
helm_lint:

0 commit comments

Comments
 (0)