Merge pull request #158 from jhudsl/cansavvy/pair-program #460
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
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. | |
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
name: R-CMD-check | |
jobs: | |
R-CMD-check: | |
runs-on: ubuntu-latest | |
container: | |
image: jhudsl/base_ottr:main | |
steps: | |
- uses: actions/checkout@v4 | |
- 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: | | |
remotes::install_deps(dependencies = TRUE) | |
remotes::install_cran("rcmdcheck") | |
shell: Rscript {0} | |
- name: Check | |
env: | |
GH_PAT: ${{ secrets.GH_PAT }} | |
run: | | |
options(crayon.enabled = TRUE) | |
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), check_dir = "check") | |
shell: Rscript {0} | |
- name: Check testthat | |
id: check_check | |
run: | | |
Rscript -e "install.packages('tidyr', repos = 'http://cran.us.r-project.org')" | |
Rscript -e "devtools::test()" | |
error_num=$(Rscript --vanilla '.github/workflows/check_testthat.R') | |
echo "error_num=$error_num" >> $GITHUB_OUTPUT | |
- name: Stop if there are errors! | |
if: ${{ steps.check_check.outputs.error_num != '0' }} | |
run: exit 1 | |
- name: Upload check results | |
if: failure() | |
uses: actions/upload-artifact@main | |
with: | |
path: check |