Skip to content

Detailed installation instructions #42

Detailed installation instructions

Detailed installation instructions #42

# 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: 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
- 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 libgeos-dev # terra 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 from GitHub
run: |
devtools::install_github("furrer-lab/abn", ref="detailed-installation-instructions", dependencies=c("Depends", "Imports", "LinkingTo"), local=FALSE)
library('abn')
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: install from source
run: |
devtools::install_deps(pkg = '.', dependencies = TRUE, upgrade='never')
devtools::build(pkg = '.', path = '${{ env.BUILD_LOC }}/abn.tar.gz')
install.packages('${{ env.BUILD_LOC }}/abn.tar.gz', repos=NULL, type="source")
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