generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (66 loc) · 1.89 KB
/
node_integration_tests.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
name: Integration tests
on:
workflow_call:
inputs:
node_version_file:
description: "Passed to setup-node action to specify where to source the version of node from"
required: false
type: string
default: ".nvmrc"
permissions:
contents: read
jobs:
integration_test:
name: Run the integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ inputs.node_version_file }}
uses: actions/setup-node@v4
with:
node-version-file: ${{ inputs.node_version_file }}
- name: download artifacts
uses: actions/download-artifact@v4
with:
name: npm_build_artifacts
- name: restore cache
id: restore-cache
uses: actions/cache/restore@v4
env:
cache-name: node-modules
with:
path: |
./node_modules
~/.cache/Cypress
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: download the artifacts
uses: actions/download-artifact@v4
with:
name: npm_build_artifacts
path: |
build/
dist/
assets/stylesheets/
- name: Prepare and run integration tests
id: integration-tests
shell: bash
run: |
nohup npm run start-feature &
sleep 5
npm run int-test
# continue-on-error: true
# replacing the above with if: always()
- name: upload results
if: always()
uses: actions/upload-artifact@v4
with:
name: npm_integration_test_artifacts
path: |
integration-tests/videos/
integration_tests/screenshots/
- name: fail the action if the tests failed
if: ${{ steps.integration-tests.outcome == 'failure' }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('Integration tests failed')