♻️ Refactor reporter code (#31) #42
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: Tests | |
on: [ push ] | |
jobs: | |
unit: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
if: github.event.pull_request.draft == false | |
steps: | |
- uses: actions/checkout@v4 | |
- run: npm i | |
- name: Prebuild files | |
run: npm run test:prebuild | |
- name: Run ava unit tests | |
run: npm run test:ava | |
coverage: | |
name: Code coverage | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
if: github.event.pull_request.draft == false | |
steps: | |
- uses: actions/checkout@v4 | |
- run: npm i | |
- name: Prebuild files | |
run: npm run test:prebuild | |
- name: Run c8 coverage | |
run: | | |
echo "LINE_COVERAGE=$(npm run coverage:test:ava | grep -E '^\s*Lines\s*:\s*[0-9]+(\.[0-9]+)?%' | awk '{print $3}' | tr -d '%')" >> $GITHUB_ENV | |
- name: Update coverage badge | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 615b7906cd71effb447c4b08673d2cb6 | |
filename: latch-coverage.json | |
label: Coverage | |
message: ${{ env.LINE_COVERAGE }} | |
valColorRange: ${{ env.LINE_COVERAGE }} | |
maxColorRange: 100 | |
minColorRange: 0 | |