Skip to content

Release1.4

Release1.4 #352

Workflow file for this run

on:
push:
branches:
- master
- develop
- testing
pull_request:
branches:
- master
- develop
- testing
name: R-CMD-check
jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
# We include 'next' in order to always test the latest patched release, but mac and Windows binaries are not deployed to the drat repo:
strategy:
fail-fast: false
matrix:
config:
# for windows and mac all builds are pushed to drat repo on merge to master (except pre-release builds), except 'next'
- {os: macOS-latest, r: 'next', pkgext: '.tgz'} # will be tested without suggests
- {os: macOS-latest, r: '4.3', pkgext: '.tgz'} # will be tested without suggests
- {os: windows-latest, r: 'next', pkgext: '.zip'}
- {os: windows-latest, r: '4.3', pkgext: '.zip'}
- {os: ubuntu-latest, r: 'next', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
- {os: ubuntu-22.04, r: '4.3', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
# 4.2 is pushed to drat repo on merge to master for ubunutu (except pre-release builds), update script if 4.2 is taken out
- {os: ubuntu-22.04, r: '4.2', pkgext: '.tar.gz', rspm: "https://cloud.r-project.org"}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Do autorelease increment, tagging, and environment setup
if: github.event_name == 'push'
run: |
curl "https://raw.githubusercontent.com/StoXProject/unstableRepo/main/scripts/checktag-actions.sh" --output unstableRepo_checktag.sh
curl "https://raw.githubusercontent.com/StoXProject/unstableRepo/main/scripts/deploy-actions.sh" --output unstableRepo_deploy.sh
chmod +x ./unstableRepo_checktag.sh ./unstableRepo_deploy.sh
. unstableRepo_checktag.sh
curl "https://raw.githubusercontent.com/StoXProject/testingRepo/main/scripts/checktag-actions.sh" --output testingRepo_checktag.sh
curl "https://raw.githubusercontent.com/StoXProject/testingRepo/main/scripts/deploy-actions.sh" --output testingRepo_deploy.sh
chmod +x ./testingRepo_checktag.sh ./testingRepo_deploy.sh
. testingRepo_checktag.sh
curl "https://raw.githubusercontent.com/StoXProject/repo/master/scripts/checktag-actions.sh" --output repo_checktag.sh
curl "https://raw.githubusercontent.com/StoXProject/repo/master/scripts/deploy-actions.sh" --output repo_deploy.sh
chmod +x ./repo_checktag.sh ./repo_deploy.sh
. repo_checktag.sh
echo "PRERELEASE=${PRERELEASE}" >> $GITHUB_ENV
echo "FINAL_TAG=${FINAL_TAG}" >> $GITHUB_ENV
echo "PKG_FILE_PREFIX=${PKG_FILE_PREFIX}" >> $GITHUB_ENV
echo "PKG_FILE=${PKG_FILE_PREFIX}${{ matrix.config.pkgext }}" >> $GITHUB_ENV
echo "PKG_FREL=${PKG_FILE_PREFIX}-R.${{ matrix.config.r }}-${{ runner.os }}${{ matrix.config.pkgext }}" >> $GITHUB_ENV
echo "PKG_REPO=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
shell: bash
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-pandoc@v2
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
- name: Install system dependencies
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')
- name: Install MacOS system dependencies
if: runner.os == 'macOS'
run: |
rm -f '/usr/local/bin/gfortran'
rm -f '/usr/local/bin/2to3'
rm -f '/usr/local/bin/2to3-3.11'
rm -f '/usr/local/bin/idle3'
rm -f '/usr/local/bin/idle3.11'
rm -f '/usr/local/bin/pydoc3'
rm -f '/usr/local/bin/pydoc3.11'
rm -f '/usr/local/bin/python3'
rm -f '/usr/local/bin/python3.11'
rm -f '/usr/local/bin/python3-config'
rm -f '/usr/local/bin/python3.11-config'
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=false # This prevents Homebrew from re-installing R, which will lead to .Platform$pkgType = "source".
brew install gdal
shell: bash
- name: Prepare for dependencies on Linux
if: runner.os == 'Linux'
run: |
sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev
shell: bash
- name: Install dependencies on Linux
if: runner.os == 'Linux'
run: |
remotes::install_deps(dependencies = TRUE)
shell: Rscript {0}
- name: Install dependencies on Windows and macOS
if: runner.os != 'Linux'
run: |
# First try binary and then possibly source:
options(install.packages.check.source = "no")
remotes::install_deps(dependencies = TRUE, type = "binary")
installed <- utils::installed.packages()[, "Package"]
needed <- remotes::dev_package_deps()
missing <- setdiff(needed$package, installed)
if(length(missing)) {
message("Installing the following packages using default type:\n", paste0(missing, collapse = ", "))
utils::install.packages(missing, dependencies = TRUE)
}
shell: Rscript {0}
#
# Install Reca (awlays from prod repo)
#
- name: Install Reca
run: |
remotes::install_cran("Reca", repos = c("https://stoxproject.github.io/repo/", "https://cloud.r-project.org/"))
shell: Rscript {0}
- name: Install CRANdependencies
run: |
install.packages(c("rcmdcheck", "git2r", "sessioninfo", "knitr", "remotes"))
# Using the latest drat that supports big sur (after inputs from us).
# When the next drat appears on CRAN this can be changed to install from CRAN:
remotes::install_github(repo = 'eddelbuettel/drat', dependencies = FALSE)
shell: Rscript {0}
#
# Install StoX dependencies, corresponding to release status (unstable, pre-release or release)
#
- name: Install R package dependencies from the unstableRepo
if: (github.event_name == 'push' && github.ref_name == 'develop') || (github.event_name == 'pull_request' && github.base_ref == 'develop')
run: |
remotes::install_deps(dependencies = TRUE, repos = c("https://stoxproject.github.io/unstableRepo/", "https://cloud.r-project.org/"))
shell: Rscript {0}
- name: Install R package dependencies from the testingRepo
if: (github.event_name == 'push' && github.ref_name == 'testing') || (github.event_name == 'pull_request' && github.base_ref == 'testing')
run: |
remotes::install_deps(dependencies = TRUE, repos = c("https://stoxproject.github.io/testingRepo/", "https://cloud.r-project.org/"))
shell: Rscript {0}
- name: Install R package dependencies from the official repo
if: (github.event_name == 'push' && github.ref_name == 'master') || (github.event_name == 'pull_request' && github.base_ref == 'master')
run: |
remotes::install_deps(dependencies = TRUE, repos = c("https://stoxproject.github.io/repo/", "https://cloud.r-project.org/"))
shell: Rscript {0}
- name: Session info
run: |
options(width = 100)
pkgs <- installed.packages()[, "Package"]
sessioninfo::session_info(pkgs, include_base = TRUE)
shell: Rscript {0}
# turn off testing of suggestions for configurations where Reca is not provided in StoX package repositories
- name: Check without suggest-dependencies
if: runner.os == 'macOS'
env:
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_FORCE_SUGGESTS_ : false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
shell: Rscript {0}
- name: Check with suggest-dependencies
if: runner.os != 'macOS'
env:
_R_CHECK_CRAN_INCOMING_: false
_R_CHECK_FORCE_SUGGESTS_ : true
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
shell: Rscript {0}
- name: Show test output
if: always()
run: find check -name 'tinytest.Rout*' -exec cat '{}' \; || true
shell: bash
- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
- name: Build package source archive from branches develop, testing and master
if: runner.os == 'Linux' && matrix.config.r == '4.2' && github.event_name == 'push' && (github.ref_name == 'master' || github.ref_name == 'testing' || github.ref_name == 'develop')
run: |
pkgbuild::build(".", dest_path = ".", binary = FALSE)
system(paste0("PKG_FREL=", Sys.getenv("PKG_FILE"), " >> ", Sys.getenv("GITHUB_ENV")))
shell: Rscript {0}
- name: Build package binary archive from branches develop, testing and master for Windows and macOS (this builds also on matrix.config.r = release, which can or can not be a duplicate)
if: (runner.os == 'Windows' || runner.os == 'macOS') && github.event_name == 'push' && (github.ref_name == 'master' || github.ref_name == 'testing' || github.ref_name == 'develop')
run: |
pkgbuild::build(".", dest_path = ".", binary = TRUE)
print("PKG_FILE")
print(Sys.getenv("PKG_FILE"))
print("PKG_FREL")
print(Sys.getenv("PKG_FREL"))
file.copy(Sys.getenv("PKG_FILE"), Sys.getenv("PKG_FREL"))
shell: Rscript {0}
## 5a. Upload to the official (DRAT) repo, but only from the master branch. Here we skip the matrix.config.r = release, as a new StoX release should be ready shortly after each R minor release and listed specifically in the matrix.config:
- name: Upload to the official (DRAT) repo
if: ( (runner.os == 'Windows' && matrix.config.r != 'next') || (runner.os == 'macOS' && matrix.config.r != 'next') || (runner.os == 'Linux' && matrix.config.r == '4.2') ) && github.event_name == 'push' && github.ref_name == 'master'
env:
BUILD_NUMBER: ${{ github.sha }}
DRAT_DEPLOY_TOKEN: ${{ secrets.DRAT_DEPLOY_TOKEN }}
run: . repo_deploy.sh
shell: bash
## 5b. Upload to the (DRAT) testingRepo, but only from the testing branch. Here we skip the matrix.config.r = release, as a new StoX release should be ready shortly after each R minor release and listed specifically in the matrix.config:
- name: Upload to the testing (DRAT) repo
if: ( (runner.os == 'Windows' && matrix.config.r != 'next') || (runner.os == 'macOS' && matrix.config.r != 'next') || (runner.os == 'Linux' && matrix.config.r == '4.2') ) && github.event_name == 'push' && github.ref_name == 'testing'
env:
BUILD_NUMBER: ${{ github.sha }}
DRAT_DEPLOY_TOKEN: ${{ secrets.DRAT_DEPLOY_TOKEN }}
run: . testingRepo_deploy.sh
shell: bash
## 5c. Upload to the (DRAT) unstableRepo, but only from the develop branch. Here we skip the matrix.config.r = release, as a new StoX release should be ready shortly after each R minor release and listed specifically in the matrix.config:
- name: Upload to the unstable (DRAT) repo
if: ( (runner.os == 'Windows' && matrix.config.r != 'next') || (runner.os == 'macOS' && matrix.config.r != 'next') || (runner.os == 'Linux' && matrix.config.r == '4.2') ) && github.event_name == 'push' && github.ref_name == 'develop'
env:
BUILD_NUMBER: ${{ github.sha }}
DRAT_DEPLOY_TOKEN: ${{ secrets.DRAT_DEPLOY_TOKEN }}
run: . unstableRepo_deploy.sh
shell: bash
###############################
#### 6. Release on GitHub: ####
###############################
- name: Create release on GitHub and upload files for testing branch
if: ( (runner.os == 'Windows' && matrix.config.r != 'next') || (runner.os == 'macOS' && matrix.config.r != 'next') || (runner.os == 'Linux' && matrix.config.r == '4.2') ) && github.event_name == 'push' && github.ref_name == 'testing'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
commit: testing
tag: ${{ env.FINAL_TAG }}
name: ${{ env.FINAL_TAG }}
artifacts: ${{ env.PKG_REPO }}/${{ env.PKG_FREL }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release on GitHub and upload files for master branch
if: ( (runner.os == 'Windows' && matrix.config.r != 'next') || (runner.os == 'macOS' && matrix.config.r != 'next') || (runner.os == 'Linux' && matrix.config.r == '4.2') ) && github.event_name == 'push' && github.ref_name == 'master'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
commit: master
tag: ${{ env.FINAL_TAG }}
name: ${{ env.FINAL_TAG }}
artifacts: ${{ env.PKG_REPO }}/${{ env.PKG_FREL }}
token: ${{ secrets.GITHUB_TOKEN }}