Skip to content

Commit

Permalink
MAN-227 - use local integration test work flow file to see why test i…
Browse files Browse the repository at this point in the history
…n failing in ci
  • Loading branch information
achimber-moj committed Dec 19, 2024
1 parent 9596b17 commit c68890e
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 2 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/node_integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
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: Get wiremock
shell: bash
run: |
curl -o wiremock.jar https://repo1.maven.org/maven2/org/wiremock/wiremock-standalone/3.9.1/wiremock-standalone-3.9.1.jar
- name: Prepare and run integration tests
id: integration-tests
shell: bash
run: |
nohup java -jar wiremock.jar --port 9091 &
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')
4 changes: 2 additions & 2 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:
# main node build workflow
node_build:
name: node build
uses: ./.github/workflows/node_build.yml # WORKFLOW_VERSION
uses: ./.github/workflows/node_build.yml@v2 # WORKFLOW_VERSION
secrets: inherit
# generic node unit tests - feel free to override with local tests if required
node_unit_tests:
name: node unit tests
uses: ministryofjustice/hmpps-github-actions/.github/workflows/node_unit_tests.yml@v2 # WORKFLOW_VERSION
uses: ./.github/workflows/node_unit_tests.yml@v2 # WORKFLOW_VERSION
needs: [node_build]
secrets: inherit
# generic node integration tests using wiremock - feel free to override with local tests if required
Expand Down

0 comments on commit c68890e

Please sign in to comment.