Merge pull request #112 from generable/use-httpcache #169
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 | |
- dev | |
pull_request: | |
branches: | |
- main | |
- dev | |
name: R-CMD-check | |
defaults: | |
run: | |
shell: Rscript {0} | |
jobs: | |
R-CMD-check-no-creds: | |
runs-on: ${{ matrix.config.os }} | |
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: macOS-latest, r: 'release'} | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
RSPM: ${{ matrix.config.rspm }} | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
GECO_API_TEST_USER: ${{ secrets.TEST_USER }} | |
GECO_API_TEST_URL: ${{ secrets.TEST_URL }} | |
GECO_API_TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }} | |
GECO_API_TEST_PROJECT: ${{ secrets.TEST_PROJECT }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
id: setup-r | |
with: | |
r-version: ${{ matrix.config.r }} | |
Ncpus: '1L' | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Get Date | |
id: get-date | |
shell: bash | |
run: | | |
echo "::set-output name=year-week::$(date -u "+%Y-%U")" | |
echo "::set-output name=date::$(date -u "+%F")" | |
- name: Restore R package cache | |
uses: actions/cache@v2 | |
id: r-package-cache | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ matrix.os }}-${{ steps.setup-r.outputs.installed-r-version }}-${{ steps.get-date.outputs.year-week }}-3 | |
- name: Install remotes | |
if: steps.r-package-cache.outputs.cache-hit != 'true' | |
run: install.packages("remotes") | |
- name: Install system dependencies | |
if: runner.os == 'Linux' | |
shell: bash | |
run: | | |
. /etc/os-release | |
while read -r cmd | |
do | |
echo "$cmd" | |
sudo $cmd | |
done < <(Rscript -e "writeLines(remotes::system_requirements('$ID-$VERSION_ID'))") | |
- name: Install Package + deps | |
run: remotes::install_local(dependencies = TRUE, force = TRUE) | |
- name: Install rcmdcheck | |
run: remotes::install_cran("rcmdcheck") | |
- name: Check | |
run: rcmdcheck::rcmdcheck(args = '--no-manual', error_on = 'warning', check_dir = 'check') | |
- name: Show testthat output | |
if: always() | |
shell: bash | |
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true | |
- name: Don't use tar from old Rtools to store the cache | |
if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3') }} | |
shell: bash | |
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH | |
- name: Upload check results | |
if: failure() | |
uses: actions/upload-artifact@main | |
with: | |
name: ${{ runner.os }}-r${{ matrix.config.r }}-results | |
path: check |