Windows #344
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
name: R | |
on: [push, pull_request] | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
pre_deploy: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# macos-13 is an intel runner, macos-14 is apple silicon | |
os: [ubuntu-latest, windows-latest, macos-13, macos-14] | |
env: | |
cache-version: 5 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up libraries for Ubuntu | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libsodium-dev libharfbuzz-dev libfribidi-dev libcurl4-openssl-dev texlive-latex-base texlive-fonts-extra pandoc libmagick++-dev libhdf5-dev | |
- name: Set up libraries for MacOS | |
if: runner.os == 'macOS' | |
run: | | |
brew install libsodium harfbuzz fribidi curl texlive pandoc imagemagick hdf5 basictex | |
- name: Set up libraries for Windows | |
if: runner.os == 'Windows' | |
run: | | |
choco install rtools | |
choco install pandoc | |
choco install miktex | |
choco install imagemagick | |
choco install hdf5 | |
- name: Set up R 4.0 | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: 4.0 | |
- name: Set CRAN mirror | |
run: | | |
cat("\noptions(repos=structure(c(CRAN=\"https://cran.rstudio.com\")))\n", file = "~/.Rprofile", append = TRUE) | |
shell: Rscript {0} | |
- name: Get R and OS version | |
id: get-version | |
run: | | |
cat("::set-output name=os-version::", sessionInfo()$running, "\n", sep = "") | |
cat("::set-output name=r-version::", R.Version()$version.string, "\n", sep = "") | |
cat("::endgroup::\n") | |
shell: Rscript {0} | |
- name: Cache dependencies | |
id: cache-deps | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.R_LIBS_USER }}/* | |
key: ${{ hashFiles('DESCRIPTION') }}-${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{ env.cache-version }}-deps | |
- name: Install dependencies | |
if: steps.cache-deps.outputs.cache-hit != 'true' | |
run: | | |
install.packages(c("devtools", "remotes", "rcmdcheck", "BiocManager", "covr")) | |
BiocManager::install("Rarr") | |
remotes::install_deps(dependencies = TRUE) | |
shell: Rscript {0} | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
- name: rcmdcheck | |
run: | | |
rcmdcheck::rcmdcheck( | |
error_on = "error", | |
check_dir = "check" | |
) | |
shell: Rscript {0} | |
env: | |
_R_CHECK_FORCE_SUGGESTS_: false | |
- name: rcmdcheck as CRAN | |
run: | | |
rcmdcheck::rcmdcheck( | |
args = "--as-cran", | |
error_on = "warning", | |
check_dir = "cran_check" | |
) | |
shell: Rscript {0} | |
- name: Run coverage report | |
run: | | |
covr::package_coverage() | |
shell: Rscript {0} | |
- name: Downgrade pkgdown | |
# Reference: https://github.com/r-lib/pkgdown/issues/2205#issuecomment-1377793532 | |
run: | | |
remotes::install_version("pkgdown", "2.0.3") | |
shell: Rscript {0} | |
- name: Build docs | |
run: | | |
Rscript -e 'devtools::document(); pkgdown::build_site(new_process = FALSE)' | |
touch docs/.nojekyll | |
- uses: actions/upload-pages-artifact@v1 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
with: | |
path: ./docs | |
deploy: | |
runs-on: ubuntu-latest | |
needs: pre_deploy | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
uses: actions/deploy-pages@v1 |