Skip to content

Update Test-coverage.yaml #1092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 55 additions & 14 deletions .github/workflows/Test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# Github Actions workflow to analyze CmdStanR code, test coverage
# yamllint disable rule:line-length

name: Test coverage

'on':
on:
push:
branches:
- master
pull_request:
branches:
- master

name: Test coverage

permissions: read-all

jobs:
test-coverage:
Expand Down Expand Up @@ -38,16 +38,18 @@ jobs:
- uses: n1hility/cancel-previous-runs@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
workflow: Test-coverage.yml
workflow: Test-coverage.yaml
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master'"

- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2.11.3
- uses: r-lib/actions/setup-pandoc@v2.11.3
- uses: r-lib/actions/setup-r@v2
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r-dependencies@v2.11.3
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck, local::., any::covr, any::gridExtra
extra-packages: any::rcmdcheck, local::., any::covr, any::gridExtra, any::xml2
needs: coverage

- name: Install cmdstan
run: |
Expand All @@ -57,16 +59,55 @@ jobs:

- name: Test coverage (Linux)
if: runner.os == 'Linux'
run: covr::codecov(type = "tests")
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package"),
type = "tests"
)
print(cov)
covr::to_cobertura(cov)
shell: Rscript {0}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Test coverage (Windows)
if: runner.os == 'Windows'
run: |
options(covr.gcov = 'C:/rtools44/mingw64/bin/gcov.exe');
covr::codecov(type = "tests", function_exclusions = "sample_mpi")
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package"),
type = "tests",
function_exclusions = "sample_mpi"
)
print(cov)
covr::to_cobertura(cov)
shell: Rscript {0}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- uses: codecov/codecov-action@v5
with:
# Fail if error if not on PR, or if on PR and token is given
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
files: ./cobertura.xml
plugins: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package