Skip to content

Commit 3343597

Browse files
committed
test
1 parent 70ceb9b commit 3343597

3 files changed

Lines changed: 162 additions & 172 deletions

File tree

.github/workflows/sonarcloud.yml

Lines changed: 84 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,14 @@ on:
66
- master
77
pull_request:
88
types: [labeled, opened, synchronize, reopened, unlabeled]
9-
env:
10-
SCRIPT_FOLDER: ./.github/scripts
11-
RUN_TEST: source ../.github/scripts/run_test.sh
129

1310
jobs:
1411
sonarcloud:
1512
name: SonarCloud
1613
runs-on: ubuntu-latest
1714
strategy:
1815
matrix:
19-
python-version: ['3.11']
16+
python-version: ['3.11', '3.10']
2017

2118
steps:
2219
- uses: actions/checkout@v4
@@ -28,9 +25,21 @@ jobs:
2825

2926
- uses: actions/setup-python@v5
3027
with:
31-
python-version: ${{ matrix.python-version }}
28+
python-version: |
29+
3.10
30+
3.11
3231
cache: 'poetry'
3332

33+
- name: Cache global Poetry virtualenvs
34+
35+
uses: actions/cache@v4
36+
with:
37+
path: ~/.cache/pypoetry/virtualenvs
38+
key: ${{ runner.os }}-poetry-global-venv-py${{ matrix.python-version || 'all' }}-${{ hashFiles('**/poetry.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-poetry-global-venv-py${{ matrix.python-version || 'all' }}-
41+
42+
3443
- name: Set up AWS credentials
3544
env:
3645
AWS_ACCESS_KEY_ID: "FOOBARKEY"
@@ -39,17 +48,47 @@ jobs:
3948
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
4049
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
4150
42-
- name: Chmod .github directory
43-
run: |
44-
chmod +x $SCRIPT_FOLDER/*.sh
51+
# - name: Run unittest with filenameprocessor-coverage
52+
# working-directory: filenameprocessor
53+
# id: filenameprocessor
54+
# continue-on-error: true
55+
# run: |
56+
# poetry env use 3.10
57+
# poetry install
58+
# poetry run coverage run -m unittest discover || echo "filenameprocessor tests failed" >> ../failed_tests.txt
59+
# poetry run coverage xml -o ../sonarcloud-coverage-filenameprocessor-coverage.xml
4560

46-
- name: Cache global Poetry virtualenvs
47-
uses: actions/cache@v4
48-
with:
49-
path: ~/.cache/pypoetry/virtualenvs
50-
key: ${{ runner.os }}-poetry-global-venv-py${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
51-
restore-keys: |
52-
${{ runner.os }}-poetry-global-venv-py${{ matrix.python-version }}-
61+
# - name: Run unittest with recordprocessor-coverage
62+
# working-directory: recordprocessor
63+
# id: recordprocessor
64+
# continue-on-error: true
65+
# run: |
66+
# poetry env use 3.10
67+
# poetry install
68+
# poetry run coverage run -m unittest discover || echo "recordprocessor tests failed" >> ../failed_tests.txt
69+
# poetry run coverage xml -o ../sonarcloud-coverage-recordprocessor-coverage.xml
70+
71+
# # This step is redundant - all of these tests will be run in the backend step below
72+
# - name: Run unittest with recordforwarder-coverage
73+
# working-directory: backend
74+
# id: recordforwarder
75+
# continue-on-error: true
76+
# run: |
77+
# poetry env use 3.11
78+
# poetry install
79+
# poetry run coverage run -m unittest discover -s "./tests" -p "*batch*.py" || echo "recordforwarder tests failed" >> ../failed_tests.txt
80+
# poetry run coverage xml -o ../sonarcloud-coverage-recordforwarder-coverage.xml
81+
82+
- name: Run unittest with coverage-ack-lambda
83+
if: matrix.python-version == '3.10'
84+
working-directory: ack_backend
85+
id: acklambda
86+
continue-on-error: true
87+
run: |
88+
poetry env use 3.10
89+
poetry install
90+
poetry run coverage run -m unittest discover || echo "ack-lambda tests failed" >> ../failed_tests.txt
91+
poetry run coverage xml -o ../sonarcloud-coverage-ack-lambda.xml
5392
5493
- name: Run unittest with coverage-delta
5594
if: matrix.python-version == '3.11'
@@ -59,7 +98,30 @@ jobs:
5998
PYTHONPATH: delta_backend/src:delta_backend/tests
6099
continue-on-error: true
61100
run: |
62-
$RUN_TEST 3.11 delta_backend delta.xml
101+
poetry env use 3.11
102+
poetry install
103+
poetry run coverage run -m unittest discover || echo "delta tests failed" >> ../failed_tests.txt
104+
poetry run coverage xml -o ../sonarcloud-coverage-delta.xml
105+
106+
# - name: Run unittest with coverage-fhir-api
107+
# working-directory: backend
108+
# id: fhirapi
109+
# continue-on-error: true
110+
# run: |
111+
# poetry env use 3.11
112+
# poetry install
113+
# poetry run coverage run -m unittest discover || echo "fhir-api tests failed" >> ../failed_tests.txt
114+
# poetry run coverage xml -o ../sonarcloud-coverage.xml
115+
116+
# - name: Run unittest with coverage-mesh-processor
117+
# working-directory: mesh_processor
118+
# id: meshprocessor
119+
# continue-on-error: true
120+
# run: |
121+
# poetry env use 3.10
122+
# poetry install
123+
# poetry run coverage run -m unittest discover || echo "mesh_processor tests failed" >> ../failed_tests.txt
124+
# poetry run coverage xml -o ../sonarcloud-mesh_processor-coverage.xml
63125

64126
- name: Run Test Failure Summary
65127
id: check_failure
@@ -76,3 +138,9 @@ jobs:
76138
else
77139
echo "All tests passed."
78140
fi
141+
142+
- name: SonarCloud Scan
143+
uses: SonarSource/sonarqube-scan-action@master
144+
env:
145+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
146+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/sonarcloud.yml.save

Lines changed: 0 additions & 156 deletions
This file was deleted.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
RUN_TEST: source ../.github/scripts/run_test.sh
12+
13+
jobs:
14+
sonarcloud:
15+
name: SonarCloud
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python-version: ['3.11']
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Install poetry
27+
run: pip install poetry==1.8.4
28+
29+
- uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
cache: 'poetry'
33+
34+
- name: Set up AWS credentials
35+
env:
36+
AWS_ACCESS_KEY_ID: "FOOBARKEY"
37+
AWS_SECRET_ACCESS_KEY: "FOOBARSECRET"
38+
run: |
39+
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
40+
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
41+
42+
- name: Chmod .github directory
43+
run: |
44+
chmod +x $SCRIPT_FOLDER/*.sh
45+
46+
- name: Cache global Poetry virtualenvs
47+
uses: actions/cache@v4
48+
with:
49+
path: ~/.cache/pypoetry/virtualenvs
50+
key: ${{ runner.os }}-poetry-global-venv-py${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
51+
restore-keys: |
52+
${{ runner.os }}-poetry-global-venv-py${{ matrix.python-version }}-
53+
54+
- name: Run unittest with coverage-delta
55+
if: matrix.python-version == '3.11'
56+
working-directory: delta_backend
57+
id: delta
58+
env:
59+
PYTHONPATH: delta_backend/src:delta_backend/tests
60+
continue-on-error: true
61+
run: |
62+
$RUN_TEST 3.11 delta_backend delta.xml
63+
64+
- name: Run Test Failure Summary
65+
id: check_failure
66+
run: |
67+
if [ -s failed_tests.txt ]; then
68+
echo "The following tests failed:"
69+
cat failed_tests.txt
70+
71+
while IFS= read -r line; do
72+
echo "##[error]Test Failures: $line"
73+
done < failed_tests.txt
74+
75+
exit 1
76+
else
77+
echo "All tests passed."
78+
fi

0 commit comments

Comments
 (0)