|
| 1 | +# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. |
| 2 | +# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions |
1 | 3 | on: |
2 | 4 | push: |
3 | 5 | branches: |
4 | | - -master |
| 6 | + -main |
5 | 7 | pull_request: |
6 | 8 | branches: |
7 | | - -master |
| 9 | + -main |
8 | 10 |
|
9 | 11 | name:R-CMD-check |
10 | 12 |
|
11 | 13 | jobs: |
12 | 14 | R-CMD-check: |
13 | | -runs-on:macOS-latest |
| 15 | +runs-on:${{ matrix.config.os }} |
| 16 | + |
| 17 | +name:${{ matrix.config.os }} (${{ matrix.config.r }}) |
| 18 | + |
| 19 | +strategy: |
| 20 | +fail-fast:false |
| 21 | +matrix: |
| 22 | +config: |
| 23 | + -{os: windows-latest, r: 'release'} |
| 24 | + -{os: macOS-latest, r: 'release'} |
| 25 | + -{os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} |
| 26 | + -{os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} |
| 27 | + |
| 28 | +env: |
| 29 | +R_REMOTES_NO_ERRORS_FROM_WARNINGS:true |
| 30 | +RSPM:${{ matrix.config.rspm }} |
| 31 | +GITHUB_PAT:${{ secrets.GITHUB_TOKEN }} |
| 32 | + |
14 | 33 | steps: |
15 | 34 | -uses:actions/checkout@v2 |
| 35 | + |
16 | 36 | -uses:r-lib/actions/setup-r@master |
| 37 | +with: |
| 38 | +r-version:${{ matrix.config.r }} |
| 39 | + |
| 40 | + -uses:r-lib/actions/setup-pandoc@master |
| 41 | + |
| 42 | + -name:Query dependencies |
| 43 | +run:| |
| 44 | + install.packages('remotes') |
| 45 | + saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) |
| 46 | + writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") |
| 47 | +shell:Rscript {0} |
| 48 | + |
| 49 | + -name:Cache R packages |
| 50 | +if:runner.os != 'Windows' |
| 51 | +uses:actions/cache@v2 |
| 52 | +with: |
| 53 | +path:${{ env.R_LIBS_USER }} |
| 54 | +key:${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} |
| 55 | +restore-keys:${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- |
| 56 | + |
| 57 | + -name:Install system dependencies |
| 58 | +if:runner.os == 'Linux' |
| 59 | +run:| |
| 60 | + while read -r cmd |
| 61 | + do |
| 62 | + eval sudo $cmd |
| 63 | + done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') |
| 64 | +
|
17 | 65 | -name:Install dependencies |
18 | 66 | run:| |
19 | | - install.packages(c("remotes", "rcmdcheck")) |
20 | 67 | remotes::install_deps(dependencies = TRUE) |
| 68 | + remotes::install_cran("rcmdcheck") |
21 | 69 | shell:Rscript {0} |
| 70 | + |
22 | 71 | -name:Check |
23 | | -run:rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error") |
| 72 | +env: |
| 73 | +_R_CHECK_CRAN_INCOMING_REMOTE_:false |
| 74 | +run:rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") |
24 | 75 | shell:Rscript {0} |
| 76 | + |
| 77 | + -name:Upload check results |
| 78 | +if:failure() |
| 79 | +uses:actions/upload-artifact@main |
| 80 | +with: |
| 81 | +name:${{ runner.os }}-r${{ matrix.config.r }}-results |
| 82 | +path:check |