Fix GitHub action failure in macos. #612
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-ignore: [gh-pages] | |
pull_request: | |
branches-ignore: [gh-pages] | |
name: R-CMD-check | |
concurrency: | |
group: ${{ github.event.pull_request.number || github.run_id }} | |
cancel-in-progress: true | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
_R_CHECK_FORCE_SUGGESTS_: false | |
_R_CHECK_CRAN_INCOMING_REMOTE_: false | |
LATEX_PACKAGES: "oberdiek grfext environ trimspaces etoolbox upquote babel-english pgf xcolor algorithms relsize tocbibind appendix tocloft enumitem listings tcolorbox collection-fontsrecommended framed inconsolata microtype underscore" | |
R_KEEP_PKG_SOURCE: yes | |
jobs: | |
R-CMD-check: | |
if: "! contains(github.event.head_commit.message, '[skip ci]')" | |
runs-on: ${{ matrix.os }} | |
name: Check ${{ matrix.os }} (${{ matrix.r }}) | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-22.04, windows-latest, macos-13, macos-14 ] | |
r: [ release ] | |
include: | |
# Use 4.0 to check with rtools40's older compiler | |
- { os: windows-latest, r: '4.0' } | |
# Minimum supported version. | |
- {os: ubuntu-20.04, r: '4.0'} | |
# Use latest ubuntu to make it easier to install dependencies | |
- { os: ubuntu-24.04, r: 'devel', http-user-agent: 'release' } | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "[macOS] Install openmpi" | |
if: runner.os == 'macOS' | |
run: | | |
brew install --cask xquartz | |
- name: "[Linux] Install openmpi" | |
if: runner.os == 'Linux' | |
run: sudo apt-get update -y && sudo apt install -y libopenmpi-dev | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.r }} | |
http-user-agent: ${{ matrix.http-user-agent }} | |
use-public-rspm: true | |
# special branch required for TeX Live 2023 fix | |
- uses: r-lib/actions/setup-tinytex@v2-branch | |
- run: tlmgr --version | |
- name: Install additional LaTeX packages | |
run: tlmgr install ${{ env.LATEX_PACKAGES }} | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
if: runner.os != 'macOS' | |
with: | |
extra-packages: | | |
any::rcmdcheck | |
mlr=?ignore-before-r=4.0.0 | |
Rmpi=?ignore-unavailable | |
needs: check | |
cache-version: 1 | |
install-pandoc: true | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
if: runner.os == 'macOS' | |
with: | |
extra-packages: | | |
any::rcmdcheck | |
mlr=?ignore-before-r=4.0.0 | |
Rmpi=?ignore | |
needs: check | |
cache-version: 1 | |
install-pandoc: true | |
- name: Check (as CRAN) | |
env: | |
NOT_CRAN: false | |
uses: r-lib/actions/check-r-package@v2 | |
with: | |
args: 'c("--no-manual", "--as-cran")' | |
build_args: 'c("--compact-vignettes=gs+qpdf")' | |
- name: Check | |
env: | |
NOT_CRAN: true | |
uses: r-lib/actions/check-r-package@v2 | |
with: | |
args: 'c("--no-manual", "--run-donttest", "--timings")' | |
- name: Show testthat output | |
if: failure() | |
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true | |
shell: bash | |
coverage: | |
needs: R-CMD-check | |
name: Coverage | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
timeout-minutes: 30 | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-tinytex@v2-branch | |
- name: Install additional LaTeX packages | |
run: tlmgr install ${{ env.LATEX_PACKAGES }} | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::covr, mlr=?ignore, local::. | |
needs: coverage | |
install-pandoc: true | |
- name: Test coverage | |
env: | |
NOT_CRAN: true | |
COVR_COVERAGE: true | |
run: | | |
options(covr.fix_parallel_mcexit = TRUE) | |
coverage <- covr::package_coverage(type = "all", | |
quiet = FALSE, clean = FALSE, | |
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package"), | |
commentDonttest = FALSE) | |
print(coverage) | |
covr::codecov(coverage = coverage) | |
shell: Rscript {0} | |
- name: Show testthat output | |
if: always() | |
run: | | |
## -------------------------------------------------------------------- | |
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true | |
shell: bash | |
- name: Show failures | |
if: failure() | |
run: | | |
## -------------------------------------------------------------------- | |
find ${{ runner.temp }}/package -type d | xargs -I 'X' find 'X' -name 'testthat.Rout*' -exec cat '{}' \; || true | |
shell: bash | |
- name: Upload test results | |
if: failure() | |
uses: actions/upload-artifact@main | |
with: | |
name: coverage-test-failures | |
path: ${{ runner.temp }}/package | |
pkgdown: | |
needs: R-CMD-check | |
if: contains(' | |
refs/heads/master | |
refs/heads/main | |
', github.ref) && github.event_name == 'push' | |
runs-on: ubuntu-latest | |
# Only restrict concurrency for non-PR jobs | |
concurrency: | |
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} | |
timeout-minutes: 30 | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-tinytex@v2-branch | |
- name: Install additional LaTeX packages | |
run: tlmgr install ${{ env.LATEX_PACKAGES }} | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
extra-packages: any::pkgdown, mlr=?ignore | |
needs: website | |
install-pandoc: true | |
- name: Install package with vignettes | |
run: | | |
remotes::install_local(".", build = TRUE, upgrade = "never", force = TRUE, build_opts = c("--no-resave-data"), build_manual = TRUE, build_vignettes = TRUE) | |
dir.create("./pkgdown/assets/") | |
file.copy(system.file("doc/irace-package.pdf",package="irace", mustWork=TRUE), "./pkgdown/assets/", overwrite=TRUE) | |
shell: Rscript {0} | |
- name: Build site | |
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) | |
shell: Rscript {0} | |
- name: Deploy to GitHub pages 🚀 | |
if: success() && github.event_name != 'pull_request' | |
uses: JamesIves/github-pages-deploy-action@v4.5.0 | |
with: | |
clean: true | |
single-commit: true | |
branch: gh-pages | |
folder: docs |