test: post coverage to summary #437
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: Coverage | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- run: git fetch --no-tags --depth=1 origin main | |
- name: Set up Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.17 | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: "${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}" | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- uses: jongwooo/next-cache@v1 | |
name: Cache App Build | |
- name: Install dependencies | |
run: npm install | |
- name: Run the tests | |
run: npm run test:cover:changed | |
# - name: Upload coverage to Codecov | |
# uses: codecov/codecov-action@v1 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# fail_ci_if_error: true | |
# - name: Upload coverage to Code Climate | |
# if: always() | |
# uses: paambaati/[email protected] | |
# env: | |
# CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }} | |
# with: | |
# coverageLocations: ./coverage/lcov.info:lcov | |
- name: Code Coverage Summary Report | |
uses: irongut/[email protected] | |
with: | |
filename: './coverage/cobertura-coverage.xml' | |
badge: true | |
format: 'markdown' | |
output: 'both' | |
- name: Add Coverage PR Comment | |
uses: marocchino/sticky-pull-request-comment@v2 | |
if: github.event_name == 'pull_request' | |
with: | |
recreate: true | |
path: code-coverage-results.md | |
- name: Write to Job Summary | |
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY |