Skip to content

Commit c32bf71

Browse files
committed
Merge remote-tracking branch 'origin/main' into feature/CCM-10432-multi-user-cleanup
2 parents 7cd65a3 + 5723f41 commit c32bf71

File tree

285 files changed

+18969
-4185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

285 files changed

+18969
-4185
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: 'Node modules cache + setup'
2+
description: 'Setup Node, restore node_modules cache, and optionally run npm ci on cache miss'
3+
4+
inputs:
5+
node_version:
6+
description: 'Node.js version'
7+
required: true
8+
cache_lock_path:
9+
description: 'Path(s) to package-lock.json for cache key'
10+
required: false
11+
default: '**/package-lock.json'
12+
skip_restore:
13+
description: 'Skips restoring node_modules'
14+
required: false
15+
default: false
16+
17+
runs:
18+
using: 'composite'
19+
steps:
20+
- name: 'Use Node.js'
21+
uses: actions/setup-node@v5
22+
with:
23+
cache: 'npm'
24+
cache-dependency-path: '${{ inputs.cache_lock_path }}'
25+
node-version: '${{ inputs.node_version }}'
26+
package-manager-cache: true
27+
28+
- name: 'Restore node_modules from cache'
29+
id: node-modules-cache
30+
uses: actions/cache@v4
31+
with:
32+
path: |
33+
node_modules
34+
**/node_modules
35+
key: ${{ runner.os }}-node-${{ inputs.node_version }}-${{ hashFiles(inputs.cache_lock_path) }}
36+
restore-keys: |
37+
${{ runner.os }}-node-${{ inputs.node_version }}-
38+
lookup-only: ${{ inputs.skip_restore }}
39+
40+
- name: 'Install dependencies (cache miss)'
41+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
42+
shell: bash
43+
run: |
44+
npm ci

.github/workflows/cicd-1-pull-request.yaml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ concurrency:
1111
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
1212
cancel-in-progress: false
1313

14+
permissions:
15+
id-token: write
16+
contents: write
17+
packages: read
1418

1519
jobs:
1620
metadata:
@@ -77,9 +81,23 @@ jobs:
7781
export DOES_PULL_REQUEST_EXIST="${{ steps.pr_exists.outputs.does_pull_request_exist }}"
7882
export IS_VERSION_PRERELEASE="${{ steps.variables.outputs.is_version_prerelease }}"
7983
make list-variables
84+
85+
dependencies:
86+
name: Install / cache dependencies
87+
needs: [metadata]
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: "Checkout code"
91+
uses: actions/[email protected]
92+
- name: "Install / cache node_modules"
93+
uses: ./.github/actions/node-modules-cache
94+
with:
95+
node_version: "${{ inputs.nodejs_version }}"
96+
skip_restore: true
97+
8098
commit-stage: # Recommended maximum execution time is 2 minutes
8199
name: "Commit stage"
82-
needs: [metadata]
100+
needs: [metadata, dependencies]
83101
uses: ./.github/workflows/stage-1-commit.yaml
84102
with:
85103
build_datetime: "${{ needs.metadata.outputs.build_datetime }}"
@@ -92,7 +110,7 @@ jobs:
92110
secrets: inherit
93111
test-stage: # Recommended maximum execution time is 5 minutes
94112
name: "Test stage"
95-
needs: [metadata, commit-stage]
113+
needs: [metadata, dependencies, commit-stage]
96114
uses: ./.github/workflows/stage-2-test.yaml
97115
with:
98116
build_datetime: "${{ needs.metadata.outputs.build_datetime }}"
@@ -105,7 +123,7 @@ jobs:
105123
secrets: inherit
106124
acceptance-stage: # Recommended maximum execution time is 10 minutes
107125
name: "Acceptance stage"
108-
needs: [metadata, test-stage]
126+
needs: [metadata, dependencies, test-stage]
109127
uses: ./.github/workflows/stage-4-acceptance.yaml
110128
if: needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened')) || (github.event_name == 'push' && github.ref == 'refs/heads/main')
111129
secrets: inherit

.github/workflows/pr_closed.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,29 @@ jobs:
9999
echo "version_changed=true" >> $GITHUB_OUTPUT
100100
fi
101101
102+
test-contract-provider:
103+
name: "Test contracts (provider)"
104+
needs: check-event-schemas-version-change
105+
if: needs.check-event-schemas-version-change.outputs.version_changed == 'true'
106+
runs-on: ubuntu-latest
107+
permissions:
108+
contents: read
109+
packages: read
110+
steps:
111+
- name: "Checkout code"
112+
uses: actions/[email protected]
113+
- name: "Install dependencies"
114+
run: npm ci
115+
- name: "Run provider contract tests"
116+
run: make test-contract-provider
117+
env:
118+
GITHUB_PACKAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119+
102120
publish-event-schemas:
103121
name: Publish event schemas package to GitHub package registry
104-
needs: check-event-schemas-version-change
122+
needs:
123+
- check-event-schemas-version-change
124+
- test-contract-provider
105125
if: needs.check-event-schemas-version-change.outputs.version_changed == 'true'
106126
runs-on: ubuntu-latest
107127
permissions:

.github/workflows/stage-1-commit.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
needs: detect-terraform-changes
7373
if: needs.detect-terraform-changes.outputs.terraform_changed == 'true'
7474
permissions:
75-
contents: write
75+
contents: write
7676
steps:
7777
- name: "Checkout code"
7878
uses: actions/[email protected]
@@ -149,7 +149,7 @@ jobs:
149149
trivy:
150150
name: "Trivy Scan"
151151
runs-on: ubuntu-latest
152-
timeout-minutes: 5
152+
timeout-minutes: 10
153153
needs: detect-terraform-changes
154154
if: needs.detect-terraform-changes.outputs.terraform_changed == 'true'
155155
steps:
@@ -248,8 +248,10 @@ jobs:
248248
- name: "Checkout code"
249249
uses: actions/checkout@v4
250250

251-
- name: Install dependencies
252-
run: npm ci
251+
- name: "Restore node_modules from cache"
252+
uses: ./.github/actions/node-modules-cache
253+
with:
254+
node_version: "${{ inputs.nodejs_version }}"
253255

254256
- name: Re-generate schemas
255257
run: npm --workspace packages/event-schemas run generate-json-schemas

.github/workflows/stage-2-test.yaml

Lines changed: 114 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -41,115 +41,183 @@ permissions:
4141
contents: read # This is required for actions/checkout
4242

4343
jobs:
44+
discover-workspaces:
45+
runs-on: ubuntu-latest
46+
outputs:
47+
matrix: ${{ steps.get-workspaces.outputs.matrix }}
48+
steps:
49+
- name: "Checkout code"
50+
uses: actions/[email protected]
51+
- name: "Get workspaces"
52+
id: "get-workspaces"
53+
run: |
54+
echo "matrix=$(jq -c '.workspaces' package.json)" >> "$GITHUB_OUTPUT"
55+
4456
check-generated-dependencies:
4557
name: "Check generated dependencies"
4658
runs-on: ubuntu-latest
4759
timeout-minutes: 5
4860
steps:
4961
- name: "Checkout code"
5062
uses: actions/[email protected]
51-
- name: "Repo setup"
52-
run: |
53-
npm ci
63+
- name: "Restore node_modules from cache"
64+
uses: ./.github/actions/node-modules-cache
65+
with:
66+
node_version: "${{ inputs.nodejs_version }}"
5467
- name: "Generate dependencies"
5568
run: |
5669
npm run generate-dependencies --workspaces --if-present
5770
git diff --exit-code
71+
5872
test-unit:
5973
name: "Unit tests"
6074
runs-on: ubuntu-latest
6175
timeout-minutes: 5
76+
needs: [discover-workspaces]
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
workspace: ${{ fromJSON(needs.discover-workspaces.outputs.matrix) }}
6281
steps:
6382
- name: "Checkout code"
6483
uses: actions/[email protected]
65-
- name: "Repo setup"
66-
run: |
67-
npm ci
84+
- name: "Restore node_modules from cache"
85+
uses: ./.github/actions/node-modules-cache
86+
with:
87+
node_version: "${{ inputs.nodejs_version }}"
6888
- name: "Generate dependencies"
6989
run: |
7090
npm run generate-dependencies --workspaces --if-present
7191
- name: "Run unit test suite"
7292
run: |
73-
make test-unit
74-
- name: "Save the result of fast test suite"
93+
WORKSPACE=${{ matrix.workspace }} make test-unit
94+
- name: Compute safe artifact names
95+
id: names
96+
shell: bash
97+
run: |
98+
echo "safe=$(echo '${{ matrix.workspace }}' | tr '/' '-_')" >> "$GITHUB_OUTPUT"
99+
- name: "Save the result of test suite"
75100
uses: actions/upload-artifact@v4
76101
with:
77-
name: unit-tests
78-
path: "**/.reports/unit"
102+
name: unit-tests-${{ steps.names.outputs.safe }}
103+
path: "${{ matrix.workspace }}/.reports/unit"
79104
include-hidden-files: true
105+
if-no-files-found: ignore
80106
if: always()
81107
- name: "Save the result of code coverage"
82108
uses: actions/upload-artifact@v4
83109
with:
84-
name: code-coverage-report
85-
path: ".reports/lcov.info"
110+
name: code-coverage-${{ steps.names.outputs.safe }}
111+
path: "${{ matrix.workspace }}/.reports/unit/coverage/lcov.info"
112+
if-no-files-found: ignore
86113
if: always()
114+
87115
test-lint:
88116
name: "Linting"
89117
runs-on: ubuntu-latest
90118
timeout-minutes: 5
91119
steps:
92120
- name: "Checkout code"
93121
uses: actions/[email protected]
94-
- name: "Repo setup"
95-
run: |
96-
npm ci
122+
- name: "Restore node_modules from cache"
123+
uses: ./.github/actions/node-modules-cache
124+
with:
125+
node_version: "${{ inputs.nodejs_version }}"
97126
- name: "Generate dependencies"
98127
run: |
99128
npm run generate-dependencies --workspaces --if-present
100129
- name: "Run linting"
101130
run: |
102131
make test-lint
132+
103133
test-typecheck:
104134
name: "Typecheck"
105135
runs-on: ubuntu-latest
106136
timeout-minutes: 5
107137
steps:
108138
- name: "Checkout code"
109139
uses: actions/[email protected]
110-
- name: "Repo setup"
111-
run: |
112-
npm ci
140+
- name: "Restore node_modules from cache"
141+
uses: ./.github/actions/node-modules-cache
142+
with:
143+
node_version: "${{ inputs.nodejs_version }}"
113144
- name: "Generate dependencies"
114145
run: |
115146
npm run generate-dependencies --workspaces --if-present
116147
- name: "Run typecheck"
117148
run: |
118149
make test-typecheck
119-
test-coverage:
120-
name: "Test coverage"
121-
needs: [test-unit]
122-
runs-on: ubuntu-latest
123-
timeout-minutes: 5
124-
steps:
125-
- name: "Checkout code"
126-
uses: actions/[email protected]
127-
- name: "Run test coverage check"
128-
run: |
129-
make test-coverage
130-
- name: "Save the coverage check result"
131-
run: |
132-
echo "Nothing to save"
133-
perform-static-analysis:
134-
name: "Perform static analysis"
135-
needs: [test-unit]
150+
151+
test-contract-provider:
152+
name: "Test contracts (provider)"
136153
runs-on: ubuntu-latest
137154
permissions:
138-
id-token: write
139155
contents: read
140-
timeout-minutes: 5
156+
packages: read
141157
steps:
142158
- name: "Checkout code"
143159
uses: actions/[email protected]
160+
- name: "Restore node_modules from cache"
161+
uses: ./.github/actions/node-modules-cache
144162
with:
145-
fetch-depth: 0 # Full history is needed to improving relevancy of reporting
146-
- name: "Download coverage report for SONAR"
147-
uses: actions/download-artifact@v5
163+
node_version: "${{ inputs.nodejs_version }}"
164+
- name: "Run provider contract tests"
165+
run: make test-contract-provider
166+
env:
167+
GITHUB_PACKAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}
168+
169+
170+
merge-coverage:
171+
name: "Merge coverage"
172+
runs-on: ubuntu-latest
173+
needs: [test-unit]
174+
steps:
175+
- uses: actions/checkout@v5
176+
177+
- name: Download coverage artifacts
178+
uses: actions/download-artifact@v4
148179
with:
149-
name: code-coverage-report
150-
- name: "Perform static analysis"
151-
uses: ./.github/actions/perform-static-analysis
180+
pattern: code-coverage-*
181+
merge-multiple: false
182+
path: ./_cov_parts
183+
184+
- name: Merge LCOV files
185+
run: |
186+
set -euo pipefail
187+
mkdir -p .reports
188+
npx --yes lcov-result-merger \
189+
"./_cov_parts/**/lcov.info" \
190+
".reports/lcov.info" \
191+
--ignore "node_modules" \
192+
--prepend-source-files \
193+
--prepend-path-fix "../../"
194+
195+
- name: Upload merged LCOV
196+
uses: actions/upload-artifact@v4
152197
with:
153-
sonar_organisation_key: "${{ vars.SONAR_ORGANISATION_KEY }}"
154-
sonar_project_key: "${{ vars.SONAR_PROJECT_KEY }}"
155-
sonar_token: "${{ secrets.SONAR_TOKEN }}"
198+
name: code-coverage-report
199+
path: .reports/lcov.info
200+
201+
# perform-static-analysis:
202+
# name: "Perform static analysis"
203+
# needs: [test-unit, merge-coverage]
204+
# runs-on: ubuntu-latest
205+
# permissions:
206+
# id-token: write
207+
# contents: read
208+
# timeout-minutes: 5
209+
# steps:
210+
# - name: "Checkout code"
211+
# uses: actions/[email protected]
212+
# with:
213+
# fetch-depth: 0 # Full history is needed to improving relevancy of reporting
214+
# - name: "Download coverage report for SONAR"
215+
# uses: actions/download-artifact@v5
216+
# with:
217+
# name: code-coverage-report
218+
# - name: "Perform static analysis"
219+
# uses: ./.github/actions/perform-static-analysis
220+
# with:
221+
# sonar_organisation_key: "${{ vars.SONAR_ORGANISATION_KEY }}"
222+
# sonar_project_key: "${{ vars.SONAR_PROJECT_KEY }}"
223+
# sonar_token: "${{ secrets.SONAR_TOKEN }}"

.gitleaksignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ b19d88d1d92b0530f065feefcf25d8cdd82a876a:tests/test-team/auth/user.json:jwt:15
77
b19d88d1d92b0530f065feefcf25d8cdd82a876a:tests/test-team/auth/user.json:jwt:25
88
bc79df4f82052918ae6bf69d36279e5dd391d61e:tests/test-team/auth/user.json:jwt:15
99
bc79df4f82052918ae6bf69d36279e5dd391d61e:tests/test-team/auth/user.json:jwt:25
10+
306d9ec55d3498b86d5506da9a90ac486fc66563:frontend/src/components/molecules/MessagePlanFallbackConditions/MessagePlanFallbackConditions.tsx:ipv4:92

0 commit comments

Comments
 (0)