File tree Expand file tree Collapse file tree 3 files changed +36
-4
lines changed
infrastructure/terraform/components/api Expand file tree Collapse file tree 3 files changed +36
-4
lines changed Original file line number Diff line number Diff line change 5252 - uses : actions/setup-node@v4
5353 with :
5454 node-version : 22
55- registry-url : ' https://npm.pkg.github.com'
5655 - name : " Cache node_modules"
5756 uses : actions/cache@v4
5857 with :
@@ -112,6 +111,38 @@ jobs:
112111 with :
113112 name : code-coverage-report
114113 path : " .reports/lcov.info"
114+ test-pact :
115+ name : " Pact tests"
116+ runs-on : ubuntu-latest
117+ timeout-minutes : 5
118+ steps :
119+ - name : " Checkout code"
120+ uses : actions/checkout@v5
121+ - uses : actions/setup-node@v4
122+ with :
123+ node-version : 22
124+ - name : " Cache node_modules"
125+ uses : actions/cache@v4
126+ with :
127+ path : |
128+ **/node_modules
129+ key : ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
130+ restore-keys : |
131+ ${{ runner.os }}-node-${{ inputs.nodejs_version }}-
132+ - name : " Repo setup"
133+ env :
134+ NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
135+ run : |
136+ npm ci
137+ - name : " Generate dependencies"
138+ run : |
139+ npm run generate-dependencies --workspaces --if-present
140+ - name : " Run PACT tests"
141+ run : |
142+ npm run test:pact --workspace tests
143+ - name : Publish Pact Contracts
144+ run : |
145+ ./scripts/publish-pact-contracts.sh
115146 test-lint :
116147 name : " Linting"
117148 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 11# # This script is run before the Terraform apply command.
22# # It ensures all Node.js dependencies are installed, generates any required dependencies,
33# # and builds all Lambda functions in the workspace before Terraform provisions infrastructure.
4+ echo " Running pre.sh"
45
56npm ci
67
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- set -euo pipefail
4-
53published_version=$( npm view @nhsdigital/notify-supplier-api-consumer-contracts --json 2> /dev/null | jq -r ' .["dist-tags"].latest' )
64
5+ set -euo pipefail
6+
77# Fail if there are uncommitted changes as this indicates unexpected changes to the contracts
88git diff --quiet tests/pact-tests
99
@@ -22,4 +22,4 @@ if [[ $local_version == $published_version ]]; then
2222fi
2323
2424echo " Local version is different to the latest published version - publishing new version"
25- npm publish ./pact-contracts
25+ npm pack ./pact-contracts
You can’t perform that action at this time.
0 commit comments