-
Notifications
You must be signed in to change notification settings - Fork 4
177 lines (155 loc) · 6.5 KB
/
sonarcloud.yml
File metadata and controls
177 lines (155 loc) · 6.5 KB
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
name: SonarCloud
on:
push:
branches:
- master
pull_request:
types: [labeled, opened, synchronize, reopened, unlabeled]
env:
SHARED_PATH: ${{ github.workspace }}/lambdas/shared
LAMBDA_PATH: ${{ github.workspace }}/lambdas
jobs:
sonarcloud:
name: SonarCloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Install poetry
run: pip install poetry==2.1.4
- uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'poetry'
- name: Set up AWS credentials
env:
AWS_ACCESS_KEY_ID: "FOOBARKEY"
AWS_SECRET_ACCESS_KEY: "FOOBARSECRET"
run: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
- name: Run unittest with filenameprocessor-coverage
working-directory: filenameprocessor
id: filenameprocessor
continue-on-error: true
run: |
poetry install
poetry run coverage run -m unittest discover || echo "filenameprocessor tests failed" >> ../failed_tests.txt
poetry run coverage xml -o ../filenameprocessor-coverage.xml
- name: Run unittest with recordprocessor-coverage
working-directory: recordprocessor
id: recordprocessor
continue-on-error: true
run: |
poetry install
poetry run coverage run -m unittest discover || echo "recordprocessor tests failed" >> ../failed_tests.txt
poetry run coverage xml -o ../recordprocessor-coverage.xml
# This step is redundant - all of these tests will be run in the backend step below
- name: Run unittest with recordforwarder-coverage
working-directory: backend
id: recordforwarder
env:
PYTHONPATH: ${{ github.workspace }}/backend/src:${{ github.workspace }}/backend/tests
continue-on-error: true
run: |
poetry install
poetry run coverage run -m unittest discover -s "./tests" -p "*batch*.py" || echo "recordforwarder tests failed" >> ../failed_tests.txt
poetry run coverage xml -o ../recordforwarder-coverage.xml
- name: Run unittest with coverage-ack-lambda
working-directory: ack_backend
id: acklambda
env:
PYTHONPATH: ${{ github.workspace }}/ack_backend/src:${{ github.workspace }}/ack_backend/tests
continue-on-error: true
run: |
poetry install
poetry run coverage run -m unittest discover || echo "ack-lambda tests failed" >> ../failed_tests.txt
poetry run coverage xml -o ../ack-lambda-coverage.xml
- name: Run unittest with coverage-delta
working-directory: delta_backend
id: delta
env:
PYTHONPATH: delta_backend/src:delta_backend/tests
continue-on-error: true
run: |
poetry install
poetry run coverage run -m unittest discover || echo "delta tests failed" >> ../failed_tests.txt
poetry run coverage xml -o ../delta-coverage.xml
- name: Run unittest with coverage-fhir-api
working-directory: backend
env:
PYTHONPATH: ${{ github.workspace }}/backend/src:${{ github.workspace }}/backend/tests
id: fhirapi
continue-on-error: true
run: |
poetry install
poetry run coverage run -m unittest discover || echo "fhir-api tests failed" >> ../failed_tests.txt
poetry run coverage xml -o ../backend-coverage.xml
- name: Run unittest with coverage-mesh-processor
working-directory: mesh_processor
id: meshprocessor
continue-on-error: true
run: |
poetry install
poetry run coverage run -m unittest discover || echo "mesh_processor tests failed" >> ../failed_tests.txt
poetry run coverage xml -o ../mesh_processor-coverage.xml
- name: Run unittest with coverage-mns-subscription
working-directory: mns_subscription
env:
PYTHONPATH: ${{ github.workspace }}/mns_subscription/src:${{ github.workspace }}/mns_subscription/tests
id: mns_subscription
continue-on-error: true
run: |
poetry install
poetry run coverage run -m unittest discover || echo "mns_subscription tests failed" >> ../failed_tests.txt
poetry run coverage report -m
poetry run coverage xml -o ../mns_subscription-coverage.xml
- name: Run unittest with redis_sync
working-directory: redis_sync
id: redis_sync
env:
PYTHONPATH: ${{ github.workspace }}/redis_sync/src:${{ github.workspace }}/redis_sync/tests
continue-on-error: true
run: |
poetry install
poetry run coverage run -m unittest discover || echo "redis_sync tests failed" >> ../failed_tests.txt
poetry run coverage xml -o ../redis_sync-coverage.xml
- name: Run unittest with shared
working-directory: lambdas/shared
id: shared
env:
PYTHONPATH: ${{ env.SHARED_PATH }}/src
continue-on-error: true
run: |
poetry install
poetry run coverage run --rcfile=.coveragerc --source=src -m unittest discover -s tests -p "test_*.py" -v || echo "shared tests failed" >> ../../failed_tests.txt
poetry run coverage xml -o ../../shared-coverage.xml
- name: Run unittest with id_sync
working-directory: lambdas/id_sync
id: id_sync
env:
PYTHONPATH: ${{ env.LAMBDA_PATH }}/id_sync/src:${{ env.SHARED_PATH }}/src
continue-on-error: true
run: |
poetry install
poetry run coverage run --rcfile=.coveragerc --source=src -m unittest discover || echo "id_sync tests failed" >> ../../failed_tests.txt
poetry run coverage xml -o ../../id_sync-coverage.xml
- name: Run Test Failure Summary
id: check_failure
run: |
if [ -s failed_tests.txt ]; then
echo "The following tests failed:"
cat failed_tests.txt
while IFS= read -r line; do
echo "##[error]Test Failures: $line"
done < failed_tests.txt
exit 1
else
echo "All tests passed."
fi
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}