From 2d7d25e91cbfb4d1ecc99084fd19dfae754511dc Mon Sep 17 00:00:00 2001 From: ShixiangWang Date: Tue, 9 Mar 2021 10:37:40 +0800 Subject: [PATCH] Update main.yml --- .github/workflows/main.yml | 88 ++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 51 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 347ab6f..7e42082 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,68 +1,54 @@ -on: [push, pull_request] +# 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 + - master + pull_request: + branches: + - main + - master name: R-CMD-check jobs: R-CMD-check: - runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - - strategy: - fail-fast: false - matrix: - config: - - { os: windows-latest, r: '3.6', args: "--no-manual"} - - { os: macOS-latest, r: '3.6'} - - { os: macOS-latest, r: 'devel', args: "--no-manual"} - - { os: ubuntu-16.04, r: '3.5', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest", args: "--no-manual" } - - { os: ubuntu-16.04, r: '3.6', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest", args: "--no-manual" } - + runs-on: macOS-latest env: - R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - CRAN: ${{ matrix.config.cran }} - + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v1 - - - uses: r-lib/actions/setup-r@master - with: - r-version: ${{ matrix.config.r }} - - - uses: r-lib/actions/setup-pandoc@master + - uses: actions/checkout@v2 + - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-pandoc@v1 - - uses: r-lib/actions/setup-tinytex@master - if: contains(matrix.config.args, 'no-manual') == false + - 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: Cache R packages - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('DESCRIPTION') }} + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - - name: Install system dependencies - if: runner.os == 'Linux' - env: - RHUB_PLATFORM: linux-x86_64-ubuntu-gcc - run: | - Rscript -e "install.packages('remotes')" -e "remotes::install_github('r-hub/sysreqs')" - sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") - sudo -s eval "$sysreqs" - name: Install dependencies - run: Rscript -e "install.packages('remotes')" -e "remotes::install_deps(dependencies = TRUE)" -e "remotes::install_cran('rcmdcheck')" + run: | + install.packages(c("remotes", "rcmdcheck")) + remotes::install_deps(dependencies = TRUE) + remotes::install_cran("covr") + shell: Rscript {0} - name: Check - run: Rscript -e "rcmdcheck::rcmdcheck(args = '${{ matrix.config.args }}', error_on = 'warning', check_dir = 'check')" - - - name: Upload check results - if: failure() - uses: actions/upload-artifact@master - with: - name: ${{ runner.os }}-r${{ matrix.config.r }}-results - path: check - - - name: Test coverage - if: matrix.config.os == 'macOS-latest' && matrix.config.r == '3.6' run: | - Rscript -e 'remotes::install_github("r-lib/covr@gh-actions")' - Rscript -e 'covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")' + options(crayon.enabled = TRUE) + rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error") + shell: Rscript {0} +# +# - name: Test coverage +# run: covr::codecov() +# shell: Rscript {0}