-
Notifications
You must be signed in to change notification settings - Fork 1
181 lines (149 loc) · 5.01 KB
/
code-quality.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: "Check code format and quality"
on:
push:
branches: [main]
pull_request:
types: [opened, ready_for_review, synchronize, reopened]
permissions:
checks: write
contents: read
pull-requests: write
statuses: write
jobs:
check-code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check text files format
run: |
build/automation/etc/githooks/scripts/editorconfig-pre-commit.sh
- name: Markdown Format Check
run: |
build/automation/etc/githooks/scripts/markdown-pre-commit.sh
- name: GitHub Actions - Check best practices
run: |
make github-actions-best-practices
- name: Kubernetes - Check best practices
run: |
make kubernetes-best-practices
- name: Docker - Check best practices
run: |
make docker-best-practices
python-check-code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
- name: Ruff Check
uses: jpetrucciani/ruff-check@main
with:
path: "."
- name: Python Dead Code Check
run: |
make python-dead-code-install python-dead-code-check
typescript-check-code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
cache-dependency-path: application/ui
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Test Setup
run: make typescript-unit-test-ci-setup
- name: Typescript Check Package
run: |
make typescript-package-duplicate-check
- name: Typescript Code Format and Quality
run: |
make typescript-check-format typescript-check-lint
terraform-check-code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check Terraform files format
run: |
build/automation/etc/githooks/scripts/terraform-format-pre-commit.sh
- name: Checkov Terraform Best Practices
run: |
make terraform-best-practices
- name: TFSec Terraform Security Scanning
run: |
make terraform-security
sonarcloud-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
cache-dependency-path: application/ui
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Test Setup
run: make typescript-unit-test-ci-setup
- name: Run Typescript Unit Tests
run: make typescript-unit-test
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: |
application/requirements-dev.txt
application/*/requirements.txt
- name: Cache Python dependencies
uses: actions/cache@v3
id: cache-python-dependencies
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Python Install Requirements
run: make pip-install
- name: Run Python Unit Tests
run: make python-unit-test
- uses: sonarsource/sonarcloud-github-action@master
# SEE: https://github.com/SonarSource/sonarcloud-github-action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: .
args: >
-Dsonar.sources=application,deployment,infrastructure,build/docker,scripts
-Dsonar.organization=nhsd-exeter
-Dsonar.projectKey=uec-dos-ct
-Dsonar.coverage.exclusions=**/__test__/**,deployment,infrastructure,scripts/**.py,application/ui/src/index.tsx,application/ui/jest.config.js,application/ui/craco.config.js,application/ui/src/reportWebVitals.ts,application/ui/src/setupTests.ts,application/conftest.py,application/*/tests/**.py
-Dsonar.javascript.lcov.reportPaths=application/ui/coverage/lcov.info
-Dsonar.python.coverage.reportPaths=coverage.xml
-Dsonar.python.version=3.10
-Dsonar.terraform.provider.aws.version=4.66.0
-Dsonar.tests=test