Skip to content

Commit

Permalink
Update test_fredi.yml
Browse files Browse the repository at this point in the history
More fixes
  • Loading branch information
knoiva-indecon committed May 24, 2024
1 parent af9d760 commit 7cd426e
Showing 1 changed file with 38 additions and 44 deletions.
82 changes: 38 additions & 44 deletions .github/workflows/test_fredi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ jobs:
upgrade = "never",
force = TRUE,
type = "source"
)'
)
'
- name: Set paths and load FrEDI
- name: Run tests & create figures
run: |
Rscript -e '
### Main repo path, FrEDI project path, scripts path
Expand All @@ -92,6 +93,9 @@ jobs:
tFiles0 <- tPath0 |> list.files(full.names=TRUE)
for(file_i in tFiles0){file_i |> source(); rm(file_i)}
### Load source
sPath0 |> file.path("create_DoW_results.R") |> source()
### Which tests to do
do_tests <- "${{ inputs.run_tests }}" == "true"
do_figH <- "${{ inputs.figH_results }}" == "true"
Expand All @@ -111,11 +115,7 @@ jobs:
if(!exists0){ oPath0 |> dir.create(recursive = TRUE)}
if(!exists1){ oPath1 |> dir.create(recursive = TRUE)}
if(!exists2){ oPath2 |> dir.create(recursive = TRUE)}
'
- name: Run tests
run: |
Rscript -e '
### Test results
if(do_tests){
### Run FrEDI
Expand All @@ -136,6 +136,34 @@ jobs:
### Remove results
rm(exists0, results0, tests0, listResults, save0)
} ### End if(do_tests)
### Create Fig H results
if(do_figH){
### Figure H results
results0 <- run_fredi(aggLevels=c("modelaverage", "national", "impactYear"))
results0 <- results0 |> filter(year %in% seq(2010, 2090, by=5))
save0 <- results0 |> write.csv(file=oPath2 |> file.path("FigH_results.csv"), row.names=F) |> try()
### Remove reslts
rm(results0, save0)
} ### End if(do_figH)
### Create report figures
if(do_figs){
### Load source
sPath0 |> file.path("create_DoW_results.R") |> source()
### Create report figures
reports0 <- create_DoW_results(
outPath = oPath2,
saveFile = TRUE,
loadCode = "project",
silent = FALSE,
testing = TRUE,
return = FALSE,
fpath = pPath0
)
} ### End if(do_figs)
'
- name: Upload Tests
Expand All @@ -148,57 +176,23 @@ jobs:
./FrEDI/data_tests/general/defaultScenarioTotals.rda
./FrEDI/data_tests/general/testResults_fredi_general.xlsx
- name: Get FigH results
run: |
Rscript -e '
### Create report results
if(do_figH){
### Figure H results
results0 <- run_fredi(aggLevels=c("modelaverage", "national", "impactYear"))
results0 <- results0 |> filter(year %in% seq(2010, 2090, by=5))
save0 <- results0 |> write.csv(file=oPath2 |> file.path("FigH_results.csv"), row.names=F) |> try()
### Remove reslts
rm(results0, save0)
}
'
- name: Upload Report Figures
- name: Upload FigH Results
if: |
inputs.figH_results == 'true'
uses: actions/upload-artifact@v3
with:
name: Fig H results
name: FigH results
path: |
./FrEDI/data_tests/report_figures/
- name: Run create_DoW_results
run: |
Rscript -e '
### Create report results
if(do_figs){
### Load source
sPath0 |> file.path("create_DoW_results.R") |> source()
### Create report figures
reports0 <- create_DoW_results(
outPath = oPath2,
saveFile = TRUE,
loadCode = "project",
silent = FALSE,
testing = TRUE,
return = FALSE,
fpath = pPath0
)
}
'
- name: Upload Report Figures
- name: Upload Other Report Figures
if: |
inputs.make_figures == 'true'
uses: actions/upload-artifact@v3
with:
name: Report Data
name: Other Report Figures & Data
path: |
./FrEDI/data_tests/report_figures/
# ./FrEDI/data_tests/general/FigH_results.csv
Expand Down

0 comments on commit 7cd426e

Please sign in to comment.