diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 282af70..4d4f25d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,9 @@ on: push: branches: [ main ] +permissions: + contents: read + jobs: ci: name: CI @@ -23,9 +26,35 @@ jobs: - run: make typecheck - name: Start ClickHouse run: docker compose up --detach --wait clickhouse - - run: make test - - name: Check Coverage - uses: 5monkeys/cobertura-action@v14 + - run: make test opts='--cov-fail-under=100' + - name: Upload coverage report + if: always() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 + with: + name: coverage-report + path: coverage.xml + + coverage: + name: Coverage report + needs: ci + # Only for PRs from this repository: fork PRs get a read-only token. Runs no PR code. + if: ${{ !cancelled() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }} + runs-on: ubuntu-latest + permissions: + pull-requests: write # Post the coverage report comment on the PR + checks: write # 5monkeys/cobertura-action also creates a check run + steps: + - name: Download coverage report + id: download + # No report if the test job failed before running pytest; skip reporting then. + continue-on-error: true + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: coverage-report + + - name: Report Coverage + if: steps.download.outcome == 'success' + uses: 5monkeys/cobertura-action@ee5787cc56634acddedc51f21c7947985531e6eb # v14 with: minimum_coverage: 100 fail_below_threshold: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index de00174..ae0e860 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,6 +5,9 @@ on: tags: - '*' +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest