Skip to content

Commit 00bbefa

Browse files
committed
[NRL-1922] Add new workflow for PR checks
1 parent 84b9af9 commit 00bbefa

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed

.github/workflows/pr-checks.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Run PR checks
2+
run-name: "Running checks for PR #${{ github.event.pull_request.number }} (${{ github.event.pull_request.title }})"
3+
4+
on:
5+
pull_request:
6+
types: [opened, reopened, synchronize]
7+
8+
concurrency:
9+
cancel-in-progress: false
10+
11+
permissions:
12+
id-token: write
13+
contents: read
14+
actions: write
15+
pull-requests: write
16+
17+
jobs:
18+
build:
19+
name: Build and test
20+
runs-on: codebuild-nhsd-nrlf-ci-build-project-${{ github.run_id }}-${{ github.run_attempt }}
21+
22+
steps:
23+
- name: Git clone - ${{ github.ref }}
24+
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.ref }}
27+
28+
- name: Setup environment
29+
run: |
30+
echo "${HOME}/.asdf/bin" >> $GITHUB_PATH
31+
poetry install --no-root
32+
33+
- name: Build
34+
run: make build
35+
36+
- name: Test
37+
run: make test
38+
39+
- name: Upload build artifacts
40+
uses: actions/upload-artifact@v3
41+
with:
42+
name: build-artifacts
43+
path: dist
44+
45+
sonar:
46+
name: SonarQube analysis and quality gate check
47+
runs-on: ubuntu-latest
48+
after: build
49+
steps:
50+
- uses: actions/checkout@v4
51+
with:
52+
ref: ${{ github.ref }}
53+
54+
- name: Get build artifacts
55+
uses: actions/download-artifact@v3
56+
with:
57+
name: build-artifacts
58+
path: dist
59+
60+
# Triggering SonarQube analysis as results of it are required by Quality Gate check.
61+
- name: SonarQube Scan
62+
uses: sonarsource/sonarqube-scan-action@master
63+
env:
64+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
65+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
66+
67+
# Check the Quality Gate status.
68+
- name: SonarQube Quality Gate check
69+
id: sonarqube-quality-gate-check
70+
uses: sonarsource/sonarqube-quality-gate-action@master
71+
with:
72+
pollingTimeoutSec: 600
73+
env:
74+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
75+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} #OPTIONAL

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sonar.exclusions=scripts/**
88
sonar.coverage.exclusions=scripts/**, test/**, **/tests/**
99
sonar.cpd.exclusions=tests/**, **/tests/**
1010

11-
sonar.python.coverage.reportPaths=coverage.xml
11+
sonar.python.coverage.reportPaths=dist/test-coverage.xml
1212

1313
# Exclude snomed urls as being unsafe
1414
sonar.issue.ignore.multicriteria=exclude_snomed_urls

0 commit comments

Comments
 (0)