feat: test badge #54
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: Unit Test | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: [utils] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install dependencies | |
run: pnpm install --no-frozen-lockfile | |
- name: Run tests with coverage | |
run: | | |
cd packages/${{ matrix.package }} | |
pnpm run test:coverage | |
- name: Uploada coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: packages/${{ matrix.package }}/coverage/lcov.info | |
flags: unittests | |
name: codecov-umbrella | |
- name: Update Coverage Badge | |
# GitHub actions: default branch variable | |
# https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable | |
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
uses: we-cli/coverage-badge-action@main | |