10000 Github Actions: added job to publish test results to coveralls and ar… · localstack/localstack@d6e1a1a · GitHub
[go: up one dir, main page]

Skip to content

Commit d6e1a1a

Browse files
authored
Github Actions: added job to publish test results to coveralls and artifacts (#12608)
1 parent 2f84418 commit d6e1a1a

File tree

1 file 10000 changed

+97
-1
lines changed

1 file changed

+97
-1
lines changed

.github/workflows/aws-main.yml

Lines changed: 97 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,104 @@ jobs:
6868
DOCKERHUB_PULL_USERNAME: ${{ secrets.DOCKERHUB_PULL_USERNAME }}
6969
DOCKERHUB_PULL_TOKEN: ${{ secrets.DOCKERHUB_PULL_TOKEN }}
7070

71+
report:
72+
name: "Publish coverage and parity metrics"
73+
runs-on: ubuntu-latest
74+
needs:
75+
- test
76+
steps:
77+
- name: Checkout
78+
uses: actions/checkout@v4
79+
80+
- name: Set up Python
81+
uses: actions/setup-python@v5
82+
with:
83+
python-version-file: '.python-version'
84+
cache: 'pip'
85+
cache-dependency-path: 'requirements-dev.txt'
86+
87+
- name: Install Community Dependencies
88+
shell: bash
89+
run: make install-dev
90+
91+
- name: Load all test results
92+
uses: actions/download-artifact@v4
93+
with:
94+
pattern: test-results-*
95+
path: target/coverage/
96+
merge-multiple: true
97+
98+
- name: Combine coverage results from acceptance tests
99+
run: |
100+
source .venv/bin/activate
101+
mkdir target/coverage/acceptance
102+
cp target/coverage/.coverage.acceptance* target/coverage/acceptance
103+
cd target/coverage/acceptance
104+
coverage combine
105+
mv .coverage ../../../.coverage.acceptance
106+
107+
- name: Combine all coverage results
108+
run: |
109+
source .venv/bin/activate
110+
cd target/coverage
111+
ls -la
112+
coverage combine
113+
mv .coverage ../../
114+
115+
- name: Report coverage statistics
116+
env:
117+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
118+
run: |
119+
source .venv/bin/activate
120+
coverage report || true
121+
coverage html || true
122+
# TO-DO: enable job after workflow in CircleCI is disabled
123+
# coveralls || true
124+
125+
- name: Create Coverage Diff (Code Coverage)
126+
# pycobertura diff will return with exit code 0-3 -> we currently expect 2 (2: the changes worsened the overall coverage),
127+
# but we still want cirecleci to continue with the tasks, so we return 0.
128+
# From the docs:
129+
# Upon exit, the diff command may return various exit codes:
130+
# 0: all changes are covered, no new uncovered statements have been introduced
131+
# 1: some exception occurred (likely due to inappropriate usage or a bug in pycobertura)
132+
# 2: the changes worsened the overall coverage
133+
# 3: the changes introduced uncovered statements but the overall coverage is still better than before
134+
run: |
135+
source .venv/bin/activate
136+
pip install pycobertura
137+
coverage xml --data-file=.coverage -o all.coverage.report.xml --include="localstack-core/localstack/services/*/**" --omit="*/**/__init__.py"
138+
coverage xml --data-file=.coverage.acceptance -o acceptance.coverage.report.xml --include="localstack-core/localstack/services/*/**" --omit="*/**/__init__.py"
139+
pycobertura show --format html acceptance.coverage.report.xml -o coverage-acceptance.html
140+
bash -c "pycobertura diff --format html all.coverage.report.xml acceptance.coverage.report.xml -o coverage-diff.html; if [[ \$? -eq 1 ]] ; then exit 1 ; else exit 0 ; fi"
141+
142+
- name: Create Metric Coverage Diff (API Coverage)
143+
env:
144+
COVERAGE_DIR_ALL: "parity_metrics"
145+
COVERAGE_DIR_ACCEPTANCE: "acceptance_parity_metrics"
146+
OUTPUT_DIR: "api-coverage"
147+
run: |
148+
source .venv/bin/activate
149+
mkdir $OUTPUT_DIR
150+
python -m scripts.metrics_coverage.diff_metrics_coverage
151+
152+
- name: Archive coverage and parity metrics
153+
uses: actions/upload-artifact@v4
154+
with:
155+
name: coverage-and-parity-metrics
156+
path: |
157+
.coverage
158+
api-coverage/
159+
coverage-acceptance.html
160+
coverage-diff.html
161+
parity_metrics/
162+
acceptance_parity_metrics/
163+
scripts/implementation_coverage_aggregated.csv
164+
scripts/implementation_coverage_full.csv
165+
retention-days: 7
166+
71167
push:
72-
name: "Push Images"
168+
name: "Push images"
73169
runs-on: ubuntu-latest
74170
# push image on master, target branch not set, and the dependent steps were either successful or skipped
75171
# TO-DO: enable job after workflow in CircleCI is disabled

0 commit comments

Comments
 (0)
0