This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
test for github code coverage #103
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: build | |
on: push | |
jobs: | |
set_status_in_progress: | |
name: set_status_in_progress | |
if: always() | |
uses: dpc-sdp/github-actions/.github/workflows/set_status.yml@main | |
secrets: inherit | |
with: | |
context: 'tide_build' | |
description: 'Tide Build running...' | |
state: 'pending' | |
target_url: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} | |
tide_build: | |
name: tide_build | |
secrets: inherit | |
uses: dpc-sdp/github-actions/.github/workflows/tide_build.yml@main | |
with: | |
module_build: true | |
runner: biggy-tide | |
phpunit_coverage: | |
name: phpunit_coverage | |
needs: tide_build | |
runs-on: biggy-tide | |
steps: | |
- name: Run PHPUnit with coverage using phpdbg | |
run: | | |
phpdbg -qrr vendor/bin/phpunit ./dpc-sdp --coverage-html ./coverage-report | |
- name: Check coverage | |
run: | | |
coverage=$(grep -Po '(?<=<td class="text-right">)[0-9.]+(?=%</td>)' ./coverage-report/index.html | head -n 1) | |
if (( $(echo "$coverage < 80" | bc -l) )); then | |
echo "Code coverage is below 80%: $coverage%" | |
exit 1 | |
fi | |
shell: bash | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: code-coverage-report | |
path: coverage-report | |
export_config: | |
name: export_config | |
secrets: inherit | |
uses: dpc-sdp/github-actions/.github/workflows/export_config.yml@main | |
set_status: | |
name: set_status | |
needs: [tide_build] | |
if: always() | |
uses: dpc-sdp/github-actions/.github/workflows/set_status.yml@main | |
secrets: inherit | |
with: | |
context: 'tide_build' | |
description: 'Tide Build' | |
target_url: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} |