test coverage #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test coverage | |
on: | |
workflow_dispatch: | |
jobs: | |
test-coverage: | |
runs-on: ubuntu-latest | |
# env: | |
# RENV_CONFIG_PAK_ENABLED: true | |
# with above uncommented, the workflow fails with the following error: | |
# Error in remote(function(...) get("pkg_install_make_plan", asNamespace("pak"))(...), | |
defaults: | |
run: | |
working-directory: phenoRankeR | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgit2-dev libsqliteodbc | |
- name: Create custom odbcinst.ini in a user-accessible directory | |
run: | | |
echo "[SQLite]" >> $HOME/odbcinst.ini | |
echo "Driver=/usr/lib/x86_64-linux-gnu/odbc/libsqlite3odbc.so" >> $HOME/odbcinst.ini | |
- name: Install R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: "4.3.3" | |
use-public-rspm: true | |
- name: Install R packages | |
uses: r-lib/actions/setup-renv@v2 | |
with: | |
cache-version: 1 | |
working-directory: phenoRankeR | |
env: | |
RENV_CONFIG_REPOS_OVERRIDE: ${{ env.RSPM }} | |
- name: Test coverage | |
shell: Rscript {0} | |
run: | | |
covr::to_cobertura( | |
covr:package_coverage( | |
quiet = FALSE, | |
clean = FALSE, | |
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") | |
) | |
) | |
env: | |
ODBCSYSINI: /home/runner | |
DB_DRIVER: SQLite | |
DB_NAME: ":memory:" | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ${{ runner.temp }}/package/cobertura.xml | |
- 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 |