Create install-test.yml #4
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# | |
# See https://github.com/r-lib/actions/tree/master/examples#readme for | |
# additional example workflows available for the R community. | |
name: R | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
r-version: [4.3, 4.4] | |
install-method: ["devtools::install_github", "install.packages", "remotes::install_url"] | |
steps: | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.r-version }} | |
- name: Check and install system dependencies (Ubuntu) | |
if: runner.os == 'Linux' | |
run: | | |
# Check if libarrow-dev is installed, and install it if missing | |
if ! dpkg -l | grep -q libarrow-dev; then | |
sudo apt-get update | |
sudo apt-get install -y libarrow-dev | |
fi | |
- name: Check and install system dependencies (macOS) | |
if: runner.os == 'macOS' | |
run: | | |
# Check if apache-arrow is installed, and install it if missing | |
if ! brew list | grep -q apache-arrow; then | |
brew install apache-arrow | |
fi | |
- name: Check and install Rtools (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
# Check if Rtools is installed | |
if [ ! -d "C:/rtools40" ]; then | |
echo "Installing Rtools" | |
# Rtools is required for compiling certain R packages on Windows | |
R -e 'install.packages("installr")' | |
R -e 'installr::install.Rtools()' | |
else | |
echo "Rtools is already installed." | |
fi | |
- name: Install devtools and remotes (if needed) | |
run: | | |
if [ "${{ matrix.install-method }}" == "devtools::install_github" ]; then | |
R -e 'if (!requireNamespace("devtools", quietly = TRUE)) install.packages("devtools")' | |
elif [ "${{ matrix.install-method }}" == "remotes::install_url" ]; then | |
R -e 'if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")' | |
fi | |
- name: Install Package - ${{ matrix.install-method }} | |
run: | | |
if [ "${{ matrix.install-method }}" == "devtools::install_github" ]; then | |
R -e 'devtools::install_github("USEPA/EJAM-open")' | |
elif [ "${{ matrix.install-method }}" == "install.packages" ]; then | |
R -e 'install.packages("https://github.com/USEPA/EJAM-open/archive/refs/tags/v2.32-EJAM-open.tar.gz", repos = NULL, type = "source")' | |
elif [ "${{ matrix.install-method }}" == "remotes::install_url" ]; then | |
R -e 'remotes::install_url("https://github.com/USEPA/EJAM-open/archive/main.tar.gz")' | |
fi | |
- name: Test Installation | |
run: | | |
R -e 'library(EJAM); print("Package loaded successfully")' |