ci: setup semantic release #77
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 Tests | |
on: | |
workflow_call: | |
push: | |
branches: [main] | |
pull_request: | |
types: [ | |
synchronize, # PR was updated | |
opened, # PR was open | |
reopened, # PR was closed and is now open again | |
ready_for_review, # PR was converted from draft to open | |
] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
unit_tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'pnpm' | |
- name: Install Dependencies | |
run: pnpm install --frozen-lockfile --ignore-scripts | |
- name: Run Unit Tests | |
run: pnpm coverage | |
- name: Coveralls | |
uses: coverallsapp/github-action@v2 | |
if: github.event_name != 'workflow_call' | |
- name: Run Mutation Tests and Publish to Dashboard | |
if: github.event_name != 'workflow_call' && github.event_name != 'pull_request' | |
env: | |
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} | |
run: pnpm test:mutation | |
- name: Run Unit Test Against Package | |
# pnpm has a bug with pack script /~https://github.com/pnpm/pnpm/issues/4351 | |
run: | | |
cd packages/gerador-validador-cpf | |
pnpm pack | |
tar zxvf *.tgz | |
cd ../../ | |
pnpm test:package |