GitHub Actions: Output a coverage report #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches-ignore: | |
- translations | |
pull_request: | |
branches-ignore: | |
- translations | |
jobs: | |
build-tests-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- run: | | |
if echo "$GITHUB_BASE_REF-$GITHUB_HEAD_REF" | grep -Pqv '^[\\w-]+$'; then | |
echo 'Invalid branch name' | |
exit 1 | |
fi | |
make -C docker config | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: docker/Dockerfile.tests | |
tags: metabrainz/musicbrainz-tests:${{ github.event_name == 'pull_request' && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
push: true | |
js-perl-and-pgtap: | |
needs: build-tests-image | |
runs-on: ubuntu-latest | |
container: | |
image: metabrainz/musicbrainz-tests:${{ github.event_name == 'pull_request' && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }} | |
options: --user root | |
defaults: | |
run: | |
working-directory: /home/musicbrainz/musicbrainz-server | |
steps: | |
- run: | | |
./docker/musicbrainz-tests/run_js_perl_and_pgtap_tests.sh | |
- if: always() | |
uses: mikepenz/action-junit-report@v5 | |
with: | |
report_paths: 'junit_output/*.xml' | |
fail_on_failure: true | |
require_tests: true | |
selenium: | |
needs: build-tests-image | |
runs-on: ubuntu-latest | |
container: | |
image: metabrainz/musicbrainz-tests:${{ github.event_name == 'pull_request' && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }} | |
options: --user root | |
defaults: | |
run: | |
working-directory: /home/musicbrainz/musicbrainz-server | |
steps: | |
- run: | | |
./docker/musicbrainz-tests/run_selenium_tests.sh | |
- if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
path: artifacts | |
- if: always() | |
uses: mikepenz/action-junit-report@v5 | |
with: | |
report_paths: 'junit_output/*.xml' | |
fail_on_failure: true | |
require_tests: true | |
- uses: irongut/[email protected] | |
with: | |
filename: cobertura-coverage.xml | |
format: markdown |