1. Compile Main FrEDI Data #56
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
### https://github.com/actions/upload-artifact | |
### https://github.blog/changelog/2021-11-10-github-actions-input-types-for-manual-workflows/ | |
### https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows | |
### https://github.com/r-lib/actions/tree/v2/setup-r-dependencies | |
### https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution | |
### For uploading artifacts: | |
### "path:" is the output path where Pandoc will write the compiled PDF. | |
### Note, this should be the same directory as the input paper.md | |
name: Compile FrEDI Data | |
on: | |
workflow_dispatch: | |
inputs: | |
branch_name: | |
type: string | |
description: Which FrEDI Package branch do you want to use? | |
jobs: | |
compile_data: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
name: Process Data | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Setup R package dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
cache: true | |
cache-version: 1 | |
packages: | | |
any::tidyverse | |
any::ggpubr | |
any::openxlsx | |
any::devtools | |
- name: Install FrEDI | |
run: | | |
Rscript -e ' | |
devtools::install_github( | |
repo = "https://github.com/USEPA/FrEDI", | |
ref = ${{ github.event.inputs.branch_name }}, | |
subdir = "FrEDI", | |
dependencies = FALSE, | |
upgrade = "never", | |
force = TRUE, | |
type = "source" | |
)' | |
- name: Run createsystemData | |
run: | | |
Rscript -e ' | |
projectDir <- "." | |
scriptDir <- projectDir |> file.path("scripts") | |
scriptDir |> file.path("configureFrediData.R") |> source() | |
test0 <- projectDir |> configureFrediData(save=T) | |
"./data_tests/" |> list.files() |> print() | |
"./data/" |> list.files() |> print() | |
' | |
- name: Upload Tests | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Data | |
path: | | |
./data_tests/* | |
./data/tmp_sysdata.rda | |
- name: Commit results | |
run: | | |
git config --local core.autocrlf false | |
git config --local user.email "${{ github.actor }}@users.noreply.github.com" | |
git config --local user.name "${{ github.actor }}" | |
git add data/tmp_sysdata.rda | |
git add data_tests/**.xlsx | |
git pull origin ${{ github.head_ref }} --autostash --rebase -X ours | |
git commit -a -m "Updated temporary system data and tests" | |
git push | |