TEST@main #43
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: TEST | |
run-name: 'TEST@${{github.ref_name}}' | |
on: | |
workflow_call: | |
push: | |
branches: | |
- main | |
paths: | |
- '*' | |
- src/** | |
- '!**.md' | |
concurrency: | |
group: test-${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
test: | |
name: Test & build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
node-version: [20.x] | |
steps: | |
- uses: mato533/cicd-actions/setup-pnpm@main | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Type check | |
run: pnpm run typecheck | |
- name: Run the test | |
run: pnpm run test | |
- name: Build | |
run: pnpm run build | |
coverage: | |
name: Report Coverage | |
runs-on: ubuntu-latest | |
if: ${{ success() || failure() }} | |
needs: | |
- test | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Setup node environments | |
uses: mato533/cicd-actions/setup-pnpm@main | |
with: | |
cache: 'pnpm' | |
- name: Run tests with coverage | |
id: test | |
env: | |
TEST_RESULT: 'coverage/junit.xml' | |
run: | | |
pnpm exec vitest run --coverage \ | |
--coverage.reportOnFailure \ | |
--coverage.reporter=json-summary \ | |
--coverage.reporter=json \ | |
--coverage.reporter=clover \ | |
--reporter=default | |
- name: Upload coverage report to the code climate | |
uses: paambaati/codeclimate-action@v9 | |
if: ${{ github.event_name == 'push' }} | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
with: | |
coverageLocations: ${{ github.workspace }}/coverage/clover.xml:clover | |
- name: Write coverage report to pull request | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: davelosert/vitest-coverage-report-action@v2 |