Skip to content

Commit

Permalink
Updating GH actions (#97)
Browse files Browse the repository at this point in the history
* CI:true is not default

* Updates

* Trying out auto script run

* Update

* bug fix

* More updates

* Updates

* Updates

* Updates

* Updates

* Lots of updates

* Even more updates

* workflow cleanup

* actions bugfix

* some gh actions updates

* Name change
  • Loading branch information
Shawn P. Serbin authored Mar 17, 2022
1 parent 1f93a3a commit a52eb93
Show file tree
Hide file tree
Showing 32 changed files with 714 additions and 804 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
^data-raw$
^doc$
^Meta$
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Check OS and R releases
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check
name: R-CMD-check-OS-R

env:
R_LIBS_USER: /usr/local/lib/R/site-library
NCPUS: 2

jobs:
Expand Down Expand Up @@ -52,19 +52,19 @@ jobs:
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@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-rversion-${{ matrix.config.r }}-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2

# rcmdcheck but do not build vignettes
- name: Build Check Across OS & R Releases
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--no-build-vignettes"), build_args = c("--no-manual", "--no-build-vignettes"), error_on = "error")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@v2
with:
upload-snapshots: true
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# CI to test package on different versions of R, rel-1, rel, rel+1
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check
name: R-CMD-check-R-release

env:
R_LIBS_USER: /usr/local/lib/R/site-library
LC_ALL: en_US.UTF-8
NCPUS: 2
CI: true

jobs:
R-CMD-check:
Expand Down Expand Up @@ -41,6 +41,14 @@ jobs:
extra-packages: any::rcmdcheck
needs: check

# rcmdcheck but do not build vignettes
- name: Run Fast Build Check Across R Releases
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--ignore-vignettes", "--no-build-vignettes"), build_args = c("--no-manual", "--ignore-vignettes", "--no-build-vignettes"), error_on = "error")
shell: Rscript {0}
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--no-build-vignettes"), build_args = c("--no-manual", "--no-build-vignettes"), error_on = "error")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
57 changes: 57 additions & 0 deletions .github/workflows/ci-run_plsr_example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: ci-run_PLSR_example

env:
R_LIBS_USER: /usr/local/lib/R/site-library
LC_ALL: en_US.UTF-8
NCPUS: 2

jobs:
run-plsr:
# The type of runner that the job will run on
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true

strategy:
fail-fast: false
matrix:
R:
- "3.6"
- "4.0"
- "4.1"

steps:
#check out source code
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@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: Install dependencies
run: |
Rscript -e 'remotes::install_github(repo="TESTgroup-BNL/spectratrait", dependencies=TRUE)'
# Run R script
- name: Run Ely et al. (2019) PLSR Example
run: |
source("inst/scripts/spectra-trait_ely_leafN_plsr_bootstrap_example.R")
shell: Rscript {0}
39 changes: 19 additions & 20 deletions .github/workflows/ci-weekly.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,30 @@
name: R-CMD-check weekly
name: R-CMD-check-Weekly

on:
# every Monday at 4:30 AM
schedule:
- cron: '30 4 * * 1'

env:
R_LIBS_USER: /usr/local/lib/R/site-library
LC_ALL: en_US.UTF-8
NCPUS: 2
CI: true

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

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

strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}

- {os: windows-2022, r: 'release'}
# Use 3.6 to trigger usage of RTools35
- {os: windows-2022, r: '3.6'}

# Use older ubuntu to maximise backward compatibility
- {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-18.04, r: 'release'}
- {os: ubuntu-18.04, r: 'oldrel-1'}
- {os: ubuntu-18.04, r: 'oldrel-2'}
- {os: ubuntu-18.04, r: 'oldrel-3'}
- {os: ubuntu-18.04, r: 'oldrel-4'}
- {os: macOS-latest, r: 'oldrel-1'}
- {os: macOS-latest, r: 'release'}
- {os: windows-2022, r: 'oldrel-1'}
- {os: windows-2022, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -56,6 +47,14 @@ jobs:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
# rcmdcheck but do not build vignettes
- name: Build Check Across OS & R Releases
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--no-build-vignettes"), build_args = c("--no-manual", "--no-build-vignettes"), error_on = "error")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@v2
with:
upload-snapshots: true
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
47 changes: 47 additions & 0 deletions .github/workflows/run_ecosis_pull_example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: run_ecosis_pull_example

on:
schedule:
- cron: '15 1 */5 * *'

env:
R_LIBS_USER: /usr/local/lib/R/site-library
LC_ALL: en_US.UTF-8
NCPUS: 2

jobs:
run-plsr:
# The type of runner that the job will run on
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true

steps:
#check out source code
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@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: Install dependencies
run: |
Rscript -e 'remotes::install_github(repo="TESTgroup-BNL/spectratrait", dependencies=TRUE)'
# Run R script
- name: Run EcoSIS API Pull Example
run: |
source("inst/scripts/pull_data_from_ecosis.R")
shell: Rscript {0}
55 changes: 55 additions & 0 deletions .github/workflows/run_plsr_example_auto.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on:
schedule:
- cron: '0 0 */2 * *'

name: run_PLSR_example-auto

env:
R_LIBS_USER: /usr/local/lib/R/site-library
LC_ALL: en_US.UTF-8
NCPUS: 2

jobs:
run-plsr:
# The type of runner that the job will run on
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true

strategy:
fail-fast: false
matrix:
R:
- "3.6"
- "4.0"
- "4.1"

steps:
#check out source code
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@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: Install dependencies
run: |
Rscript -e 'remotes::install_github(repo="TESTgroup-BNL/spectratrait", dependencies=TRUE)'
# Run R script
- name: Run Ely et al. (2019) PLSR Example
run: |
source("inst/scripts/spectra-trait_ely_leafN_plsr_bootstrap_example.R")
shell: Rscript {0}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ rsconnect/
# MacOSX
*.DS*
*._*
/doc/
/Meta/
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ Finally, to complete the installation you will also need to install the spectrat
# to install the master branch version
devtools::install_github(repo = "TESTgroup-BNL/spectratrait", dependencies=TRUE)

# to install the master branch version - with Vignettes (though slower)
devtools::install_github(repo = "TESTgroup-BNL/spectratrait", dependencies=TRUE, build_vignettes = TRUE)

# to install a specific release, for example release 1.0.5
devtools::install_github(repo = "TESTgroup-BNL/[email protected]", dependencies=TRUE)

Expand Down
Binary file added inst/docs/sserbin2019_plsr_ex9.pdf
Binary file not shown.
12 changes: 5 additions & 7 deletions inst/scripts/pull_data_from_ecosis.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ invisible(lapply(list.of.packages, library, character.only = TRUE))


#--------------------------------------------------------------------------------------------------#
### Setup other functions and options
# not in
`%notin%` <- Negate(`%in%`)
### Setup options

# What is the source dataset from EcoSIS?
ecosis_id <- "960dbb0c-144e-4563-8117-9e23d14f4aa9"
Expand Down Expand Up @@ -107,10 +105,10 @@ trait_data <- sample_info %>%
head(trait_data)

# Prepare data for ggplot
trait_data <- melt(data = trait_data, id.vars = "USDA_Species_Code", measure.vars = c("LMA_g_m2",
"Cmass_g_g",
"Nmass_g_g",
"CN_Ratio"))
trait_data <- reshape2::melt(data = trait_data, id.vars = "USDA_Species_Code", measure.vars = c("LMA_g_m2",
"Cmass_g_g",
"Nmass_g_g",
"CN_Ratio"))
head(trait_data)

# Graph the trait data and save a file to the scratch space
Expand Down
731 changes: 0 additions & 731 deletions inst/scripts/sserbin2019_plsr_ex9.nb.html

This file was deleted.

1 change: 1 addition & 0 deletions vignettes/ely_etal_ex1.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ output:
html_notebook: default
html_document:
df_print: paged
keep_md: true
rmarkdown: html_vignette
vignette: >
%\VignetteIndexEntry{Spectra-trait PLSR example using leaf-level spectra and leaf nitrogen content (Narea, g/m2) data from eight different crop species growing in a glasshouse at Brookhaven National Laboratory}
Expand Down
Loading

0 comments on commit a52eb93

Please sign in to comment.