refine logic for identifying ctgov version and make it more robust #423
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
# https://github.com/r-lib/actions/tree/master/examples#standard-ci-workflow | |
# | |
# note: update | |
# https://github.com/rfhb/ctrdata/settings/secrets/actions/CACHE_VERSION | |
on: [push, pull_request] | |
name: R-CMD-CHECK-win-macos-duckdb-mongodb-sqlite | |
jobs: | |
R-CMD-check: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: windows-latest, r: 'release'} | |
- {os: macOS-latest, r: 'release'} | |
- {os: macOS-latest, r: 'oldrel'} | |
# error installing dependencies under devel | |
#- {os: macOS-latest, r: 'devel'} | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
AT_HOME: true | |
RSPM: ${{ matrix.config.rspm }} | |
GITHUB_PAT: ${{ secrets.GHPAT }} | |
# https://docs.github.com/en/actions/reference/software-installed-on-github-hosted-runners | |
# includes on macOS 10.15 mongod 4.2.8 and Windows Server 201{6,9}: | |
# Version ServiceName ServiceStatus ServiceStartType | |
# 4.2.8.0 MongoDB Running Automatic | |
# disabled on Windows from August 2022 | |
# https://github.com/actions/runner-images/issues/5949 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
- 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: Cache R packages | |
if: runner.os != 'windows-latest' | |
uses: actions/cache@v1 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('.github/R-version') }}-1- | |
- name: Install dependencies | |
run: | | |
utils::install.packages("DBI") | |
utils::install.packages("duckdb", repos = "https://duckdb.r-universe.dev") | |
remotes::install_github("rfhb/ctrdata") | |
remotes::install_deps(dependencies = TRUE) | |
remotes::install_cran(c("rcmdcheck", "covr")) | |
remotes::install_github("ropensci/nodbi") | |
shell: Rscript {0} | |
- name: Windows install additional dependencies | |
if: runner.os == 'windows-latest' | |
# to install cygwin to provide php, sed, cat etc. | |
run: | | |
ctrdata::installCygwinWindowsDoInstall() | |
shell: Rscript {0} | |
- name: Windows cache additional dependencies | |
if: runner.os == 'windows-latest' | |
uses: actions/cache@v2 | |
with: | |
path: c:\cygwin | |
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | |
- uses: r-lib/actions/setup-pandoc@v1 | |
# - uses: ankane/setup-postgres@v1 | |
# with: | |
# postgres-version: 14 | |
# database: test | |
- name: Test coverage | |
if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release' | |
# covr::codecov() never ends under Windows | |
# covr::codecov() uses environment variable CODECOV_TOKEN | |
run: covr::codecov(quiet = FALSE) | |
shell: Rscript {0} | |
- name: Upload failed check results | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ runner.os }}-r${{ matrix.config.r }}-results | |
path: check |