Skip to content

Commit 08398a9

Browse files
committed
Cleanup GHA CI script
1 parent a6911e9 commit 08398a9

File tree

2 files changed

+32
-69
lines changed

2 files changed

+32
-69
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Do not convert line-endings on Windows
2+
* text eol=lf

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

Lines changed: 30 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
# Action script of tests conducted for all platforms. The complete suite
2-
# of tests is described in .github/workflows/R-CMD-check-with-db.yaml
3-
1+
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
2+
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
43
on:
54
push:
65
pull_request:
7-
branches:
8-
- master
96

107
name: R-CMD-check
118

@@ -19,100 +16,64 @@ jobs:
1916
fail-fast: false
2017
matrix:
2118
config:
22-
# - {os: windows-latest, r: '3.6'}
23-
- {os: macOS-latest, r: '3.6', args: '--install-args=\"--configure-args=--with-proj-lib=/usr/local/lib/\"", "--ignore-vignettes', build_args: "--no-build-vignettes"}
24-
- {os: macOS-latest, r: 'devel', args: '--install-args=\"--configure-args=--with-proj-lib=/usr/local/lib/\"", "--ignore-vignettes', build_args: "--no-build-vignettes"}
25-
- {os: ubuntu-16.04, r: '3.5', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
26-
- {os: ubuntu-16.04, r: '3.6', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"}
27-
# - {os: ubuntu-latest, r: 'release'}
19+
- {os: windows-latest, r: 'release'}
20+
- {os: macOS-latest, r: 'release'}
21+
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
22+
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", http-user-agent: "R/4.1.0 (ubuntu-20.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
2823

2924
env:
3025
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
31-
CRAN: ${{ matrix.config.cran }}
26+
RSPM: ${{ matrix.config.rspm }}
27+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3228

3329
steps:
34-
- uses: actions/checkout@v1
30+
- uses: actions/checkout@v2
3531

36-
- uses: r-lib/actions/setup-r@master
32+
- uses: r-lib/actions/setup-r@v1
3733
with:
3834
r-version: ${{ matrix.config.r }}
3935

40-
- uses: r-lib/actions/setup-pandoc@master
41-
42-
- name: Brew and macOS config
43-
if: runner.os == 'macOS'
44-
run: |
45-
brew install pkg-config
46-
brew install udunits
47-
brew install gdal
48-
cat <<EOT >> .Renviron
49-
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
50-
PROJ_LIB=/usr/local/opt/proj/share/proj/
51-
# for installing XML package from source
52-
XML_CONFIG=/usr/local/opt/libxml2/bin/xml2-config
53-
EOT
54-
cat <<EOT >> .Rprofile
55-
config_args <- c("lwgeom" = "--with-proj-lib=/usr/local/lib/", "rgdal" = "--with-proj-lib=/usr/local/lib/ --with-proj-include=/usr/local/include/")
56-
r <- getOption("repos")
57-
r["CRAN"] <- "https://cran.rstudio.com"
58-
options(configure.args = config_args, repos = r)
59-
EOT
60-
6136
- name: Query dependencies
6237
run: |
6338
install.packages('remotes')
64-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "depends.Rds", version = 2)
39+
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
40+
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
6541
shell: Rscript {0}
6642

67-
- name: Cache R packages
68-
if: runner.os != 'Windows'
69-
uses: actions/cache@v1
43+
- name: Restore R package cache
44+
uses: actions/cache@v2
7045
with:
7146
path: ${{ env.R_LIBS_USER }}
72-
key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
73-
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-
47+
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
48+
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
7449

75-
- name: Install system dependencies
50+
- name: Install system dependencies (Linux)
7651
if: runner.os == 'Linux'
77-
env:
78-
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
7952
run: |
80-
Rscript -e "remotes::install_github('r-hub/sysreqs')"
81-
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
82-
sudo -s eval "$sysreqs"
83-
84-
# install spatial dependencies
85-
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
86-
sudo apt update
87-
sudo apt install \
88-
libudunits2-dev \
89-
libgdal-dev \
90-
libgeos-dev \
91-
libproj-dev
92-
53+
sudo apt-get update
54+
sudo apt-get install -y libudunits2-dev libgdal-dev libgeos-dev libproj-dev
55+
56+
- name: Install system dependencies (MacOS)
57+
if: runner.os == 'MacOS'
58+
run: brew install gdal proj udunits pkg-config
9359

9460
- name: Install dependencies
9561
run: |
96-
library(remotes)
97-
deps <- readRDS("depends.Rds")
98-
deps[["installed"]] <- vapply(deps[["package"]], remotes:::local_sha, character(1))
99-
update(deps)
62+
remotes::install_deps(dependencies = TRUE)
10063
remotes::install_cran("rcmdcheck")
10164
shell: Rscript {0}
10265

103-
- name: Install rgdal with configure
104-
if: runner.os == 'macOS'
105-
run: |
106-
install.packages("rgdal", type = "source", configure.args = "--with-proj-lib=/usr/local/lib/ --with-proj-include=/usr/local/include/")
107-
shell: Rscript {0}
108-
10966
- name: Check
110-
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "${{ matrix.config.args }}"), error_on = "warning", check_dir = "check", build_args = "${{ matrix.config.build_args }}")
67+
env:
68+
_R_CHECK_CRAN_INCOMING_REMOTE_: false
69+
run: |
70+
options(crayon.enabled = TRUE)
71+
rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "warning", check_dir = "check")
11172
shell: Rscript {0}
11273

11374
- name: Upload check results
11475
if: failure()
115-
uses: actions/upload-artifact@master
76+
uses: actions/upload-artifact@main
11677
with:
11778
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
11879
path: check

0 commit comments

Comments
 (0)