Skip to content

Various fixes on GitHub Actions CI #3933

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

53 changes: 32 additions & 21 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:

name: R-CMD-check

# Increment this version when we want to clear cache
env:
cache-version: v1

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
Expand Down Expand Up @@ -45,18 +49,6 @@ jobs:

- uses: r-lib/actions/setup-pandoc@master

- name: Install XQuartz on macOS
if: runner.os == 'macOS'
run: brew cask install xquartz

# To install vdiffr, these three libraries/tools are needed:
# - freetype (already installed, needed by systemfonts)
# - cairo (not installed, needed by gdtools)
# - pkg-config (not installed, needed to set proper build settings)
- name: Install pkg-config and cairo on devel macOS
if: runner.os == 'macOS' && matrix.config.r == 'devel'
run: brew install pkg-config cairo

- name: Query dependencies
run: |
install.packages('remotes')
Expand All @@ -68,10 +60,10 @@ jobs:
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-
key: ${{ env.cache-version }}-${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-r-${{ matrix.config.r }}-

- name: Install system dependencies
- name: Install system dependencies on Linux
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
Expand All @@ -80,6 +72,31 @@ jobs:
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"

- name: Install system dependencies on macOS
if: runner.os == 'macOS'
run: |
# XQuartz is needed by vdiffr
brew cask install xquartz

# To install vdiffr, these three libraries/tools are needed in addition to XQuartz
# - freetype (already installed, needed by systemfonts)
# - cairo (not installed, needed by gdtools)
# - pkg-config (not installed, needed to set proper build settings)
brew install pkg-config cairo

# Since sf dependencies are a bit heavy, install them only when they are needed
SF_NEEDS_UPDATED=$(Rscript -e 'if (!"sf" %in% installed.packages()[,"Package"] || "sf" %in% old.packages()[,"Package"]) cat("yes")')
if [ "${SF_NEEDS_UPDATED}" == "yes" ]; then
brew install udunits gdal
fi

# TODO: Remove this when https://github.com/r-lib/xml2/issues/296 is fixed on CRAN
- name: Install the dev version of xml2 as a workaround
if: runner.os == 'macOS' && matrix.config.r == 'devel'
run: |
remotes::install_github('r-lib/xml2')
shell: Rscript {0}

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
Expand All @@ -96,9 +113,3 @@ jobs:
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check

# TODO: uncomment this when we fix the failure of covr::codecov()
# - name: Test coverage
# if: matrix.config.os == 'macOS-latest' && matrix.config.r == '3.6'
# run: covr::codecov()
# shell: Rscript {0}
76 changes: 76 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
on:
push:
branches:
- master
pull_request:
branches:
- master

name: test-coverage

# Increment this version when we want to clear cache
env:
cache-version: v1

jobs:
test-coverage:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master

- uses: r-lib/actions/setup-pandoc@master

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v1
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ env.cache-version }}-macOS-r-3.6-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ env.cache-version }}-macOS-r-3.6-

- name: Install system dependencies on macOS
if: runner.os == 'macOS'
run: |
# XQuartz is needed by vdiffr
brew cask install xquartz

# To install vdiffr, these three libraries/tools are needed in addition to XQuartz
# - freetype (already installed, needed by systemfonts)
# - cairo (not installed, needed by gdtools)
# - pkg-config (not installed, needed to set proper build settings)
brew install pkg-config cairo

# Since sf dependencies are a bit heavy, install them only when they are needed
SF_NEEDS_UPDATED=$(Rscript -e 'if (!"sf" %in% installed.packages()[,"Package"] || "sf" %in% old.packages()[,"Package"]) cat("yes")')
if [ "${SF_NEEDS_UPDATED}" == "yes" ]; then
brew install udunits gdal
fi

# TODO: Remove this when https://github.com/r-lib/xml2/issues/296 is fixed on CRAN
- name: Install the dev version of xml2 as a workaround
if: runner.os == 'macOS' && matrix.config.r == 'devel'
run: |
remotes::install_github('r-lib/xml2')
shell: Rscript {0}

- name: Install dependencies
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
shell: Rscript {0}

# TODO: Remove remotes::install_github() after covr > 3.5.0 is released
# c.f. https://github.com/r-lib/covr/commit/cc710804aeff6f337777465bf902914197c0b713
- name: Test coverage
run: |
remotes::install_github("r-lib/covr")
covr::codecov()
shell: Rscript {0}