only run system lib step for windows #13
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
name: EJAM Installation | |
on: | |
push: | |
branches: [ "main", "test" ] | |
pull_request: | |
branches: [ "main", "test" ] | |
permissions: | |
contents: read | |
jobs: | |
install_ejam: | |
if: ${{ !github.event.repository.private }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
r-version: [4.3, 4.4] | |
install-method: [github, url] # Matrix for installation method | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.r-version }} | |
- name: Restore R package cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ runner.temp }} | |
key: ${{ runner.os }}-R-${{ matrix.r-version }}-${{ hashFiles('**/DESCRIPTION') }} | |
restore-keys: ${{ runner.os }}-R-${{ matrix.r-version }}- | |
- name: System Libraries | |
if: runner.os != 'Windows' | |
run: | | |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then | |
sudo apt-get update | |
sudo apt-get install -y libfontconfig1-dev libudunits2-dev libcairo2-dev libcurl4-openssl-dev \ | |
libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev \ | |
libjpeg-dev libgdal-dev libgeos-dev libproj-dev | |
elif [ "${{ matrix.os }}" == "macOS-latest" ]; then | |
brew install freetype udunits cairo harfbuzz fribidi libpng libtiff jpeg gdal pkg-config | |
fi | |
- name: Install EJAM (method- ${{ matrix.install-method }}) | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
install.packages("remotes") | |
if("${{ matrix.install-method }}" == "github") { | |
remotes::install_github( | |
"${{ github.repository }}", # what owner/repo has the pkg to try to install | |
dependencies=TRUE, | |
force=TRUE, | |
INSTALL_opts = c("--with-keep.source", "--install-tests") | |
) | |
} else { | |
# figure out the URL of the most recent release | |
install.packages("gh") | |
url_latest_release = function(owner_repo) { | |
x = gh::gh(paste0("/repos/",owner_repo,"/releases")) | |
dates = sapply(x, function(z) z$published_at) | |
latest_url = x[[which.max(as.Date(dates))]]$html_url | |
return(latest_url) | |
} | |
remotes::install_url( | |
url = url_latest_release(owner_repo = "${{ github.repository }}"), | |
#url = "https://github.com/USEPA/EJAM-open/archive/refs/tags/v2.32.1.tar.gz", | |
dependencies = TRUE, | |
auth_token = "" | |
) | |
} | |
shell: Rscript {0} | |
- name: Restore R package cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ runner.temp }} | |
key: ${{ runner.os }}-R-${{ matrix.r-version }}-${{ hashFiles('**/DESCRIPTION') }} | |
restore-keys: ${{ runner.os }}-R-${{ matrix.r-version }}- | |
- name: Test Installation | |
run: | | |
R -e 'library(EJAM); print("Package loaded successfully")' |