diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 601f647..0f2fe08 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,113 +1,52 @@ -# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. -# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +# 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 - - pre-release + branches: [main, master] pull_request: - branches: - - main - - master - - pre-release + branches: [main, master] name: R-CMD-check +permissions: read-all + jobs: R-CMD-check: - runs-on: ${{ matrix.os }} - name: ${{ matrix.os }} (R ${{ matrix.r }}) + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) strategy: fail-fast: false matrix: - r: ['4.3.3'] - os: [ubuntu-latest, macOS-latest, windows-latest] + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - R_REMOTES_UPGRADE: never - VDIFFR_RUN_TESTS: true GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - _R_CHECK_LENGTH_1_CONDITION_: TRUE #deprecated from R 4.2.0 - _R_CHECK_MATRIX_DATA_: TRUE # only works from R 4.2.0 onwards + R_KEEP_PKG_SOURCE: yes steps: - uses: actions/checkout@v4 + - uses: r-lib/actions/setup-pandoc@v2 + - uses: r-lib/actions/setup-r@v2 with: - r-version: ${{ matrix.r }} - - - name: Install system dependencies on macOS - if: runner.os == 'macOS' - run: | - # see https://github.com/orgs/Homebrew/discussions/4612 - unset HOMEBREW_NO_INSTALL_FROM_API - brew update - brew install --cask xquartz - brew install libarchive - shell: bash - - - name: Install system dependencies on macOS specific to R devel - if: runner.os == 'macOS' && matrix.r == 'devel' - run: | - # ragg requires harfbuzz fribidi - # The dependencies of the two R packages below are required for compiling from source on Ubuntu, but macOS seems fine without them - # credentials (dependency of usethis) requires libgit2 - # curl (dependency of usethis) requires openssl - - brew install harfbuzz fribidi libgit2 openssl curl - shell: bash + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true - - name: Install system dependencies on linux - if: runner.os == 'Linux' - run: | - # ragg requires libharfbuzz-dev libfribidi-dev - # credentials (dependency of usethis) requires libgit2-dev - # curl (dependency of usethis) requires libcurl4-openssl-dev - # libicu (dependency of igraph or stringi...) requires libicu libicu-dev - - sudo apt install libharfbuzz-dev libfribidi-dev libgit2-dev libcurl4-openssl-dev libicu* - shell: bash - - - name: Install dependencies - run: | - install.packages("remotes") - remotes::install_deps(dependencies = TRUE) - remotes::install_cran("rcmdcheck") - shell: Rscript {0} - - - name: Check - if: runner.os != 'Windows' - env: - _R_CHECK_CRAN_INCOMING_REMOTE_: false - run: | - options(crayon.enabled = TRUE) - rcmdcheck::rcmdcheck( - args = c("--no-manual", "--as-cran", "--ignore-vignettes"), - build_args = c("--no-build-vignettes"), - error_on = "warning", - check_dir = "check") - shell: Rscript {0}" - - - name: Check - if: runner.os == 'Windows' - env: - _R_CHECK_CRAN_INCOMING_REMOTE_: false - run: | - options(crayon.enabled = TRUE) - rcmdcheck::rcmdcheck( - args = c("--no-manual", "--as-cran", "--ignore-vignettes"), - build_args = c("--no-build-vignettes"), - error_on = "warning", - check_dir = "check") - shell: Rscript {0} + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check - - name: Upload check results - if: failure() - uses: actions/upload-artifact@main + - uses: r-lib/actions/check-r-package@v2 with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/.github/workflows/R-CMD-tests.yaml b/.github/workflows/R-CMD-tests.yaml index d2682c1..81c0b8d 100644 --- a/.github/workflows/R-CMD-tests.yaml +++ b/.github/workflows/R-CMD-tests.yaml @@ -1,19 +1,15 @@ -# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. -# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +# 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 - - pre-release + branches: [main, master] pull_request: - branches: - - main - - master - - pre-release + branches: [main, master] name: R-CMD-tests +permissions: read-all + jobs: R-CMD-check: runs-on: ${{ matrix.config.os }} @@ -24,45 +20,31 @@ jobs: fail-fast: false matrix: config: + - {os: macos-latest, r: 'release'} - {os: windows-latest, r: 'release'} - - {os: macOS-latest, r: 'release'} - - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - RSPM: ${{ matrix.config.rspm }} GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 - uses: r-lib/actions/setup-r@v2 with: r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true - - uses: r-lib/actions/setup-pandoc@v2 - - - name: Query dependencies - run: | - 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} - - - name: Restore R package cache - uses: actions/cache@v2 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - 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: Install system dependencies - if: runner.os == 'Linux' - run: | - while read -r cmd - do - eval sudo $cmd - + extra-packages: any::rcmdcheck + needs: check - name: Install and test z-curve (non-Windows) env: diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 0000000..fefc52e --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,61 @@ +# 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: + branches: [main, master] + +name: test-coverage + +permissions: read-all + +jobs: + test-coverage: + runs-on: ubuntu-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-r-dependencies@v2 + with: + extra-packages: any::covr, any::xml2 + needs: coverage + + - name: Test coverage + run: | + cov <- covr::package_coverage( + quiet = FALSE, + clean = FALSE, + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") + ) + covr::to_cobertura(cov) + shell: Rscript {0} + + - uses: codecov/codecov-action@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 }} + + - 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