From 82cf8cea32fb16d493c40685ed12f5eeebc6048f Mon Sep 17 00:00:00 2001 From: Gabriel Constantino Blain <122354466+gabrielblain@users.noreply.github.com> Date: Tue, 23 Jul 2024 07:04:56 -0300 Subject: [PATCH] Update test-coverage.yaml --- .github/workflows/test-coverage.yaml | 64 ++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 1906e81..d68f8c9 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -1,28 +1,58 @@ -name: Test Coverage +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] -on: [push, pull_request] +name: test-coverage + +permissions: read-all jobs: test-coverage: runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 - - name: Set up R - uses: r-lib/actions/setup-r@v2 + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::covr, any::xml2 + needs: coverage - - name: Install dependencies + - name: Test coverage run: | - install.packages('remotes') - remotes::install_deps(dependencies = TRUE) + cov <- covr::package_coverage( + quiet = FALSE, + clean = FALSE, + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") + ) + covr::to_cobertura(cov) + shell: Rscript {0} - - name: Run tests +- name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + + - name: Show testthat output + if: always() run: | - R CMD build . - R CMD check *tar.gz - - - name: Upload coverage to Codecov - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: Rscript -e 'covr::codecov()' + ## -------------------------------------------------------------------- + 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