Skip to content

Commit

Permalink
Use eddelbuettel/github-actions/r2u-setup@master [no version bump]
Browse files Browse the repository at this point in the history
  • Loading branch information
henrykironde authored and ethanwhite committed Jul 20, 2024
1 parent bae6cc7 commit 38c35da
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 53 deletions.
51 changes: 13 additions & 38 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,61 +18,36 @@ jobs:
build:
if: contains(toJson(github.event.commits), '[skip ci]') == false

runs-on: ${{ matrix.config.os }}
runs-on: ubuntu-latest

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
matrix:
config:
- {os: ubuntu-latest, r: '4.2.2', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 3
- uses: r-lib/actions/setup-r@v2
id: install-r
with:
r-version: ${{ matrix.config.r }}

- name: Cache R packages
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
restore-keys: |
${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
${{ runner.os }}-
fetch-depth: 3
- name: Setup R (Ubuntu)
uses: eddelbuettel/github-actions/r2u-setup@master

- name: Install system dependencies
run: |
sudo apt-get -y update && sudo apt-get install -y \
libgit2-dev libicu-dev gdal-bin proj-data proj-bin libv8-dev libprotobuf-dev protobuf-compiler \
libudunits2-dev libgdal-dev libgeos-dev libproj-dev libfontconfig1-dev libjq-dev libmysqlclient-dev libpng-dev
# sudo add-apt-repository ppa:xapienz/curl34
# sudo add-apt-repository ppa:linuxuprising/libpng12 && sudo apt-get update && sudo apt install libpng12-0
sudo apt-get update
pip install -U pandas numpy landsatxplore
- name: Install packages
run: Rscript install-packages.R
run: Rscript install-packages.R

- name: Update data
run: |
echo WU_API_KEY = ${{ secrets.WU_API_KEY }} >> $HOME/.Renviron
echo USGS_PASSWORD = ${{ secrets.USGS_PASSWORD }} >> $HOME/.Renviron
R -e 'readRenviron("~/.Renviron")'
Rscript update-data.R
- name: Test
run: Rscript testthat.R

- name: Check for new files
id: check_files
run: |
Expand All @@ -82,7 +57,7 @@ jobs:
else
echo "diff=TRUE" >> $GITHUB_OUTPUT
fi
- name: Bump version
id: version
env:
Expand All @@ -97,7 +72,7 @@ jobs:
echo "No version bump"
echo "new_ver=FALSE" >> $GITHUB_OUTPUT
fi
- name: Setup Tag
if: github.event_name != 'pull_request' && steps.version.outputs.new_ver == 'TRUE'
id: tagging
Expand All @@ -106,7 +81,7 @@ jobs:
echo "tag=$value" >> $GITHUB_OUTPUT
value="v${value}"
echo "release=$value" >> $GITHUB_OUTPUT
- name: Tag new version for release
if: github.event_name != 'pull_request' && steps.version.outputs.new_ver == 'TRUE'
env:
Expand All @@ -117,7 +92,7 @@ jobs:
author_email: weecologydeploy@weecology.org
message: "Update data and trigger archive: GitHub Build ${{ github.run_number }} ${{ env.JOB_TAGS }}"
tag: ${{ steps.tagging.outputs.tag }}

- name: Create Release
if: github.event_name != 'pull_request' && steps.version.outputs.new_ver == 'TRUE'
id: create_release
Expand Down
16 changes: 1 addition & 15 deletions install-packages.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
# Install pacman if it isn't already installed

if ("pacman" %in% rownames(installed.packages()) == FALSE) install.packages("pacman")

remove.packages("stringi")
remove.packages("stringr")
install.packages(c("Rcpp","stringi","stringr","RCurl","curl","Hmisc", "EML", "sf","rgdal","lwgeom", "git2r","remotes"), type="source", repos="https://cran.rstudio.com")
install.packages('terra', repos='https://rspatial.r-universe.dev')
install.packages(c("curl", "devtools", "dplyr", "EML", "git2r", "Hmisc", "htmltab", "jsonlite", "lubridate", "lunar", "lwgeom", "openxlsx", "raster", "Rcpp", "RCurl", "remotes", "rgdal", "semver", "sf", "shiny", "sp", "sqldf", "stringi", "stringr", "terra", "testthat", "tidyr", "units", "yaml", "zoo"))
remotes::install_github("htmltab/htmltab")

# Install analysis packages using pacman

# pacman::p_load(units, sf, rgdal, lwgeom, shiny, stringi, stringr, Hmisc, dplyr, git2r, openxlsx, lubridate, htmltab,
# lunar, jsonlite, devtools, sp, sqldf, raster, RCurl, EML, testthat, zoo, tidyr, semver, yaml)


pacman::p_load(units, shiny, dplyr, openxlsx, lubridate, htmltab,
lunar, jsonlite, devtools, sp, sqldf, raster, testthat, zoo, tidyr, semver, yaml)

0 comments on commit 38c35da

Please sign in to comment.