diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a6047b69..a95618ca6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,11 +51,25 @@ jobs: uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - name: Run tests + # push on main, or pull request in different repos, + # eg from contributor/Tuxedo to Off-Narrative-Labs/Tuxedo + - if: github.event_name == 'push' || + (github.event_name == 'pull_request' && + github.event.pull_request.base.repo != github.event.pull_request.head.repo) + name: Run tests and print coverage data + run: cargo llvm-cov nextest --json + --ignore-filename-regex "node/" + --output-path lcov.json && + jq ".data[0].totals.lines.percent" lcov.json + # pull request in the same repo, able to report coverage using comment on PR + - if: github.event_name == 'pull_request' && + github.event.pull_request.base.repo == github.event.pull_request.head.repo + name: Run tests and collect coverage data run: cargo llvm-cov nextest --lcov --ignore-filename-regex "node/" --output-path lcov.info - - if: github.event_name == 'pull_request' + - if: github.event_name == 'pull_request' && + github.event.pull_request.base.repo == github.event.pull_request.head.repo name: Report code coverage uses: Nef10/lcov-reporter-action@v0.4.0 with: