Skip to content

Commit 27243cf

Browse files
committed
[NRL-1922] Add sonarqube scan to daily build. Trigger it on every push to develop
1 parent 709e704 commit 27243cf

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

.github/workflows/daily-build.yml

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ permissions:
66
actions: write
77

88
on:
9+
push:
10+
branches:
11+
- develop
912
schedule:
1013
- cron: "0 1 * * *"
1114
workflow_dispatch:
@@ -18,7 +21,7 @@ on:
1821

1922
jobs:
2023
build:
21-
name: Build - ${{ github.ref }}
24+
name: Build and test - ${{ github.ref }}
2225
runs-on: codebuild-nhsd-nrlf-ci-build-project-${{ github.run_id }}-${{ github.run_attempt }}
2326

2427
steps:
@@ -35,12 +38,12 @@ jobs:
3538
- name: Run Linting
3639
run: make lint
3740

38-
- name: Run Unit Tests
39-
run: make test
40-
4141
- name: Build Project
4242
run: make build
4343

44+
- name: Run Unit Tests
45+
run: make test
46+
4447
- name: Configure Management Credentials
4548
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a #v4.3.1
4649
with:
@@ -60,10 +63,43 @@ jobs:
6063
name: build-artifacts
6164
path: |
6265
dist/*.zip
66+
dist/test-coverage.xml
6367
!dist/nrlf_permissions.zip
6468
6569
- name: Save NRLF Permissions cache
6670
uses: actions/cache/save@v4
6771
with:
6872
key: ${{ github.run_id }}-nrlf-permissions
6973
path: dist/nrlf_permissions.zip
74+
75+
sonar:
76+
name: SonarQube scan
77+
runs-on: ubuntu-latest
78+
needs: build
79+
environment: pull-request
80+
permissions:
81+
contents: read
82+
actions: write
83+
steps:
84+
- uses: actions/checkout@v4
85+
with:
86+
ref: ${{ github.ref }}
87+
88+
- name: Get build artifacts
89+
uses: actions/download-artifact@v4
90+
with:
91+
name: build-artifacts
92+
path: dist
93+
94+
- name: SonarQube scan
95+
uses: sonarsource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 #v7.0.0
96+
env:
97+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
98+
99+
- name: SonarQube quality gate check
100+
id: sonarqube-quality-gate-check
101+
uses: sonarsource/sonarqube-quality-gate-action@cf038b0e0cdecfa9e56c198bbb7d21d751d62c3b #v1.2.0
102+
with:
103+
pollingTimeoutSec: 600
104+
env:
105+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)