Skip to content

declaring environment for python build #35

declaring environment for python build

declaring environment for python build #35

# 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:
name: test-coverage.yaml
permissions: read-all
jobs:
test-coverage:
runs-on: ubuntu-latest
timeout-minutes: 90
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# Tell basilisk to store environments in a shared, cacheable directory
BASILISK_USE_SYSTEM_DIR: 1
steps:
- 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: Cache basilisk Python environments
uses: actions/cache@v4
with:
path: |
~/.cache/R/basilisk
~/.local/share/R/basilisk
key: basilisk-${{ runner.os }}-${{ hashFiles('R/basilisk.R') }}
restore-keys: |
basilisk-${{ runner.os }}-
- name: Pre-build basilisk environment
run: |
cat("--- Pre-building immLynxEnv ---\n")
source("R/basilisk.R")
tryCatch({
proc <- basilisk::basiliskStart(immLynxEnv)
basilisk::basiliskStop(proc)
cat("immLynxEnv: OK\n")
}, error = function(e) {
warning("immLynxEnv FAILED: ", conditionMessage(e),
"\nPython-dependent tests will be SKIPPED!")
})
shell: Rscript {0}
- name: Test coverage
run: |
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
print(cov)
covr::to_cobertura(cov)
shell: Rscript {0}
- 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