Skip to content

Commit

Permalink
Split coverage reports by collect results, like tests are
Browse files Browse the repository at this point in the history
That way they will run faster (in parallel) and have not to
wait for tests to end, they will start immediately after
collecting them.

(borrowed from moodle-local_ci where we are using that
technique with success since some time ago)
  • Loading branch information
stronk7 committed Jun 7, 2024
1 parent 59c055d commit da0de53
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ jobs:
coverage:
if: github.repository == 'moodlehq/moodle-ci-runner'
name: Code coverage
needs: test
needs: collect
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
test: ${{ fromJson(needs.collect.outputs.matrix) }}
steps:
- name: Install required packages
run: |
Expand Down Expand Up @@ -120,18 +124,7 @@ jobs:
--include-path ${{ github.workspace }}/runner/main \
--bash-parse-files-in-dir ${{ github.workspace }}/runner/main \
${{ github.workspace }}/coverage \
bats ${{ github.workspace }}/test/
- name: Archive code coverage
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: ${{ github.workspace }}/coverage/*

- name: Display code coverage
run: |
value=$(jq -r '.percent_covered' < ${{ github.workspace }}/coverage/bats/coverage.json)
echo "Code coverage: $value%" | tee "$GITHUB_STEP_SUMMARY"
bats --timing ${{ github.workspace }}/test/${{ matrix.test }}
- name: Upload code coverage (codecov)
uses: codecov/codecov-action@v4
Expand Down

0 comments on commit da0de53

Please sign in to comment.