From 178813faa5bcfac86e7eaad24e339406db6b3357 Mon Sep 17 00:00:00 2001 From: Stefano Cunego <93382903+kukkok3@users.noreply.github.com> Date: Tue, 6 Aug 2024 12:38:51 +0200 Subject: [PATCH] fix: flutter coverage (#661) * fix: flutter coverage * chore: update ci version * feat: adds api coverage * feat: normalize pat * fix: sed * fix: sed * fix: sed --- .github/workflows/generate-allure-report.yml | 16 ++++++++++++++-- Earthfile | 6 +++--- .../c509-certificate/Earthfile | 6 +++--- catalyst-gateway/Earthfile | 4 ++-- catalyst-gateway/event-db/Earthfile | 2 +- catalyst-gateway/tests/Earthfile | 2 +- catalyst-gateway/tests/api_tests/Earthfile | 2 +- catalyst_voices/Earthfile | 2 +- catalyst_voices/uikit_example/Earthfile | 2 +- docs/Earthfile | 2 +- melos.yaml | 5 +++-- 11 files changed, 31 insertions(+), 18 deletions(-) diff --git a/.github/workflows/generate-allure-report.yml b/.github/workflows/generate-allure-report.yml index a7eb9b11ff..91ae87570a 100644 --- a/.github/workflows/generate-allure-report.yml +++ b/.github/workflows/generate-allure-report.yml @@ -173,8 +173,7 @@ jobs: - 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 + sed -i -e 's/SF:/SF:catalyst-gateway\/tests\/api_tests\//g' ${{ env.COVERAGE_REPORT_PATH }}/api-tests.coverage.info - name: Coveralls env: @@ -188,6 +187,18 @@ jobs: 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 }}/api-tests.coverage.info" + allow-empty: true + debug: true + flag-name: api-test + base-path: "/home/runner/work/catalyst-voices/catalyst-voices/" + parallel: true + - name: Coveralls env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -200,6 +211,7 @@ jobs: base-path: "/home/runner/work/catalyst-voices/catalyst-voices/" parallel: true + upload-coverage-report: name: Upload coverage report needs: [generate-coverage-report] diff --git a/Earthfile b/Earthfile index 2b65811dde..be95b3c69e 100644 --- a/Earthfile +++ b/Earthfile @@ -1,8 +1,8 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.1.20 AS mdlint-ci -IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.1.20 AS cspell-ci -IMPORT github.com/input-output-hk/catalyst-ci/earthly/postgresql:v3.1.20 AS postgresql-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.1.21 AS mdlint-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.1.21 AS cspell-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/postgresql:v3.1.21 AS postgresql-ci FROM debian:stable-slim diff --git a/catalyst-gateway-crates/c509-certificate/Earthfile b/catalyst-gateway-crates/c509-certificate/Earthfile index 2bfcad0575..3c6a15fed2 100644 --- a/catalyst-gateway-crates/c509-certificate/Earthfile +++ b/catalyst-gateway-crates/c509-certificate/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.1.20 AS rust-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.1.21 AS rust-ci # builder : Set up our target toolchains, and copy our files. builder: @@ -23,9 +23,9 @@ build: --args1="--libs=c509-certificate" RUN cargo install wasm-pack --version=0.12.1 --locked - + # js-wasm-package-locally : Generate the wasm package and save it locally -js-wasm-package-locally: +js-wasm-package-locally: FROM +build RUN wasm-pack build --target web SAVE ARTIFACT ./pkg AS LOCAL ./pkg diff --git a/catalyst-gateway/Earthfile b/catalyst-gateway/Earthfile index 3926519647..a9748d0a0f 100644 --- a/catalyst-gateway/Earthfile +++ b/catalyst-gateway/Earthfile @@ -1,7 +1,7 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.1.20 AS rust-ci -IMPORT github.com/input-output-hk/catalyst-ci/earthly/mithril_snapshot:v3.1.20 AS mithril-snapshot-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.1.21 AS rust-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/mithril_snapshot:v3.1.21 AS mithril-snapshot-ci #cspell: words rustfmt toolsets USERARCH diff --git a/catalyst-gateway/event-db/Earthfile b/catalyst-gateway/event-db/Earthfile index 3cf82fcdc2..c85600ef88 100644 --- a/catalyst-gateway/event-db/Earthfile +++ b/catalyst-gateway/event-db/Earthfile @@ -3,7 +3,7 @@ # the database and its associated software. VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/postgresql:v3.1.20 AS postgresql-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/postgresql:v3.1.21 AS postgresql-ci # cspell: words diff --git a/catalyst-gateway/tests/Earthfile b/catalyst-gateway/tests/Earthfile index 027a7c64a7..16aed63c4a 100644 --- a/catalyst-gateway/tests/Earthfile +++ b/catalyst-gateway/tests/Earthfile @@ -1,5 +1,5 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/spectral:v3.1.20 AS spectral-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/spectral:v3.1.21 AS spectral-ci # test-lint-openapi - OpenAPI linting from an artifact # testing whether the OpenAPI generated during build stage follows good practice. diff --git a/catalyst-gateway/tests/api_tests/Earthfile b/catalyst-gateway/tests/api_tests/Earthfile index 13220b2b84..4cbe641d7b 100644 --- a/catalyst-gateway/tests/api_tests/Earthfile +++ b/catalyst-gateway/tests/api_tests/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/python:v3.1.20 AS python-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/python:v3.1.21 AS python-ci builder: FROM python-ci+python-base diff --git a/catalyst_voices/Earthfile b/catalyst_voices/Earthfile index 96b78640b8..8117ddd554 100644 --- a/catalyst_voices/Earthfile +++ b/catalyst_voices/Earthfile @@ -1,7 +1,7 @@ VERSION 0.8 IMPORT ../catalyst-gateway AS catalyst-gateway -IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.1.20 AS flutter-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.1.21 AS flutter-ci # Copy all the necessary files and running bootstrap builder: diff --git a/catalyst_voices/uikit_example/Earthfile b/catalyst_voices/uikit_example/Earthfile index 72ba3d2fd3..6a31dab57b 100644 --- a/catalyst_voices/uikit_example/Earthfile +++ b/catalyst_voices/uikit_example/Earthfile @@ -1,7 +1,7 @@ VERSION 0.8 IMPORT ../ AS catalyst-voices -IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.1.20 AS flutter-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/flutter:v3.1.21 AS flutter-ci # local-build-web - build web version of UIKit example. # Prefixed by "local" to make sure it's not auto triggered, the target was diff --git a/docs/Earthfile b/docs/Earthfile index f2e65a99cd..61fd0e8b2b 100644 --- a/docs/Earthfile +++ b/docs/Earthfile @@ -1,6 +1,6 @@ VERSION 0.8 -IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.1.20 AS docs-ci +IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.1.21 AS docs-ci IMPORT .. AS repo IMPORT ../catalyst-gateway AS catalyst-gateway diff --git a/melos.yaml b/melos.yaml index 0c501c504b..067d6ca79a 100644 --- a/melos.yaml +++ b/melos.yaml @@ -76,7 +76,7 @@ scripts: # cleanup from previous build and create new folders rm -fR $MELOS_ROOT_PATH/test_reports mkdir $MELOS_ROOT_PATH/test_reports - + # run tests, generate junit reports in /test_reports/ & code coverage report melos exec -c 1 --dir-exists="test" -- \ "flutter test --reporter expanded --coverage --machine | tojunit --output $MELOS_ROOT_PATH/test_reports/MELOS_PACKAGE_NAME.junit-report.xml" @@ -90,7 +90,8 @@ scripts: '*.freezed.dart' \ 'lib/generated/**' - mv ./catalyst_voices/coverage . + dart pub global run combine_coverage --repo-path=. + description: | Run `flutter test` for all packages and generate junit and coverage reports. The test reports are saved in /test_reports folder.