From f82e337511a89ebea14616eb19ccc49b77e6ba1f Mon Sep 17 00:00:00 2001 From: MikkoVihtakari Date: Fri, 26 Jan 2024 14:19:14 +0100 Subject: [PATCH] Add .github folder --- .github/.gitignore | 1 + .github/workflows/R-CMD-check.yaml | 72 ++++++++++++++++++++++++++++++ .github/workflows/gh-pages.yml | 35 +++++++++++++++ 3 files changed, 108 insertions(+) create mode 100755 .github/.gitignore create mode 100755 .github/workflows/R-CMD-check.yaml create mode 100755 .github/workflows/gh-pages.yml diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100755 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100755 index 0000000..3488e85 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,72 @@ +# 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: + - master + tags: + - 'v*' + pull_request: + branches: + - 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: 'release'} + - {os: macOS-latest, r: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + - {os: ubuntu-latest, r: 'oldrel-2'} + + env: + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true + RSPM: ${{ matrix.config.rspm }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-pandoc@v2 + + # TMB binary package is complaining about Matrix inconsistency & failing to compile with + # /Users/runner/work/_temp/Library/TMB/include/TMB.hpp:78:10: fatal error: 'Eigen/Dense' file not found + - name: Install TMB + run: install.packages('TMB', type = 'source') + shell: Rscript {0} + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck any::mfdb + needs: check + + - name: Check + env: + _R_CHECK_CRAN_INCOMING_REMOTE_: false + # NB: The model compilations should in theory work on windows, but github actions hangs + _R_CHECK_DONTTEST_EXAMPLES_: ${{ runner.os != 'Windows' && 'true' || 'false' }} + run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--run-donttest"), error_on = "warning", check_dir = "check") + shell: Rscript {0} + + - name: Upload check results + if: ${{ !success() }} + uses: actions/upload-artifact@main + with: + name: ${{ runner.os }}-r${{ matrix.config.r }}-results + path: check diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100755 index 0000000..27762b3 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,35 @@ +# Based on:- +# * https://ropenscilabs.github.io/actions_sandbox/websites-using-pkgdown-bookdown-and-blogdown.html#action-to-deploy-a-bookdown-site +# * https://github.com/peaceiris/actions-gh-pages +on: + push: + branches: + - master + +name: Render documentation + +jobs: + documentation: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-r@v2 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::pkgdown, local::. + needs: website + + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} + publish_branch: gh-pages + publish_dir: ./docs