From bf943e716cf4e248311160751564ef7c2820d45f Mon Sep 17 00:00:00 2001 From: Marko Kungla Date: Mon, 29 Jan 2024 21:18:11 +0200 Subject: [PATCH] ci: upload correct coverage with auto detect modules Signed-off-by: Marko Kungla --- .github/workflows/main.yml | 68 +++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cd150a6..25d4203 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -33,6 +33,7 @@ jobs: modules: ${{ steps.modulelist.outputs.modules }} steps: - uses: actions/checkout@v4 + - name: Get monorepo modules id: modulelist uses: ./.github/actions/go-test-monorepo-action @@ -50,37 +51,50 @@ jobs: fail-fast: false steps: - uses: actions/checkout@v4 + - name: Run tests and generate coverage reports id: modulelist uses: ./.github/actions/go-test-monorepo-action with: go-version: '>=1.21.0' - # - name: Check if coverage data exists - # if: success() || failure() - # id: check-coverage - # working-directory: ./${{ matrix.package }} - # run: | - # if [ $(wc -l > $GITHUB_ENV + + - name: Upload coverage + if: steps.check-coverage.outputs.coverage_data_exists == 'true' + uses: coverallsapp/github-action@v2 + with: + flag-name: ${{ steps.prepare-flag.outputs.clean_module_name }} + parallel: true + github-token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ matrix.module }}/coverage.out - # finish: - # needs: test - # if: ${{ always() }} - # runs-on: ubuntu-latest - # steps: - # - name: Coveralls Finish - # uses: coverallsapp/github-action@v2 - # with: - # parallel-finished: true + finish-coverage-report: + needs: test-modules + if: ${{ always() }} + runs-on: ubuntu-latest + steps: + - name: Coveralls Finish + uses: coverallsapp/github-action@v2 + with: + parallel-finished: true