From ec1897489a48f169df9f2ca0ed613c669ec189f0 Mon Sep 17 00:00:00 2001 From: Krzysztof Dyba <35004826+kadyb@users.noreply.github.com> Date: Thu, 7 Nov 2024 00:08:45 +0100 Subject: [PATCH] restore previous test-coverage.yml --- .github/workflows/test-coverage.yml | 72 +++++++++++------------------ 1 file changed, 28 insertions(+), 44 deletions(-) diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml index 09cb2a1..a61ce2d 100644 --- a/.github/workflows/test-coverage.yml +++ b/.github/workflows/test-coverage.yml @@ -1,68 +1,52 @@ +# source: https://github.com/r-lib/actions/blob/master/examples/test-coverage.yaml + # test coverage is skipped for these functions: # geonames_download, geodb_download, borders_download (too large file size) # DEM_request, ortho_request (requests from GitHub are blocked) -# 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 +name: test-coverage + on: push: - branches: [main, master] + branches: [ master ] pull_request: - branches: [main, master] - -name: test-coverage - -permissions: read-all + branches: [ master ] jobs: test-coverage: - runs-on: ubuntu-latest + runs-on: macOS-latest env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - steps: - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::covr, any::xml2 - needs: coverage - - name: Test coverage + - name: Query dependencies run: | - skip_fun = c("geonames_download", "geodb_download", "borders_download", - "DEM_request", "ortho_request", "orto_request") - cov <- covr::package_coverage( - function_exclusions = skip_fun, - quiet = FALSE, - clean = FALSE, - install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") - ) - covr::to_cobertura(cov) + install.packages('remotes') + saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) + writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") shell: Rscript {0} - - uses: codecov/codecov-action@v4 + - name: Cache R packages + uses: actions/cache@v4 with: - fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }} - file: ./cobertura.xml - plugin: noop - disable_search: true - token: ${{ secrets.CODECOV_TOKEN }} + path: ${{ env.R_LIBS_USER }} + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - name: Show testthat output - if: always() + - name: Install dependencies run: | - ## -------------------------------------------------------------------- - find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true - shell: bash + options("pkgType" = "binary") + remotes::install_deps(dependencies = TRUE) + remotes::install_cran("covr") + shell: Rscript {0} - - name: Upload test results - if: failure() - uses: actions/upload-artifact@v4 - with: - name: coverage-test-failures - path: ${{ runner.temp }}/package + - name: Test coverage + run: | + skip_fun = c("geonames_download", "geodb_download", "borders_download", + "DEM_request", "ortho_request", "orto_request") + covr::codecov(function_exclusions = skip_fun) + shell: Rscript {0}