[pre-commit.ci] pre-commit autoupdate #7
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
# Run CI for R using https://eddelbuettel.github.io/r-ci/ | |
name: check | |
on: | |
push: | |
branches: [main, master] | |
pull_request: | |
branches: [main, master] | |
env: | |
USE_BSPM: "true" | |
_R_CHECK_FORCE_SUGGESTS_: "false" | |
NO_BINARY_INSTALL_R_PACKAGES: 'c("madrat", "magclass", "citation", "gms", "goxygen", "GDPuc", "roxygen2")' | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Bootstrap | |
run: | | |
sudo chown runner -R . | |
sudo locale-gen en_US.UTF-8 | |
sudo add-apt-repository -y ppa:ubuntugis/ppa | |
curl -OLs https://eddelbuettel.github.io/r-ci/run.sh | |
chmod 0755 run.sh | |
./run.sh bootstrap | |
rm -f bspm_*.tar.gz | |
- name: Enable r-universe repo, modify bspm integration | |
run: | | |
# install packages from https://pik-piam.r-universe.dev and CRAN | |
echo ' | |
options(repos = c(universe = "https://pik-piam.r-universe.dev", | |
CRAN = "https://cloud.r-project.org")) | |
' >> .Rprofile | |
cat .Rprofile | |
# modify bspm integration to never install binary builds of PIK CRAN packages | |
sudo sed -i '/bspm::enable()/d' /etc/R/Rprofile.site | |
# need double % because of printf, %s is replaced with "$NO_BINARY_INSTALL_R_PACKAGES" (see "env:" above) | |
printf ' | |
local({ | |
expr <- quote({ | |
if (!is.null(repos)) { | |
noBinaryInstallRPackages <- %s | |
pkgs <- c(bspm::install_sys(pkgs[!pkgs %%in%% noBinaryInstallRPackages]), | |
pkgs[pkgs %%in%% noBinaryInstallRPackages]) | |
} | |
type <- "source" | |
}) | |
trace(utils::install.packages, expr, print = FALSE) | |
}) | |
' "$NO_BINARY_INSTALL_R_PACKAGES" | sudo tee --append /etc/R/Rprofile.site >/dev/null | |
cat /etc/R/Rprofile.site | |
- name: Set up Pandoc | |
uses: r-lib/actions/setup-pandoc@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Cache R libraries | |
if: ${{ !env.ACT }} # skip when running locally via nektos/act | |
uses: pat-s/always-upload-cache@v3 | |
with: | |
path: /usr/local/lib/R/ | |
key: 3-${{ runner.os }}-usr-local-lib-R-${{ hashFiles('DESCRIPTION') }} | |
restore-keys: | | |
3-${{ runner.os }}-usr-local-lib-R- | |
- name: Restore R library permissions | |
run: | | |
sudo chmod 2777 /usr/local/lib/R /usr/local/lib/R/site-library | |
- name: Install dependencies | |
run: | | |
./run.sh install_aptget libhdf5-dev libharfbuzz-dev libfribidi-dev | |
./run.sh install_all | |
./run.sh install_r_binary covr rstudioapi | |
./run.sh install_r lucode2 | |
- name: Install python dependencies if applicable | |
run: | | |
[ -f requirements.txt ] && python -m pip install --upgrade pip wheel || true | |
[ -f requirements.txt ] && pip install -r requirements.txt || true | |
- name: Remove bspm integration # to get rid of error when running install.packages | |
run: | | |
sudo sed -i '/ trace(utils::install.packages, expr, print = FALSE)/d' /etc/R/Rprofile.site | |
cat /etc/R/Rprofile.site | |
- name: Verify validation key | |
shell: Rscript {0} | |
run: lucode2:::validkey(stopIfInvalid = TRUE) | |
- name: Checks | |
shell: Rscript {0} | |
run: | | |
options(crayon.enabled = TRUE) | |
lucode2::check(runLinter = FALSE) | |
- name: Test coverage | |
shell: Rscript {0} | |
run: covr::codecov(quiet = FALSE) | |
env: | |
NOT_CRAN: "true" |