Skip to content

Commit

Permalink
Update test_fredi.yml
Browse files Browse the repository at this point in the history
Edited `test_fredi.yml` to add tests back in after a successful cache of setup info
  • Loading branch information
knoiva-indecon committed Nov 25, 2024
1 parent a83fd70 commit ac72a51
Showing 1 changed file with 73 additions and 73 deletions.
146 changes: 73 additions & 73 deletions .github/workflows/test_fredi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,76 +52,76 @@ jobs:
any::openxlsx
any::devtools
# ### Install FrEDI from new branch and get results
# ### Install FrEDI from ref branch and get results
# - name: Test results
# run: |
# Rscript -e '
# ###### Paths ######
# ### Main repo path, FrEDI project path, scripts path
# rPath0 <- ".";
# # pPath0 <- rPath0 |> file.path("FrEDI")
# pPath0 <- rPath0
# sPath0 <- pPath0 |> file.path("scripts")
# tPath0 <- pPath0 |> file.path("testing")
#
# ### Where to save results
# oPath0 <- pPath0 |> file.path("data_tests")
# oFileNew <- oPath0 |> file.path("newResults.rda")
# oFileRef <- oPath0 |> file.path("refResults.rda")
#
# ### Check if path exists and, if not, create it
# exists0 <- oPath0 |> dir.exists()
# if(!exists0) oPath0 |> dir.create(recursive=TRUE)
# "got here1" |> print()
#
# ###### Action Arguments ######
# urlRepo <- "https://github.com/USEPA/FrEDI"
# newBranch <- "${{ github.ref_name }}"
# refBranch <- "${{ inputs.ref_branch }}"
# c(newBranch, refBranch) |> print()
# aggTypes <- "${{ inputs.agg_types }}" == "true"
# if(aggTypes) {
# cAggLvls <- "all"
# } else {
# cAggLvls <- c("national", "modelaverage", "impactyear")
# } ### End if(aggTypes)
# "got here2" |> print()
#
# ###### Run FrEDI for Reference Branch ######
# ### Install FrEDI from ref branch
# ### Load library
# ### Run FrEDI
# devtools::install_github(repo=urlRepo, ref=refBranch, subdir="FrEDI", dependencies=F, upgrade="never", force=T, type="source")
# library(FrEDI)
# dfRef <- run_fredi(aggLevels=cAggLvls)
# dfRef |> save(file=oFileRef)
# "got here3" |> print()
#
# ### Detach FrEDI package
# package:FrEDI |> detach(unload=TRUE)
#
# ###### Run FrEDI for New Branch ######
# ### Install FrEDI from new branch
# devtools::install_github(repo=urlRepo, ref=newBranch, dependencies=F, upgrade="never", force=T, type="source")
# library(FrEDI)
# dfNew <- run_fredi(aggLevels=cAggLvls)
# dfNew |> save(file=oFileNew)
# "got here4" |> print()
#
# ###### Test results ######
# ### Load testing scripts
# tFiles0 <- tPath0 |> list.files(full.names=TRUE)
# for(file_i in tFiles0){file_i |> source(); rm(file_i)}
# ### Get test results
# dfTests <- general_fredi_test(newOutputs=dfNew, refOutputs=dfRef, outPath=oPath0)
# "got here5" |> print()
# '
#
# - name: Upload Tests
# uses: actions/upload-artifact@v4
# with:
# name: Test Data
# path: |
# data_tests/*.rd*
# data_tests/*.xlsx
### Install FrEDI from new branch and get results
### Install FrEDI from ref branch and get results
- name: Test results
run: |
Rscript -e '
###### Paths ######
### Main repo path, FrEDI project path, scripts path
rPath0 <- ".";
# pPath0 <- rPath0 |> file.path("FrEDI")
pPath0 <- rPath0
sPath0 <- pPath0 |> file.path("scripts")
tPath0 <- pPath0 |> file.path("testing")
### Where to save results
oPath0 <- pPath0 |> file.path("data_tests")
oFileNew <- oPath0 |> file.path("newResults.rda")
oFileRef <- oPath0 |> file.path("refResults.rda")
### Check if path exists and, if not, create it
exists0 <- oPath0 |> dir.exists()
if(!exists0) oPath0 |> dir.create(recursive=TRUE)
"got here1" |> print()
###### Action Arguments ######
urlRepo <- "https://github.com/USEPA/FrEDI"
newBranch <- "${{ github.ref_name }}"
refBranch <- "${{ inputs.ref_branch }}"
c(newBranch, refBranch) |> print()
aggTypes <- "${{ inputs.agg_types }}" == "true"
if(aggTypes) {
cAggLvls <- "all"
} else {
cAggLvls <- c("national", "modelaverage", "impactyear")
} ### End if(aggTypes)
"got here2" |> print()
###### Run FrEDI for Reference Branch ######
### Install FrEDI from ref branch
### Load library
### Run FrEDI
devtools::install_github(repo=urlRepo, ref=refBranch, subdir="FrEDI", dependencies=F, upgrade="never", force=T, type="source")
library(FrEDI)
dfRef <- run_fredi(aggLevels=cAggLvls)
dfRef |> save(file=oFileRef)
"got here3" |> print()
### Detach FrEDI package
package:FrEDI |> detach(unload=TRUE)
###### Run FrEDI for New Branch ######
### Install FrEDI from new branch
devtools::install_github(repo=urlRepo, ref=newBranch, dependencies=F, upgrade="never", force=T, type="source")
library(FrEDI)
dfNew <- run_fredi(aggLevels=cAggLvls)
dfNew |> save(file=oFileNew)
"got here4" |> print()
###### Test results ######
### Load testing scripts
tFiles0 <- tPath0 |> list.files(full.names=TRUE)
for(file_i in tFiles0){file_i |> source(); rm(file_i)}
### Get test results
dfTests <- general_fredi_test(newOutputs=dfNew, refOutputs=dfRef, outPath=oPath0)
"got here5" |> print()
'
- name: Upload Tests
uses: actions/upload-artifact@v4
with:
name: Test Data
path: |
data_tests/*.rd*
data_tests/*.xlsx

0 comments on commit ac72a51

Please sign in to comment.