Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds code coverage with coveralls #520

Merged
merged 69 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
ea16c3c
test
kukkok3 May 26, 2024
def071b
Merge branch 'main' into feat/adds-code-coverage
kukkok3 May 30, 2024
b807a92
test
kukkok3 May 30, 2024
f5c239b
Merge branch 'feat/adds-code-coverage' of https://github.com/input-ou…
kukkok3 May 30, 2024
0650835
wip
kukkok3 May 30, 2024
4ddb5a6
fix: artifact name
kukkok3 May 30, 2024
195d33e
adds: coveralls
kukkok3 May 30, 2024
83dd11f
fix bash
kukkok3 May 30, 2024
60b6f60
debug
kukkok3 May 31, 2024
0069fba
fix file path
kukkok3 May 31, 2024
1a8b151
adds coverall action
kukkok3 May 31, 2024
51f026c
adds debug
kukkok3 May 31, 2024
e754229
change ci
kukkok3 Jun 4, 2024
deff17f
adds allow empty flag
kukkok3 Jun 5, 2024
6970ac0
Merge branch 'main' into feat/adds-code-coverage
kukkok3 Jun 5, 2024
308a860
fix: update ci version
kukkok3 Jun 5, 2024
b08ec0c
Merge branch 'main' into feat/adds-code-coverage
stevenj Jun 6, 2024
1b02753
Merge branch 'main' into feat/adds-code-coverage
stevenj Jun 6, 2024
38c5cec
Merge branch 'main' into feat/adds-code-coverage
stevenj Jun 6, 2024
f26e1d3
Merge branch 'main' into feat/adds-code-coverage
kukkok3 Jun 7, 2024
b5c4d54
feats: adds coverage for backend pytest tests
kukkok3 Jun 17, 2024
50d898d
test
kukkok3 Jun 18, 2024
689ed09
fix spelling
kukkok3 Jun 18, 2024
c92aebc
rename coverage file
kukkok3 Jun 18, 2024
026f39d
fix: enable earthfile
kukkok3 Jun 18, 2024
aafb02b
Merge branch 'main' into feat/adds-code-coverage
kukkok3 Jun 18, 2024
616430c
Merge branch 'main' into feat/adds-code-coverage
kukkok3 Jun 18, 2024
fd37ce8
test
kukkok3 Jun 18, 2024
d576957
Merge branch 'main' into feat/adds-code-coverage
kukkok3 Jun 18, 2024
e311782
test run
kukkok3 Jun 18, 2024
ce6d03e
fix path
kukkok3 Jun 18, 2024
3c4aace
chore: test run
kukkok3 Jul 15, 2024
8fa5fd5
Merge branch 'main' into feat/adds-code-coverage
kukkok3 Jul 15, 2024
ddeba98
chore: test run
kukkok3 Jul 15, 2024
29cc7db
Merge branch 'feat/adds-code-coverage' of https://github.com/input-ou…
kukkok3 Jul 15, 2024
1269ce3
fix: action param
kukkok3 Jul 16, 2024
e378635
test
kukkok3 Jul 16, 2024
d0d90f0
test
kukkok3 Jul 16, 2024
fee0e3f
Merge branch 'main' into feat/adds-code-coverage
kukkok3 Jul 16, 2024
654591e
test
kukkok3 Jul 16, 2024
28c08bd
Merge branch 'feat/adds-code-coverage' of https://github.com/input-ou…
kukkok3 Jul 16, 2024
dcf7c07
adds debug
kukkok3 Jul 16, 2024
99b7d07
adds base path
kukkok3 Jul 16, 2024
748c93b
Merge branch 'main' into feat/adds-code-coverage
kukkok3 Jul 16, 2024
5fb0f77
fix base path
kukkok3 Jul 16, 2024
14d5d47
Merge branch 'feat/adds-code-coverage' of https://github.com/input-ou…
kukkok3 Jul 16, 2024
0b0909e
test
kukkok3 Jul 16, 2024
1999d35
test
kukkok3 Jul 16, 2024
b928cac
test
kukkok3 Jul 17, 2024
0ed8681
Merge branch 'main' into feat/adds-code-coverage
kukkok3 Jul 17, 2024
98c627f
test
kukkok3 Jul 17, 2024
23c8070
Merge branch 'feat/adds-code-coverage' of https://github.com/input-ou…
kukkok3 Jul 17, 2024
c90db5e
test
kukkok3 Jul 17, 2024
38db80d
test
kukkok3 Jul 17, 2024
9ef1c44
feat: adds sed
kukkok3 Jul 17, 2024
f2579ae
chore: clean up
kukkok3 Jul 17, 2024
2e6b648
test
kukkok3 Jul 18, 2024
cc0c75d
fix melos
kukkok3 Jul 18, 2024
0df4b50
feat: adds parallel coverage
kukkok3 Jul 19, 2024
759d16d
Merge branch 'main' into feat/adds-code-coverage
kukkok3 Jul 19, 2024
ec5de9f
Merge branch 'main' into feat/adds-code-coverage
kukkok3 Jul 19, 2024
68285e3
feat: adds flutter coverage
kukkok3 Jul 19, 2024
39e1b7d
fix: coverage ext path
kukkok3 Jul 19, 2024
1013f40
fix coverage ext
kukkok3 Jul 19, 2024
3380a44
fix: coverage path
kukkok3 Jul 19, 2024
1be0a4d
fix coverage path
kukkok3 Jul 19, 2024
bac16dd
feat: adds sed for flutter coverage
kukkok3 Jul 19, 2024
4562304
test
kukkok3 Jul 19, 2024
9bf2dcc
fix coverage path
kukkok3 Jul 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .config/dictionaries/project.dic
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ afinet
androidx
anypolicy
appspot
Arissara
Arbritrary
ARGB
Arissara
asmjs
asyncio
asyncpg
Expand All @@ -25,11 +25,12 @@ bluefireteam
BROTLI
canvaskit
cardano
carryforward
Catalyst
CBOR
cborg
CEST
cdylib
CEST
cfbundle
Chotivichit
chromedriver
Expand All @@ -40,6 +41,7 @@ COCOAPODS
codegen
codepoints
coti
coverallsapp
cryptoxide
Cunego
Cupertino
Expand Down Expand Up @@ -239,4 +241,4 @@ xcodeproj
xctest
xctestrun
xcworkspace
yoroi
yoroi
80 changes: 77 additions & 3 deletions .github/workflows/generate-allure-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ env:
EARTHLY_TARGET: docker
ECR_REGISTRY: 332405224602.dkr.ecr.eu-central-1.amazonaws.com
ALLURE_REPORT_PATH: allure-report
COVERAGE_REPORT_PATH: coverage-report
REPORT_EXT: .junit-report.xml
COVERAGE_EXT: .info

jobs:
generate-test-reports:
Expand Down Expand Up @@ -71,8 +73,8 @@ jobs:
target_flags:
runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
artifact: "false"
- name: Get backend python test report

- name: Get python api test report
uses: input-output-hk/catalyst-ci/actions/run@master
if: always()
continue-on-error: true
Expand All @@ -88,10 +90,20 @@ jobs:
uses: actions/upload-artifact@v4
if: always()
with:
name: test-reports
path: '**/*${{ env.REPORT_EXT }}'
if-no-files-found: error
retention-days: 1

- name: Collect and upload test coverage
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-reports
path: '**/*${{ env.COVERAGE_EXT }}'
if-no-files-found: error
retention-days: 1

generate-allure-report:
name: Generate allure report
runs-on: ubuntu-latest
Expand All @@ -100,6 +112,8 @@ jobs:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: test-reports

- name: Setup Allure report
run: |
Expand Down Expand Up @@ -136,4 +150,64 @@ jobs:
message: |
${{ steps.allure.outputs.test_result_icon }} [Test Report](${{ steps.allure.outputs.report_url }}) | ${\color{lightgreen}Pass: ${{ steps.allure.outputs.test_result_passed }}/${{ steps.allure.outputs.test_result_total }}}$ | ${\color{red}Fail: ${{ steps.allure.outputs.test_result_failed }}/${{ steps.allure.outputs.test_result_total }}}$ |
comment_tag: allure_report
mode: upsert
mode: upsert

generate-coverage-report:
name: Generate coverage report
runs-on: ubuntu-latest
needs: [generate-test-reports]
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: coverage-reports

- name: Collect coverage report
run: |
mkdir -p ${{ env.COVERAGE_REPORT_PATH }}
shopt -s globstar
cp **/*${{ env.COVERAGE_EXT }} ${{ env.COVERAGE_REPORT_PATH }}
ls ${{ env.COVERAGE_REPORT_PATH }}

- name: Normalize coverage report paths
run: |
sed -i -e 's/SF:\/root/SF:catalyst-gateway/g' ${{ env.COVERAGE_REPORT_PATH }}/cat-gateway.coverage.info
sed -i -e 's/SF:lib/SF:catalyst_voices\/lib/g' ${{ env.COVERAGE_REPORT_PATH }}/lcov.info
cat ${{ env.COVERAGE_REPORT_PATH }}/cat-gateway.coverage.info

- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: coverallsapp/github-action@v2
with:
path-to-lcov: "${{ env.COVERAGE_REPORT_PATH }}/cat-gateway.coverage.info"
allow-empty: true
debug: true
flag-name: rust-unit-test
base-path: "/home/runner/work/catalyst-voices/catalyst-voices/"
parallel: true

- name: Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: coverallsapp/github-action@v2
with:
path-to-lcov: "${{ env.COVERAGE_REPORT_PATH }}/lcov.info"
allow-empty: true
debug: true
flag-name: flutter-test
base-path: "/home/runner/work/catalyst-voices/catalyst-voices/"
parallel: true

upload-coverage-report:
name: Upload coverage report
needs: [generate-coverage-report]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: "rust-unit-test,flutter-test"
2 changes: 1 addition & 1 deletion catalyst-gateway/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ target/
*.pdb

# Build artifacts
cat-gateway.coverage-report.info
cat-gateway.coverage.info
cat-gateway.junit-report.xml
cat-gateway-api.*
2 changes: 1 addition & 1 deletion catalyst-gateway/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ build:
--args2="--cov_report=$HOME/coverage-report.info" \
--output="release/cat-gateway" \
--junit="cat-gateway.junit-report.xml" \
--coverage="cat-gateway.coverage-report.info" \
--coverage="cat-gateway.coverage.info" \
--docs="true"

# Generate the OpenAPI doc from the cat-gateway executable itself.
Expand Down
9 changes: 6 additions & 3 deletions catalyst-gateway/tests/api_tests/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ builder:
# Disabled in CI, to enable rename it to `test`.
api-test:
FROM +builder
RUN apk update && apk add iptables-legacy # workaround for https://github.com/earthly/earthly/issues/3784

COPY ./docker-compose.yml .

WITH DOCKER \
--compose docker-compose.yml \
--load event-db:latest=(../../event-db+build) \
--load cat-gateway:latest=(../../+package-cat-gateway-with-preprod) \
--load cat-gateway:latest=(../../+package-cat-gateway-with-preprod-snapshot) \
--service cat-gateway \
--allow-privileged
RUN poetry run pytest -s --junitxml=junit-report.xml
RUN poetry run pytest -s --junitxml=junit-report.xml --cov=api_tests --cov-report lcov
END
WAIT
SAVE ARTIFACT junit-report.xml AS LOCAL backendpython.junit-report.xml
SAVE ARTIFACT junit-report.xml AS LOCAL api-tests.junit-report.xml
SAVE ARTIFACT coverage.lcov AS LOCAL api-tests.coverage.info

END
Loading
Loading