covr activated for dev branch #64
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
# 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 | |
- 'dev/*' | |
pull_request: | |
branches: | |
- main | |
- 'dev/*' | |
workflow_dispatch: | |
name: test-coverage | |
jobs: | |
test-coverage: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
# Set the GitHub username and email for commits | |
- name: Set GitHub user | |
run: | | |
git config --global user.name "RPACT GitHub Action CovR" | |
git config --global user.email "info@rpact.com" | |
- name: Checkout this package repository | |
uses: actions/checkout@v4 | |
- name: Checkout the private tests repository | |
uses: actions/checkout@v4 | |
with: | |
repository: 'rpact-com/rpact.tests' | |
ref: main | |
token: ${{ secrets.RPACT_TESTS_ACCESS_TOKEN }} | |
path: 'private-tests' | |
sparse-checkout: | | |
tests | |
- 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: Add private tests | |
run: | | |
find ./private-tests/tests -maxdepth 1 -name \*.R -exec cp {} ./tests \; | |
find ./private-tests/tests/testthat -maxdepth 1 -name \*.R -exec cp {} ./tests/testthat \; | |
shell: bash | |
- name: Test coverage | |
run: | | |
Sys.setenv("RPACT_COMPLETE_UNIT_TEST_SET_ENABLED" = TRUE) | |
covr::codecov( | |
quiet = FALSE, | |
clean = FALSE, | |
token = Sys.getenv("CODECOV_TOKEN"), | |
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") | |
) | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
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@v4 | |
with: | |
name: coverage-test-failures | |
path: ${{ runner.temp }}/package | |