Skip to content

Commit

Permalink
Merge pull request #160 from inbo/gha_update
Browse files Browse the repository at this point in the history
GHA, R-CMD-check + site-devel + site-deploy: inspire on r-lib/actions/tree/v2/examples
  • Loading branch information
florisvdh authored Feb 3, 2022
2 parents c5429ba + 20ba562 commit 85b5bb4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 128 deletions.
72 changes: 16 additions & 56 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 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
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:

Expand All @@ -15,71 +15,31 @@ jobs:
fail-fast: false
matrix:
config:
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-20.04, r: 'release'}
- {os: ubuntu-18.04, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-pandoc@v2

- 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@v1

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Restore (or define new) R package cache
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ matrix.config.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ matrix.config.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'release <- system("lsb_release -rs", intern = TRUE); writeLines(remotes::system_requirements("ubuntu", release))')
cache-version: ${{ secrets.CACHE_VERSION }}
extra-packages: any::rcmdcheck
needs: check

- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install pkg-config
brew install udunits
brew install gdal
- name: Install package dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: |
options(rmarkdown.html_vignette.check_title = FALSE)
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
path: check
- uses: r-lib/actions/check-r-package@v2
47 changes: 11 additions & 36 deletions .github/workflows/site-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,29 @@ name: site-deploy

jobs:
site-deploy:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
matrix:
config:
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
runs-on: ubuntu-20.04
env:
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v1

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- uses: r-lib/actions/setup-pandoc@v2

- name: Restore (or define new) R package cache
uses: actions/cache@v2
- uses: r-lib/actions/setup-r@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ matrix.config.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
use-public-rspm: true

- name: Install system dependencies (Linux)
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'release <- system("lsb_release -rs", intern = TRUE); writeLines(remotes::system_requirements("ubuntu", release))')
sudo apt-get install -y libfribidi-dev libharfbuzz-dev
- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: ${{ secrets.CACHE_VERSION }}
extra-packages: local::.
needs: website

- name: Install dependencies
- name: Install pkgdown version
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown")
remotes::install_version("pkgdown", "1.6.1")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: |
git config --local user.email "actions@github.com"
Expand Down
47 changes: 11 additions & 36 deletions .github/workflows/site-devel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,29 @@ name: site-devel

jobs:
site-devel:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
strategy:
matrix:
config:
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
runs-on: ubuntu-20.04
env:
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.config.r }}

- uses: r-lib/actions/setup-pandoc@v1

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- uses: r-lib/actions/setup-pandoc@v2

- name: Restore (or define new) R package cache
uses: actions/cache@v2
- uses: r-lib/actions/setup-r@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ matrix.config.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
use-public-rspm: true

- name: Install system dependencies (Linux)
run: |
while read -r cmd
do
eval sudo $cmd
done < <(Rscript -e 'release <- system("lsb_release -rs", intern = TRUE); writeLines(remotes::system_requirements("ubuntu", release))')
sudo apt-get install -y libfribidi-dev libharfbuzz-dev
- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: ${{ secrets.CACHE_VERSION }}
extra-packages: local::.
needs: website

- name: Install dependencies
- name: Install pkgdown version
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown")
remotes::install_version("pkgdown", "1.6.1")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Build site
run: |
Rscript -e 'options(rmarkdown.html_vignette.check_title = FALSE); pkgdown::build_site()'
Expand Down

0 comments on commit 85b5bb4

Please sign in to comment.