From 7b18f09cd20ff46f4b9ea5ba395a6fe7d7206bef Mon Sep 17 00:00:00 2001 From: Ivo Leist Date: Fri, 22 Mar 2024 23:52:05 +0100 Subject: [PATCH] added test-coverage --- .github/workflows/R-CMD-check.yml | 2 +- .github/workflows/test-coverage.yml | 68 +++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-coverage.yml diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index aebc4b9..15fc2af 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -33,7 +33,7 @@ jobs: r-version: "4.3.3" use-public-rspm: true - - name: Install dependencies + - name: Install R packages uses: r-lib/actions/setup-renv@v2 with: cache-version: 1 diff --git a/.github/workflows/test-coverage.yml b/.github/workflows/test-coverage.yml new file mode 100644 index 0000000..3d3850a --- /dev/null +++ b/.github/workflows/test-coverage.yml @@ -0,0 +1,68 @@ +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"))(...), + + 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 + run: | + covr::codecov( + quiet = FALSE, + clean = FALSE, + install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") + ) + shell: Rscript {0} + + - 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@v3 + with: + name: coverage-test-failures + path: ${{ runner.temp }}/package + + + + +