From ca65b9a0bdb9bcd1b4a306f1cd2aef4305a63e2b Mon Sep 17 00:00:00 2001 From: Guilherme Gazzo Date: Wed, 18 Dec 2024 12:41:31 -0300 Subject: [PATCH] ci: compare coverage --- .github/workflows/ci.yml | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29eddbfc..bd4997b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,20 +14,47 @@ on: name: my-workflow jobs: + base_branch_cov: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.base_ref }} + - uses: oven-sh/setup-bun@v2 + + - run: bun install + - run: bun test:coverage + + + - name: Upload code coverage for ref branch + uses: actions/upload-artifact@v3 + with: + name: ref-lcov.info + path: ./coverage/lcov.info + unit-tests: name: Code Quality Checks(lint, test, tsc) runs-on: ubuntu-latest + needs: base_branch_cov steps: # ... - uses: actions/checkout@v4 - uses: oven-sh/setup-bun@v2 - # run any `bun` or `bunx` command - run: bun install - run: bun lint - run: bun tsc - run: bun test:coverage + - name: Download code coverage report from base branch + uses: actions/download-artifact@v3 + with: + name: ref-lcov.info - uses: barecheck/code-coverage-action@v1.0.0 with: barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }} + lcov-file: "./coverage/lcov.info" + base-lcov-file: "./lcov.info" + minimum-ratio: 0 # Fails Github action once code coverage is decreasing + send-summary-comment: true + show-annotations: "warning" # Possible options warning|error