Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/actions/build-proxies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ inputs:
description: "Name of the Component to deploy"
required: true
default: 'api'
nodejs_version:
description: "Node.js version, set by the CI/CD pipeline workflow"
required: true

runs:
using: composite
Expand All @@ -34,7 +37,16 @@ runs:
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
node-version: ${{ inputs.nodejs_version }}

- name: "Cache node_modules"
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ inputs.nodejs_version }}-

- name: Npm install
working-directory: .
Expand Down Expand Up @@ -103,6 +115,7 @@ runs:
shell: bash
run: |
.github/scripts/dispatch_internal_repo_workflow.sh \
--internalRef "feature/CCM-12748-supplier-api-mi-proxy-fix" \
Comment thread
m-houston marked this conversation as resolved.
Outdated
--infraRepoName "nhs-notify-supplier-api" \
--releaseVersion "${{ inputs.releaseVersion }}" \
--targetComponent "${{ inputs.targetComponent }}" \
Expand Down
84 changes: 84 additions & 0 deletions .github/workflows/pr_closed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,87 @@ jobs:
--targetAccountGroup "nhs-notify-supplier-api-dev" \
--targetComponent "${{ matrix.component }}" \
--terraformAction "apply"

check-event-schemas-version-change:
name: Check for event schemas package version change
needs: check-merge-or-workflow-dispatch
if: needs.check-merge-or-workflow-dispatch.outputs.deploy == 'true'
outputs:
version_changed: ${{ steps.check-version.outputs.version_changed }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Checkout code
uses: actions/checkout@v5.0.0

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: '20.18.2'
registry-url: 'https://npm.pkg.github.com'

- name: check if local version differs from latest published version
id: check-version
run: |
published_version=$(npm view @nhsdigital/nhs-notify-event-schemas-supplier-api --json 2>/dev/null | jq -r '.["dist-tags"].latest // "null"')
echo "Published version: $published_version"

local_version=$(jq -r '.version' internal/events/package.json)
echo "Local version: $local_version"

if [[ $local_version = $published_version ]]; then
echo "Local version is the same as the latest published version - skipping publish"
echo "version_changed=false" >> $GITHUB_OUTPUT
else
echo "Local version is different to the latest published version - publishing new version"
echo "version_changed=true" >> $GITHUB_OUTPUT
fi

test-contract-provider:
name: "Test contracts (provider)"
needs: check-event-schemas-version-change
if: needs.check-event-schemas-version-change.outputs.version_changed == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: "Checkout code"
uses: actions/checkout@v5.0.0
- name: "Install dependencies"
run: npm ci
- name: "Run provider contract tests"
run: make test-contract-provider
Comment thread
masl2 marked this conversation as resolved.
env:
GITHUB_PACKAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}

publish-event-schemas:
name: Publish event schemas package to GitHub package registry
needs:
- check-event-schemas-version-change
- test-contract-provider
if: needs.check-event-schemas-version-change.outputs.version_changed == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v5.0.0

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: '20.18.2'
registry-url: 'https://npm.pkg.github.com'

- name: Install dependencies
run: npm ci

- name: Publish to GitHub Packages
run: npm publish --workspace internal/events
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 2 additions & 3 deletions .github/workflows/stage-1-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ jobs:
echo "changed=true" >> $GITHUB_OUTPUT
fi

if content=$(git show origin/main:internal/events/schemas/package.json 2>/dev/null); then
if content=$(git show origin/main:internal/events/package.json 2>/dev/null); then
version=$(jq -r .version <<< $content);
else
version=null;
Expand All @@ -248,7 +248,6 @@ jobs:
- name: "Checkout code"
uses: actions/checkout@v4

# Simplified caching - template management has more complex caching of installed modules from another build step
- name: "Cache node_modules"
uses: actions/cache@v4
with:
Expand All @@ -260,7 +259,7 @@ jobs:

- name: "Re-generate schemas"
run: |
npm ci --workspace internal/events
npm ci
npm --workspace internal/events run gen:jsonschema

- name: Check for schema changes
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/stage-2-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: "Cache node_modules"
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
- name: "Repo setup"
run: |
npm ci
Expand All @@ -62,6 +70,14 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: "Cache node_modules"
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
- name: "Repo setup"
run: |
npm ci
Expand Down Expand Up @@ -90,6 +106,14 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: "Cache node_modules"
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
- name: "Repo setup"
run: |
npm ci
Expand All @@ -106,6 +130,14 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: "Cache node_modules"
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
- name: "Repo setup"
run: |
npm ci
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/stage-3-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,4 @@ jobs:
runId: "${{ github.run_id }}"
buildSandbox: true
releaseVersion: ${{ github.head_ref || github.ref_name }}
nodejs_version: ${{ inputs.nodejs_version }}
138 changes: 81 additions & 57 deletions .github/workflows/stage-4-acceptance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,43 @@ jobs:
- name: "Deploy application"
run: |
echo "Deploying application..."
test-contract:
name: "Contract test"
# test-contract:
# name: "Contract test"
# runs-on: ubuntu-latest
# needs: environment-set-up
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v5
# - name: "Run contract test"
# run: |
# make test-contract
# - name: "Save result"
# run: |
# echo "Nothing to save"

test-contract-provider:
name: "Test contracts (provider)"
runs-on: ubuntu-latest
needs: environment-set-up
timeout-minutes: 10
permissions:
contents: read
packages: read
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: "Run contract test"
run: |
make test-contract
- name: "Save result"
run: |
echo "Nothing to save"
uses: actions/checkout@v5.0.0
- name: "Cache node_modules"
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ runner.os }}-node-${{ inputs.nodejs_version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ inputs.nodejs_version }}-
- name: "Run provider contract tests"
run: make test-contract-provider
env:
GITHUB_PACKAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test-security:
name: "Security test"
runs-on: ubuntu-latest
Expand All @@ -80,34 +103,34 @@ jobs:
- name: "Save result"
run: |
echo "Nothing to save"
test-ui:
name: "UI test"
runs-on: ubuntu-latest
needs: environment-set-up
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: "Run UI test"
run: |
make test-ui
- name: "Save result"
run: |
echo "Nothing to save"
test-ui-performance:
name: "UI performance test"
runs-on: ubuntu-latest
needs: environment-set-up
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: "Run UI performance test"
run: |
make test-ui-performance
- name: "Save result"
run: |
echo "Nothing to save"
# test-ui:
# name: "UI test"
# runs-on: ubuntu-latest
# needs: environment-set-up
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v5
# - name: "Run UI test"
# run: |
# make test-ui
# - name: "Save result"
# run: |
# echo "Nothing to save"
# test-ui-performance:
# name: "UI performance test"
# runs-on: ubuntu-latest
# needs: environment-set-up
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v5
# - name: "Run UI performance test"
# run: |
# make test-ui-performance
# - name: "Save result"
# run: |
# echo "Nothing to save"
test-integration:
name: "Integration test"
runs-on: ubuntu-latest
Expand All @@ -122,20 +145,20 @@ jobs:
- name: "Save result"
run: |
echo "Nothing to save"
test-accessibility:
name: "Accessibility test"
runs-on: ubuntu-latest
needs: environment-set-up
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: "Run accessibility test"
run: |
make test-accessibility
- name: "Save result"
run: |
echo "Nothing to save"
# test-accessibility:
# name: "Accessibility test"
# runs-on: ubuntu-latest
# needs: environment-set-up
# timeout-minutes: 10
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v5
# - name: "Run accessibility test"
# run: |
# make test-accessibility
# - name: "Save result"
# run: |
# echo "Nothing to save"
test-load:
name: "Load test"
runs-on: ubuntu-latest
Expand All @@ -155,13 +178,14 @@ jobs:
runs-on: ubuntu-latest
needs:
[
test-accessibility,
test-contract,
# test-accessibility,
# test-contract,
test-contract-provider,
test-integration,
test-load,
test-security,
test-ui-performance,
test-ui,
# test-ui-performance,
# test-ui,
]
if: always()
timeout-minutes: 5
Expand Down
Loading
Loading