Skip to content

Commit f7d56c1

Browse files
committed
matrix
1 parent f930643 commit f7d56c1

2 files changed

Lines changed: 200 additions & 40 deletions

File tree

.github/workflows/sonarcloud.yml

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,26 @@ jobs:
1414
sonarcloud:
1515
name: SonarCloud
1616
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
include:
20+
- project: filenameprocessor
21+
python-version: 3.10
22+
- project: recordprocessor
23+
python-version: 3.10
24+
- project: backend
25+
python-version: 3.11
26+
test-name: recordforwarder
27+
coverage-file: recordforwarder-coverage.xml
28+
- project: ack_backend
29+
python-version: 3.10
30+
test-name: ack-lambda
31+
coverage-file: ack-lambda.xml
32+
- project: delta_backend
33+
python-version: 3.11
34+
test-name: delta_backend
35+
coverage-file: delta.xml
36+
# Add more projects as needed
1737

1838
steps:
1939
- uses: actions/checkout@v4
@@ -25,11 +45,10 @@ jobs:
2545

2646
- uses: actions/setup-python@v5
2747
with:
28-
python-version: |
29-
3.10
30-
3.11
48+
python-version: ${{ matrix.python-version }}
3149
cache: 'poetry'
3250

51+
3352
- name: Set up AWS credentials
3453
env:
3554
AWS_ACCESS_KEY_ID: "FOOBARKEY"
@@ -44,46 +63,14 @@ jobs:
4463
4564
- name: Set Poetry to use in-project venvs
4665
run: poetry config virtualenvs.in-project true
47-
48-
- name: Cache Poetry virtualenv (filenameprocessor)
49-
uses: actions/cache@v4
50-
with:
51-
path: ./filenameprocessor/.venv
52-
key: ${{ runner.os }}-venv-fp-py3.10-${{ hashFiles('filenameprocessor/poetry.lock') }}
53-
restore-keys: |
54-
${{ runner.os }}-venv-fp-py3.10-
55-
56-
- name: Cache Poetry virtualenv (recordprocessor)
57-
uses: actions/cache@v4
58-
with:
59-
path: ./recordprocessor/.venv
60-
key: ${{ runner.os }}-venv-rp-py3.10-${{ hashFiles('recordprocessor/poetry.lock') }}
61-
restore-keys: |
62-
${{ runner.os }}-venv-rp-py3.10-
63-
64-
- name: Cache Poetry virtualenv (recordforwarder)
65-
uses: actions/cache@v4
66-
with:
67-
path: ./backend/.venv
68-
key: ${{ runner.os }}-venv-be-py3.11-${{ hashFiles('backend/poetry.lock') }}
69-
restore-keys: |
70-
${{ runner.os }}-venv-be-py3.11-
71-
72-
- name: Cache Poetry virtualenv (ack_backend)
73-
uses: actions/cache@v4
74-
with:
75-
path: ./ack_backend/.venv
76-
key: ${{ runner.os }}-venv-ack-py3.10-${{ hashFiles('ack_backend/poetry.lock') }}
77-
restore-keys: |
78-
${{ runner.os }}-venv-ack-py3.10-
79-
80-
- name: Cache Poetry virtualenv (delta_backend)
66+
67+
- name: Cache Poetry virtualenv
8168
uses: actions/cache@v4
8269
with:
83-
path: ./delta_backend/.venv
84-
key: ${{ runner.os }}-venv-delta-py3.11-${{ hashFiles('delta_backend/poetry.lock') }}
70+
path: ./${{ matrix.project }}/.venv
71+
key: ${{ runner.os }}-venv-${{ matrix.project }}-py${{ matrix.python-version }}-${{ hashFiles(format('{0}/poetry.lock', matrix.project)) }}
8572
restore-keys: |
86-
${{ runner.os }}-venv-delta-py3.11-
73+
${{ runner.os }}-venv-${{ matrix.project }}-py${{ matrix.python-version }}-
8774
8875
- name: Run unittest with filenameprocessor-coverage (S)
8976
working-directory: filenameprocessor
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
name: SonarCloud
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [labeled, opened, synchronize, reopened, unlabeled]
9+
env:
10+
SCRIPT_FOLDER: ./.github/scripts
11+
TEST_SCRIPT: source ../.github/scripts/run_test.sh
12+
13+
jobs:
14+
sonarcloud:
15+
name: SonarCloud
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Install poetry
24+
run: pip install poetry==1.8.4
25+
26+
- uses: actions/setup-python@v5
27+
with:
28+
python-version: |
29+
3.10
30+
3.11
31+
cache: 'poetry'
32+
33+
- name: Set up AWS credentials
34+
env:
35+
AWS_ACCESS_KEY_ID: "FOOBARKEY"
36+
AWS_SECRET_ACCESS_KEY: "FOOBARSECRET"
37+
run: |
38+
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
39+
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
40+
41+
- name: Chmod .github directory
42+
run: |
43+
chmod +x $SCRIPT_FOLDER/*.sh
44+
45+
- name: Set Poetry to use in-project venvs
46+
run: poetry config virtualenvs.in-project true
47+
48+
- name: Cache Poetry virtualenv (filenameprocessor)
49+
uses: actions/cache@v4
50+
with:
51+
path: ./filenameprocessor/.venv
52+
key: ${{ runner.os }}-venv-fp-py3.10-${{ hashFiles('filenameprocessor/poetry.lock') }}
53+
restore-keys: |
54+
${{ runner.os }}-venv-fp-py3.10-
55+
56+
- name: Cache Poetry virtualenv (recordprocessor)
57+
uses: actions/cache@v4
58+
with:
59+
path: ./recordprocessor/.venv
60+
key: ${{ runner.os }}-venv-rp-py3.10-${{ hashFiles('recordprocessor/poetry.lock') }}
61+
restore-keys: |
62+
${{ runner.os }}-venv-rp-py3.10-
63+
64+
- name: Cache Poetry virtualenv (recordforwarder)
65+
uses: actions/cache@v4
66+
with:
67+
path: ./backend/.venv
68+
key: ${{ runner.os }}-venv-be-py3.11-${{ hashFiles('backend/poetry.lock') }}
69+
restore-keys: |
70+
${{ runner.os }}-venv-be-py3.11-
71+
72+
- name: Cache Poetry virtualenv (ack_backend)
73+
uses: actions/cache@v4
74+
with:
75+
path: ./ack_backend/.venv
76+
key: ${{ runner.os }}-venv-ack-py3.10-${{ hashFiles('ack_backend/poetry.lock') }}
77+
restore-keys: |
78+
${{ runner.os }}-venv-ack-py3.10-
79+
80+
- name: Cache Poetry virtualenv (delta_backend)
81+
uses: actions/cache@v4
82+
with:
83+
path: ./delta_backend/.venv
84+
key: ${{ runner.os }}-venv-delta-py3.11-${{ hashFiles('delta_backend/poetry.lock') }}
85+
restore-keys: |
86+
${{ runner.os }}-venv-delta-py3.11-
87+
88+
- name: Run unittest with filenameprocessor-coverage (S)
89+
working-directory: filenameprocessor
90+
id: filenameprocessor
91+
continue-on-error: true
92+
run: |
93+
$TEST_SCRIPT 3.10 \
94+
"filenameprocessor" \
95+
"filenameprocessor-coverage.xml"
96+
97+
- name: Run unittest with recordprocessor-coverage (s)
98+
working-directory: recordprocessor
99+
id: recordprocessor
100+
continue-on-error: true
101+
run: |
102+
$TEST_SCRIPT 3.10 \
103+
"recordprocessor" \
104+
"recordprocessor-coverage.xml"
105+
106+
- name: Run unittest with recordforwarder-coverage
107+
working-directory: backend
108+
id: recordforwarder
109+
continue-on-error: true
110+
run: |
111+
$TEST_SCRIPT 3.11 \
112+
"recordforwarder" \
113+
"recordforwarder-coverage.xml"
114+
115+
- name: Run unittest with coverage-ack-lambda
116+
working-directory: ack_backend
117+
id: acklambda
118+
continue-on-error: true
119+
run: |
120+
$TEST_SCRIPT 3.10 \
121+
"ack-lambda" \
122+
"ack-lambda.xml"
123+
124+
- name: Run unittest with coverage-delta
125+
working-directory: delta_backend
126+
id: delta
127+
env:
128+
PYTHONPATH: delta_backend/src:delta_backend/tests
129+
continue-on-error: true
130+
run: |
131+
$TEST_SCRIPT 3.11 \
132+
"delta_backend" \
133+
"delta.xml"
134+
135+
# - name: Run unittest with coverage-fhir-api
136+
# working-directory: backend
137+
# id: fhirapi
138+
# continue-on-error: true
139+
# run: |
140+
# $TEST_SCRIPT 3.11 \
141+
# "fhir-api" \
142+
# "fhir-api.xml"
143+
144+
# - name: Run unittest with coverage-mesh-processor
145+
# working-directory: mesh_processor
146+
# id: meshprocessor
147+
# continue-on-error: true
148+
# run: |
149+
# $TEST_SCRIPT 3.10 \
150+
# "mesh_processor" \
151+
# "mesh_processor-coverage.xml"
152+
153+
- name: Run Test Failure Summary
154+
id: check_failure
155+
run: |
156+
if [ -s failed_tests.txt ]; then
157+
echo "The following tests failed:"
158+
cat failed_tests.txt
159+
160+
while IFS= read -r line; do
161+
echo "##[error]Test Failures: $line"
162+
done < failed_tests.txt
163+
164+
exit 1
165+
else
166+
echo "All tests passed."
167+
fi
168+
169+
- name: SonarCloud Scan
170+
uses: SonarSource/sonarqube-scan-action@master
171+
env:
172+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
173+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)