Skip to content

Commit c7f9398

Browse files
Various fixes on GitHub Actions CI (#3933)
1 parent 4b0e01d commit c7f9398

File tree

2 files changed

+108
-21
lines changed

2 files changed

+108
-21
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88

99
name: R-CMD-check
1010

11+
# Increment this version when we want to clear cache
12+
env:
13+
cache-version: v1
14+
1115
jobs:
1216
R-CMD-check:
1317
runs-on: ${{ matrix.config.os }}
@@ -45,18 +49,6 @@ jobs:
4549

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

48-
- name: Install XQuartz on macOS
49-
if: runner.os == 'macOS'
50-
run: brew cask install xquartz
51-
52-
# To install vdiffr, these three libraries/tools are needed:
53-
# - freetype (already installed, needed by systemfonts)
54-
# - cairo (not installed, needed by gdtools)
55-
# - pkg-config (not installed, needed to set proper build settings)
56-
- name: Install pkg-config and cairo on devel macOS
57-
if: runner.os == 'macOS' && matrix.config.r == 'devel'
58-
run: brew install pkg-config cairo
59-
6052
- name: Query dependencies
6153
run: |
6254
install.packages('remotes')
@@ -68,10 +60,10 @@ jobs:
6860
uses: actions/cache@v1
6961
with:
7062
path: ${{ env.R_LIBS_USER }}
71-
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
72-
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-
63+
key: ${{ env.cache-version }}-${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
64+
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-r-${{ matrix.config.r }}-
7365

74-
- name: Install system dependencies
66+
- name: Install system dependencies on Linux
7567
if: runner.os == 'Linux'
7668
env:
7769
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
@@ -80,6 +72,31 @@ jobs:
8072
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
8173
sudo -s eval "$sysreqs"
8274
75+
- name: Install system dependencies on macOS
76+
if: runner.os == 'macOS'
77+
run: |
78+
# XQuartz is needed by vdiffr
79+
brew cask install xquartz
80+
81+
# To install vdiffr, these three libraries/tools are needed in addition to XQuartz
82+
# - freetype (already installed, needed by systemfonts)
83+
# - cairo (not installed, needed by gdtools)
84+
# - pkg-config (not installed, needed to set proper build settings)
85+
brew install pkg-config cairo
86+
87+
# Since sf dependencies are a bit heavy, install them only when they are needed
88+
SF_NEEDS_UPDATED=$(Rscript -e 'if (!"sf" %in% installed.packages()[,"Package"] || "sf" %in% old.packages()[,"Package"]) cat("yes")')
89+
if [ "${SF_NEEDS_UPDATED}" == "yes" ]; then
90+
brew install udunits gdal
91+
fi
92+
93+
# TODO: Remove this when https://github.com/r-lib/xml2/issues/296 is fixed on CRAN
94+
- name: Install the dev version of xml2 as a workaround
95+
if: runner.os == 'macOS' && matrix.config.r == 'devel'
96+
run: |
97+
remotes::install_github('r-lib/xml2')
98+
shell: Rscript {0}
99+
83100
- name: Install dependencies
84101
run: |
85102
remotes::install_deps(dependencies = TRUE)
@@ -96,9 +113,3 @@ jobs:
96113
with:
97114
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
98115
path: check
99-
100-
# TODO: uncomment this when we fix the failure of covr::codecov()
101-
# - name: Test coverage
102-
# if: matrix.config.os == 'macOS-latest' && matrix.config.r == '3.6'
103-
# run: covr::codecov()
104-
# shell: Rscript {0}

.github/workflows/test-coverage.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
branches:
7+
- master
8+
9+
name: test-coverage
10+
11+
# Increment this version when we want to clear cache
12+
env:
13+
cache-version: v1
14+
15+
jobs:
16+
test-coverage:
17+
runs-on: macOS-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: r-lib/actions/setup-r@master
22+
23+
- uses: r-lib/actions/setup-pandoc@master
24+
25+
- name: Query dependencies
26+
run: |
27+
install.packages('remotes')
28+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
29+
shell: Rscript {0}
30+
31+
- name: Cache R packages
32+
uses: actions/cache@v1
33+
with:
34+
path: ${{ env.R_LIBS_USER }}
35+
key: ${{ env.cache-version }}-macOS-r-3.6-${{ hashFiles('.github/depends.Rds') }}
36+
restore-keys: ${{ env.cache-version }}-macOS-r-3.6-
37+
38+
- name: Install system dependencies on macOS
39+
if: runner.os == 'macOS'
40+
run: |
41+
# XQuartz is needed by vdiffr
42+
brew cask install xquartz
43+
44+
# To install vdiffr, these three libraries/tools are needed in addition to XQuartz
45+
# - freetype (already installed, needed by systemfonts)
46+
# - cairo (not installed, needed by gdtools)
47+
# - pkg-config (not installed, needed to set proper build settings)
48+
brew install pkg-config cairo
49+
50+
# Since sf dependencies are a bit heavy, install them only when they are needed
51+
SF_NEEDS_UPDATED=$(Rscript -e 'if (!"sf" %in% installed.packages()[,"Package"] || "sf" %in% old.packages()[,"Package"]) cat("yes")')
52+
if [ "${SF_NEEDS_UPDATED}" == "yes" ]; then
53+
brew install udunits gdal
54+
fi
55+
56+
# TODO: Remove this when https://github.com/r-lib/xml2/issues/296 is fixed on CRAN
57+
- name: Install the dev version of xml2 as a workaround
58+
if: runner.os == 'macOS' && matrix.config.r == 'devel'
59+
run: |
60+
remotes::install_github('r-lib/xml2')
61+
shell: Rscript {0}
62+
63+
- name: Install dependencies
64+
run: |
65+
install.packages(c("remotes"))
66+
remotes::install_deps(dependencies = TRUE)
67+
remotes::install_cran("covr")
68+
shell: Rscript {0}
69+
70+
# TODO: Remove remotes::install_github() after covr > 3.5.0 is released
71+
# c.f. https://github.com/r-lib/covr/commit/cc710804aeff6f337777465bf902914197c0b713
72+
- name: Test coverage
73+
run: |
74+
remotes::install_github("r-lib/covr")
75+
covr::codecov()
76+
shell: Rscript {0}

0 commit comments

Comments
 (0)