Cleanup installs happening in the github workflows #433
Workflow file for this run
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
name: run unit tests | |
on: pull_request | |
jobs: | |
run-unit-tests: | |
name: run unit tests | |
runs-on: macOS-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Cache R packages | |
uses: actions/cache@v1 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: r-${{ hashFiles('DESCRIPTION') }} | |
- name: Install dependencies | |
run: | | |
install.packages(c("devtools")) | |
devtools::install_github("epiforecasts/[email protected]") | |
devtools::install_deps(dependencies = TRUE) | |
shell: Rscript {0} | |
- name: Run unit tests | |
run: | | |
devtools::test_active_file("tests/testthat/test-align.R", stop_on_failure = TRUE) | |
devtools::test_active_file("tests/testthat/test-date_management.R", stop_on_failure = TRUE) | |
devtools::test_active_file("tests/testthat/test-score_forecasts.R", stop_on_failure = TRUE) | |
devtools::test_active_file("tests/testthat/test-load_forecast_files_repo.R", stop_on_failure = TRUE) | |
devtools::test_active_file("tests/testthat/test-get_model_designations.R", stop_on_failure = TRUE) | |
devtools::test_active_file("tests/testthat/test-get_model_metadata.R", stop_on_failure = TRUE) | |
devtools::test_active_file("tests/testthat/test-load_as_of.R", stop_on_failure = TRUE) | |
devtools::test_active_file("tests/testthat/test-load_forecasts.R", stop_on_failure = TRUE) | |
devtools::test_active_file("tests/testthat/test-calc_cramers_dist_equal_space.R", stop_on_failure = TRUE) | |
devtools::test_active_file("tests/testthat/test-calc_cramers_dist_unequal_space.R", stop_on_failure = TRUE) | |
devtools::test_active_file("tests/testthat/test-calc_cramers_dist_one_model_pair.R", stop_on_failure = TRUE) | |
devtools::test_active_file("tests/testthat/test-name_to_fips.R", stop_on_failure = TRUE) | |
shell: Rscript {0} | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/[email protected] | |
- name: Checkout covidData when get_truth.R, aggregate_to_weekly.R or load_truth.R has changed | |
if: >- | |
${{ contains(steps.changed-files.outputs.modified_files, 'R/get_truth.R') || | |
contains(steps.changed-files.outputs.modified_files, | |
'R/aggregate_to_weekly.R') || | |
contains(steps.changed-files.outputs.modified_files, | |
'R/load_truth.R')}} | |
uses: actions/checkout@v3 | |
with: | |
repository: reichlab/covidData | |
path: covidData | |
- name: Install covidData when get_truth.R, aggregate_to_weekly.R or load_truth.R has changed | |
if: >- | |
${{ contains(steps.changed-files.outputs.modified_files, 'R/get_truth.R') || | |
contains(steps.changed-files.outputs.modified_files, | |
'R/aggregate_to_weekly.R') || | |
contains(steps.changed-files.outputs.modified_files, | |
'R/load_truth.R')}} | |
run: make recent_data | |
working-directory: ./covidData/code/data-processing | |
- name: Run unit test for get_truth.R | |
if: contains(steps.changed-files.outputs.modified_files, 'R/get_truth.R') | |
run: | | |
devtools::test_active_file("tests/testthat/test-get_truth.R", stop_on_failure = TRUE) | |
shell: Rscript {0} | |
- name: Run unit test for aggregate_to_weekly.R | |
if: contains(steps.changed-files.outputs.modified_files, 'R/aggregate_to_weekly.R') | |
run: | | |
devtools::test_active_file("tests/testthat/test-aggregate_to_weekly.R", stop_on_failure = TRUE) | |
shell: Rscript {0} | |
- name: Run unit test for load_truth.R | |
if: contains(steps.changed-files.outputs.modified_files, 'R/load_truth.R') | |
run: | | |
devtools::test_active_file("tests/testthat/test-load_truth.R", stop_on_failure = TRUE) | |
shell: Rscript {0} | |
- name: Render vignettes | |
run: | | |
devtools::build_vignettes() | |
shell: Rscript {0} | |