Detailed installation instructions #36
Workflow file for this run
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
# Workflow is triggered on label and check installation on various operating systems | |
# This action is adapted from https://github.com/t4d-gmbh/stubbed_versioning | |
name: Ubuntu Install | |
on: | |
pull_request: | |
types: [ labeled ] | |
env: | |
LABEL_CHECK: 'ubuntuInstall::check' | |
LABEL_SUCCESS: 'ubuntuInstall::passed' | |
LABEL_FAILURE: 'ubuntuInstall::failed' | |
JAGS: '4.3.2' | |
BUILD_LOC: "./build" | |
permissions: | |
packages: read | |
contents: write | |
pull-requests: write | |
repository-projects: write | |
jobs: | |
setup-and-install: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.label.name == 'ubuntuInstall::check' }} | |
name: ubuntu-latest (${{ matrix.config.r }}) | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
R_KEEP_PKG_SOURCE: yes | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {r: 'release'} | |
# - {r: '4.1',} | |
# - {r: 'devel', http-user-agent: 'release'} | |
# - {r: 'oldrel-1',} | |
# - {r: 'oldrel-2',} | |
# - {r: 'oldrel-3',} | |
steps: | |
# - name: prepare fedora | |
# run: | | |
# sudo apt-get -y install wget | |
# sudo apt-get -y install gcc | |
# sudo apt-get -y install gcc-c++ | |
# sudo apt-get -y install gfortran | |
# sudo apt-get -y install lapack* # is needed on fedora server | |
# sudo apt-get -y install blas* | |
# sudo apt-get -y install atlas* | |
- name: install R | |
run: | | |
sudo apt-get -y install r-base | |
- name: install config and build dependencies | |
run: | | |
sudo apt-get -y install pkg-config | |
sudo apt-get -y install cmake | |
sudo apt-get -y install r-cran-devtools | |
# sudo apt-get -y install autoconf | |
- name: fixing folder perms for local lib | |
run: | | |
sudo chown root:adm -R /usr/lib/R | |
sudo chmod g+w -R /usr/lib/R | |
sudo chown root:adm -R /usr/local/lib/R | |
sudo chmod g+w -R /usr/local/lib/R | |
- name: update R packages | |
run: | | |
update.packages(ask = FALSE, checkBuilt = TRUE) | |
shell: Rscript {0} | |
- name: install GSL | |
run: | | |
sudo apt-get -y install libgsl-dev | |
- name: install JAGS | |
run: | | |
sudo apt-get -y install jags | |
- name: install rjags | |
run: | | |
install.packages("rjags", configure.args="--enable-rpath", repos=c(CRAN="https://cran.r-project.org")) | |
library("rjags") | |
shell: Rscript {0} | |
- name: install INLA dependencies | |
run: | | |
sudo apt-get install -y --no-install-recommends libudunits2-dev | |
sudo apt -y install libcurl4-openssl-dev # rCurl for (for INLA) | |
sudo apt-get -y install libssl-dev # s2 package | |
sudo apt-get -y install libproj-dev # sf package | |
sudo apt-get -y install libgdal-dev # terra package | |
- name: install INLA | |
run: | | |
install.packages("INLA", repos = c(CRAN = "https://cran.r-project.org", INLA = "https://inla.r-inla-download.org/R/stable"), dep = TRUE) | |
shell: Rscript {0} | |
- name: installing dependencies from BiocManager | |
run: | | |
if (!requireNamespace("BiocManager", quietly = TRUE)) | |
install.packages("BiocManager", repos=c(CRAN="https://cran.r-project.org")) | |
BiocManager::install("Rgraphviz") | |
BiocManager::install("graph") | |
shell: Rscript {0} | |
- name: install from CRAN | |
run: | | |
install.packages('abn', repos=c(CRAN="https://cran.r-project.org")) | |
library('abn') | |
shell: Rscript {0} | |
- name: install abn from GitHub | |
run: | | |
devtools::install_github("furrer-lab/abn", ref="detailed-installation-instructions", dependencies=c("Depends", "Imports", "LinkingTo"), local=FALSE) | |
shell: Rscript {0} | |
- name: fetch the repository from GitHub | |
uses: actions/checkout@v4 | |
- name: deactivate the renv | |
run: | | |
renv::deactivate() | |
shell: Rscript {0} | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: configure ABN for installation | |
run: | | |
autoconf | |
- name: running testhat | |
run: | | |
devtools::test('./') | |
shell: Rscript {0} | |
- name: build, install and test | |
run: | | |
pkg.name <- "abn" | |
pkg.root <- normalizePath(file.path("./"), mustWork = TRUE) | |
tmp.lib <- tempfile() | |
tmp.out <- tempfile() | |
dir.create(tmp.lib) | |
dir.create(tmp.out) | |
owd <- setwd(tmp.out) | |
devtools::install_deps(pkg.root, upgrade="never", repos=c(CRAN="https://cran.r-project.org")) | |
tools::Rcmd(c("build", pkg.root)) | |
list.files(tmp.out) | |
tools::Rcmd(c("INSTALL", "-l", tmp.lib, "--install-tests", "*.tar.gz")) | |
tools::testInstalledPackage(pkg.name, lib.loc = tmp.lib, types = "tests") | |
list.files(tmp.out, recursive = TRUE) | |
unlink(tmp.out) | |
unlink(tmp.lib) | |
shell: Rscript {0} | |
# - name: running testhat | |
# run: | | |
# devtools::test('./') | |
# shell: Rscript {0} | |
report_Ubuntu_setup: | |
if: ${{ (success() || failure()) }} | |
needs: | |
- setup-and-install | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
repository-projects: write | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check if on demand tasks succeeded | |
run: | | |
gh pr edit ${{ env.EVENT }} --remove-label ${{ env.LABEL_CHECK }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
if [ ${{ needs.setup-and-install.result }} == "success" ]; then | |
gh pr edit ${{ env.EVENT }} --remove-label ${{ env.LABEL_FAILURE }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
gh pr edit ${{ env.EVENT }} --add-label ${{ env.LABEL_SUCCESS }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
echo "### ${{ github.event.label.url }} passed! :rocket:" >> $GITHUB_STEP_SUMMARY | |
exit 0 | |
elif [ ${{ needs.setup-and-install.result }} == "failure" ]; then | |
gh pr edit ${{ env.EVENT }} --remove-label ${{ env.LABEL_SUCCESS }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
gh pr edit ${{ env.EVENT }} --add-label ${{ env.LABEL_FAILURE }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
echo "### ${{ github.event.label.url }} failed!" >> $GITHUB_STEP_SUMMARY | |
exit 1 | |
else | |
gh pr edit ${{ env.EVENT }} --add-label ${{ env.LABEL_CHECK }} --repo ${{ env.OWNER }}/${{ env.REPO }} | |
echo "On demand task outcome was ${{ needs.setup-and-installoutcome }}" | |
fi | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
EVENT: ${{ github.event.number }} # This is either the issue or pr |