From 625b7d8a40e3d54a4191d70f7dc41f7691c717ea Mon Sep 17 00:00:00 2001 From: rafapereirabr Date: Mon, 16 Sep 2024 15:25:21 -0300 Subject: [PATCH] coverage from gtfstools --- .github/workflows/test-coverage.yaml | 60 ++++++++++++++++------------ 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 2c5bb50..aa01bff 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -1,50 +1,58 @@ # 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] + branches: + - main + - master pull_request: - branches: [main, master] + branches: + - main + - master name: test-coverage jobs: test-coverage: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: + RSPM: https://packagemanager.rstudio.com/cran/__linux__/jammy/latest GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true + id: install-r + + - name: Install pak and query dependencies + run: | + install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") + saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds") + shell: Rscript {0} - - uses: r-lib/actions/setup-r-dependencies@v2 + - name: Restore R package cache + uses: actions/cache@v2 with: - extra-packages: any::covr - needs: coverage + path: | + ${{ env.R_LIBS_USER }}/* + !${{ env.R_LIBS_USER }}/pak + key: ubuntu-22.04-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }} + restore-keys: ubuntu-22.04-${{ steps.install-r.outputs.installed-r-version }}-1- - - name: Test coverage + - name: Install system dependencies run: | - covr::codecov( - quiet = FALSE, - clean = FALSE, - install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") - ) + pak::local_system_requirements(execute = TRUE) + pak::pkg_system_requirements("covr", execute = TRUE) shell: Rscript {0} - - name: Show testthat output - if: always() + - name: Install dependencies run: | - ## -------------------------------------------------------------------- - find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true - shell: bash + pak::local_install_dev_deps(upgrade = TRUE) + pak::pkg_install("covr") + shell: Rscript {0} - - name: Upload test results - if: failure() - uses: actions/upload-artifact@v3 - with: - name: coverage-test-failures - path: ${{ runner.temp }}/package + - name: Test coverage + run: covr::codecov(quiet = FALSE) + shell: Rscript {0}