|
| 1 | +# NOTE: This workflow is overkill for most R packages |
| 2 | +# check-standard.yaml is likely a better choice |
| 3 | +# usethis::use_github_action("check-standard") will install it. |
| 4 | +# |
| 5 | +# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. |
| 6 | +# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + - master |
| 12 | + pull_request: |
| 13 | + branches: |
| 14 | + - main |
| 15 | + - master |
| 16 | + |
| 17 | +name: R-CMD-check-pak |
| 18 | + |
| 19 | +jobs: |
| 20 | + R-CMD-check: |
| 21 | + runs-on: ${{ matrix.config.os }} |
| 22 | + |
| 23 | + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) |
| 24 | + |
| 25 | + strategy: |
| 26 | + fail-fast: false |
| 27 | + matrix: |
| 28 | + config: |
| 29 | + - {os: macOS-latest, r: 'release'} |
| 30 | + - {os: windows-latest, r: 'release'} |
| 31 | + - {os: windows-latest, r: '3.6'} |
| 32 | + - {os: ubuntu-16.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest", http-user-agent: "R/4.0.0 (ubuntu-16.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" } |
| 33 | + - {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} |
| 34 | + - {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} |
| 35 | + - {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"} |
| 36 | + |
| 37 | + env: |
| 38 | + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true |
| 39 | + RSPM: ${{ matrix.config.rspm }} |
| 40 | + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} |
| 41 | + |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v2 |
| 44 | + |
| 45 | + - uses: r-lib/actions/setup-r@v1 |
| 46 | + id: install-r |
| 47 | + with: |
| 48 | + r-version: ${{ matrix.config.r }} |
| 49 | + http-user-agent: ${{ matrix.config.http-user-agent }} |
| 50 | + |
| 51 | + - uses: r-lib/actions/setup-pandoc@v1 |
| 52 | + |
| 53 | + - name: Install pak and query dependencies |
| 54 | + run: | |
| 55 | + install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/") |
| 56 | + saveRDS(pak::pkg_deps_tree("local::.", dependencies = TRUE), ".github/r-depends.rds") |
| 57 | + shell: Rscript {0} |
| 58 | + |
| 59 | + - name: Cache R packages |
| 60 | + uses: actions/cache@v2 |
| 61 | + with: |
| 62 | + path: ${{ env.R_LIBS_USER }} |
| 63 | + key: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }} |
| 64 | + restore-keys: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-1- |
| 65 | + |
| 66 | + - name: Install system dependencies |
| 67 | + if: runner.os == 'Linux' |
| 68 | + run: Rscript -e 'pak::local_system_requirements(execute = TRUE)' |
| 69 | + |
| 70 | + - name: Install dependencies |
| 71 | + run: | |
| 72 | + pak::local_install_dev_deps(upgrade = TRUE) |
| 73 | + pak::pkg_install("rcmdcheck") |
| 74 | + shell: Rscript {0} |
| 75 | + |
| 76 | + - name: Install Miniconda |
| 77 | + run: | |
| 78 | + Rscript -e "pak::pkg_install('rstudio/reticulate')" |
| 79 | + Rscript -e "reticulate::install_miniconda()" |
| 80 | +
|
| 81 | + - name: Find Miniconda on macOS |
| 82 | + if: runner.os == 'macOS' |
| 83 | + run: echo "options(reticulate.conda_binary = reticulate:::miniconda_conda())" >> .Rprofile |
| 84 | + |
| 85 | + - name: Install TensorFlow |
| 86 | + run: | |
| 87 | + reticulate::conda_create('r-reticulate', packages = c('python==3.6.9')) |
| 88 | + tensorflow::install_tensorflow(version='1.14.0') |
| 89 | + shell: Rscript {0} |
| 90 | + |
| 91 | + - name: Session info |
| 92 | + run: | |
| 93 | + options(width = 100) |
| 94 | + pkgs <- installed.packages()[, "Package"] |
| 95 | + sessioninfo::session_info(pkgs, include_base = TRUE) |
| 96 | + shell: Rscript {0} |
| 97 | + |
| 98 | + - name: Check |
| 99 | + env: |
| 100 | + _R_CHECK_CRAN_INCOMING_: false |
| 101 | + run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") |
| 102 | + shell: Rscript {0} |
| 103 | + |
| 104 | + - name: Show testthat output |
| 105 | + if: always() |
| 106 | + run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true |
| 107 | + shell: bash |
| 108 | + |
| 109 | + - name: Upload check results |
| 110 | + if: failure() |
| 111 | + uses: actions/upload-artifact@main |
| 112 | + with: |
| 113 | + name: ${{ runner.os }}-r${{ matrix.config.r }}-results |
| 114 | + path: check |
0 commit comments