Skip to content

Commit 03b9868

Browse files
CCM-13342: Build changes
1 parent 93bd7c5 commit 03b9868

15 files changed

Lines changed: 411 additions & 38 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"containerEnv": {
33
"GITHUBMONITOR": "false",
44
"MAKECONFIG": "true",
5-
"SHOWWELCOME": "true",
5+
"SHOWWELCOME": "false",
66
"UPDATEFROMTEMPLATE": "false"
77
},
8-
"image": "ghcr.io/nhsdigital/nhs-notify-devcontainer-loaded-codespaces:main",
9-
"name": "Codespaces Online Development"
8+
"image": "ghcr.io/nhsdigital/nhs-notify-devcontainer-loaded-codespaces:1.0.19",
9+
"name": "Codespaces"
1010
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"containerEnv": {
3+
"GITHUBMONITOR": "false",
4+
"MAKECONFIG": "true",
5+
"SHOWWELCOME": "false",
6+
"UPDATEFROMTEMPLATE": "false"
7+
},
8+
"image": "ghcr.io/nhsdigital/nhs-notify-devcontainer-loaded:1.0.19",
9+
"name": "Local Development",
10+
"postStartCommand": "mkdir -p ~/.gnupg && echo '## 1-day timeout' > ~/.gnupg/gpg-agent.conf && echo 'default-cache-ttl 86400' >> ~/.gnupg/gpg-agent.conf && echo 'max-cache-ttl 86400' >> ~/.gnupg/gpg-agent.conf && gpg-connect-agent reloadagent /bye 2>/dev/null || true"
11+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
3+
"name": "Ubuntu 24"
4+
}

.github/actions/build-docs/action.yml

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,21 @@ runs:
99
steps:
1010
- name: Checkout
1111
uses: actions/checkout@v5
12-
- uses: actions/setup-node@v6
13-
with:
14-
node-version: 24
15-
- name: Npm cli install
16-
working-directory: ./docs
17-
run: npm ci
18-
shell: bash
19-
- name: Setup Ruby
20-
uses: ruby/setup-ruby@v1.267.0
21-
with:
22-
ruby-version: "3.4.7" # Not needed with a .ruby-version file
23-
bundler-cache: false # runs 'bundle install' and caches installed gems automatically
24-
#cache-version: 0 # Increment this number if you need to re-download cached gems
25-
working-directory: "./docs"
12+
13+
- name: "Setup dependencies and asdf with cache"
14+
uses: ./.github/actions/setup-dependencies-asdf-with-cache
2615
- name: Setup Pages
2716
id: pages
2817
uses: actions/configure-pages@v5
2918
- name: Build with Jekyll
3019
working-directory: ./docs
3120
# Outputs to the './_site' directory by default
3221
shell: bash
33-
run: make build-ci BASE_URL=${{ steps.pages.outputs.base_path }} VERSION=${{ inputs.version }}
34-
#run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
22+
run: make build BASE_URL="${BASE_URL}" VERSION="${VERSION}"
3523
env:
3624
JEKYLL_ENV: production
25+
BASE_URL: ${{ steps.pages.outputs.base_path }}
26+
VERSION: ${{ inputs.version }}
3727
- name: Upload artifact
3828
# Automatically uploads an artifact from the './_site' directory by default
3929
uses: actions/upload-pages-artifact@v3

.github/actions/create-lines-of-code-report/action.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ runs:
2424
steps:
2525
- name: "Create CLOC report"
2626
shell: bash
27+
env:
28+
BUILD_DATETIME: ${{ inputs.build_datetime }}
2729
run: |
28-
export BUILD_DATETIME=${{ inputs.build_datetime }}
2930
./scripts/reports/create-lines-of-code-report.sh
3031
- name: "Compress CLOC report"
3132
shell: bash
@@ -51,7 +52,10 @@ runs:
5152
- name: "Send the CLOC report to the central location"
5253
shell: bash
5354
if: steps.check.outputs.secrets_exist == 'true'
55+
env:
56+
BUCKET_ENDPOINT: ${{ inputs.idp_aws_report_upload_bucket_endpoint }}
57+
BUILD_TIMESTAMP: ${{ inputs.build_timestamp }}
5458
run: |
5559
aws s3 cp \
5660
./lines-of-code-report.json.zip \
57-
${{ inputs.idp_aws_report_upload_bucket_endpoint }}/${{ inputs.build_timestamp }}-lines-of-code-report.json.zip
61+
"$BUCKET_ENDPOINT/$BUILD_TIMESTAMP-lines-of-code-report.json.zip"

.github/actions/scan-dependencies/action.yaml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ runs:
2424
steps:
2525
- name: "Generate SBOM"
2626
shell: bash
27+
env:
28+
BUILD_DATETIME: ${{ inputs.build_datetime }}
2729
run: |
28-
export BUILD_DATETIME=${{ inputs.build_datetime }}
2930
./scripts/reports/create-sbom-report.sh
3031
- name: "Compress SBOM report"
3132
shell: bash
@@ -39,8 +40,9 @@ runs:
3940
retention-days: 21
4041
- name: "Scan vulnerabilities"
4142
shell: bash
43+
env:
44+
BUILD_DATETIME: ${{ inputs.build_datetime }}
4245
run: |
43-
export BUILD_DATETIME=${{ inputs.build_datetime }}
4446
./scripts/reports/scan-vulnerabilities.sh
4547
- name: "Compress vulnerabilities report"
4648
shell: bash
@@ -65,10 +67,13 @@ runs:
6567
- name: "Send the SBOM and vulnerabilities reports to the central location"
6668
shell: bash
6769
if: steps.check.outputs.secrets_exist == 'true'
70+
env:
71+
BUCKET_ENDPOINT: ${{ inputs.idp_aws_report_upload_bucket_endpoint }}
72+
BUILD_TIMESTAMP: ${{ inputs.build_timestamp }}
6873
run: |
6974
aws s3 cp \
7075
./sbom-repository-report.json.zip \
71-
${{ inputs.idp_aws_report_upload_bucket_endpoint }}/${{ inputs.build_timestamp }}-sbom-repository-report.json.zip
76+
"$BUCKET_ENDPOINT/$BUILD_TIMESTAMP-sbom-repository-report.json.zip"
7277
aws s3 cp \
7378
./vulnerabilities-repository-report.json.zip \
74-
${{ inputs.idp_aws_report_upload_bucket_endpoint }}/${{ inputs.build_timestamp }}-vulnerabilities-repository-report.json.zip
79+
"$BUCKET_ENDPOINT/$BUILD_TIMESTAMP-vulnerabilities-repository-report.json.zip"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: 'Setup depenasdf with cache'
2+
description: 'Restores asdf cache, installs dependencies, and saves cache'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: "Restore asdf cache"
7+
id: cache-asdf
8+
uses: actions/cache/restore@v4
9+
with:
10+
path: |
11+
~/.asdf
12+
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }}
13+
restore-keys: |
14+
${{ runner.os }}-asdf-
15+
16+
- name: "Check cache status"
17+
shell: bash
18+
run: |
19+
if [ "${{ steps.cache-asdf.outputs.cache-hit }}" == "true" ]; then
20+
echo "✅ Cache hit! asdf and tools restored from cache. 🚀🚀🚀"
21+
else
22+
echo "❌ Cache miss. asdf and tools will be installed from scratch. 🔨🔨🔨"
23+
fi
24+
25+
- name: "Install dependencies"
26+
shell: bash -l {0}
27+
run: |
28+
make dependencies
29+
30+
- name: "Save asdf cache"
31+
id: save-asdf-cache
32+
if: steps.cache-asdf.outputs.cache-hit != 'true'
33+
uses: actions/cache/save@v4
34+
with:
35+
path: |
36+
~/.asdf
37+
key: ${{ steps.cache-asdf.outputs.cache-primary-key }}
38+
39+
- name: "Check cache save status"
40+
shell: bash
41+
run: |
42+
if [ "${{ steps.cache-asdf.outputs.cache-hit }}" == "true" ]; then
43+
echo "ℹ️ Cache was restored from previous run - no save needed"
44+
elif [ "${{ steps.save-asdf-cache.outcome }}" == "success" ]; then
45+
echo "✅ Cache saved successfully for future runs! 💾"
46+
else
47+
echo "⚠️ Cache save was skipped or failed"
48+
fi

.github/workflows/scheduled-repository-template-sync.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
3333
- name: Create Pull Request
3434
if: ${{ !env.ACT }}
35-
uses: peter-evans/create-pull-request@v7.0.8
35+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
3636
with:
3737
token: ${{ secrets.GITHUB_TOKEN }}
3838
commit-message: Drift from template

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ jobs:
156156
- name: "Checkout code"
157157
uses: actions/checkout@v5
158158
- name: "Setup ASDF"
159-
uses: asdf-vm/actions/setup@v4
159+
uses: asdf-vm/actions/setup@b7bcd026f18772e44fe1026d729e1611cc435d47 # v
160160
- name: "Perform Setup"
161161
uses: ./.github/actions/setup
162162
- name: "Trivy Scan"

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,21 @@ jobs:
4848
check-generated-dependencies:
4949
name: "Check generated dependencies"
5050
runs-on: ubuntu-latest
51-
timeout-minutes: 5
51+
timeout-minutes: 10
5252
steps:
5353
- name: "Checkout code"
5454
uses: actions/checkout@v5
55-
- name: "Repo setup"
56-
run: |
57-
npm ci
55+
- name: "Setup dependencies and asdf with cache"
56+
uses: ./.github/actions/setup-dependencies-asdf-with-cache
57+
5858
- name: "Generate dependencies"
5959
run: |
6060
npm run generate-dependencies --workspaces --if-present
6161
git diff --exit-code
6262
test-unit:
6363
name: "Unit tests"
6464
runs-on: ubuntu-latest
65-
timeout-minutes: 5
65+
timeout-minutes: 20
6666
steps:
6767
- name: "Checkout code"
6868
uses: actions/checkout@v5

0 commit comments

Comments
 (0)