Skip to content
PredictiveEcologyPublic

About

collection of GitHub Actions workflows

Resources

Stars

0 stars

Watchers

2 watching

Forks

Repository files navigation

actions

Collection of GitHub Actions workflows used by the Predictive Ecology group to test packages, SpaDES modules, and render SpaDES module manuals.

Which ref to use

Use @main. That is what every caller in this organisation is on, and it is what these actions are tested against.

This reverses earlier advice in this file, which recommended a version tag or a pinned SHA on the grounds that tags can move. The reasoning was sound in the abstract and wrong in practice here: a pin does not freeze correct behaviour, it freezes whatever was true on the day, including the bugs and including the parts of the outside world the action reaches for.

The concrete case. Every published tag — v0.1 through v0.5 — still has install-spatial-deps adding the ubuntugis-unstable PPA, which installs a GDAL that is ABI-incompatible with the Posit binaries the R packages are built against on noble. main dropped that PPA. A caller pinned to a tag for stability gets a broken geospatial toolchain and no way to notice; that is what took quickPlot's revdeps workflow out of service.

Pins also rot silently in a second way: they are the reason v0.1-v0.5 cannot be retired. Seventy-four module repositories still reference them.

@main moves, and that is the point — fixes reach callers. It is not unguarded: self-test.yaml exercises the composite actions on every push and pull request, and the reusable workflows are used by this organisation's own packages, so a break surfaces immediately rather than at the next release.

Pin a SHA only when you have a specific reason to hold a version, and expect to revisit it.

See NEWS.md for the changes at each tag.

Testing against an unmerged PR: Depends-on:

When a pull request needs the unmerged code of another PR (in the same or another PredictiveEcology repo), say so in its description with one line per PR:

Depends-on: PredictiveEcology/LandR#264

The reusable workflows R-CMD-check, test-coverage, pkgdown, testthat-module, render-module-rmd and pkgdown-module then install that PR with pak after the normal dependency install, so it overrides the development version, and run as usual. It is opt-in: without such a line, or on a push, workflow_dispatch or schedule run, nothing changes.

  • The line is case-insensitive and may sit anywhere in the description; nothing else in the description triggers anything.
  • The description is read through the API when the job runs, so edit it and re-run the job.
  • A referenced PR that is merged or closed is skipped (the log says so), so a stale line is harmless after the upstream merges.
  • Chains are followed: the lines of each open referenced PR are read too, deepest first.
  • The log and the job summary show what ran, e.g. Depends-on: installed PredictiveEcology/LandR#264 -> LandR 1.2.0.9046 (sha a110a43).
  • Public repositories need no extra permission. A private repository needs pull-requests: read; without it the step warns and does nothing.

Details: install-depends-on.

Dependent PRs in parallel: opt-in options

Nothing below changes anything unless a caller opts in; every input defaults to false. Write the floor a dependent PR needs as the version the upstream will have after it merges (the upstream's development version plus one in the last component), because the rule is "no version bump in a PR; bump on development after each merge".

jobs:
  R-CMD-check:
    uses: PredictiveEcology/actions/.github/workflows/R-CMD-check.yaml@main
    with:
      depends-on-virtual-bump: true    # solve against the upstream PR, Version + 1
      depends-on-gate: true            # skip the jobs while the upstream is pending or failed
      depends-on-reduced-matrix: true  # R-CMD-check only: 3 release legs while the upstream is open
    secrets: inherit
  • depends-on-virtual-bump (all six workflows that read Depends-on:): before the dependency solve, each open upstream PR is fetched, its Version raised by one in the CI copy only, and handed to the solver as a local package, so reproducible (>= 3.2.1.9072) resolves while development is 3.2.1.9071, and the tests run against the unmerged code. Merged or closed upstream PRs are skipped. The module workflows install the copy before the module's reqdPkgs resolve.
  • depends-on-gate (all six): a first job reads the Depends-on: lines and the upstream PR's checks at its head commit. While any is pending or failed the other jobs are skipped and the run summary says waiting for owner/repo#N (pending). Green, merged or closed upstreams, no Depends-on: line, and pushes run as usual. A skipped job counts as passing for a required status check, so do not rely on a waiting PR being unmergeable.
  • depends-on-reduced-matrix (R-CMD-check only): while an upstream PR is open, only release on ubuntu, windows and macOS run (extra-config legs are not added). The default matrix runs when every upstream is merged or closed, and on pushes.
  • Re-running without a cross-repository secret: add one file to the repository, .github/workflows/depends-on-rerun.yaml. Every 30 minutes it finds the repository's open PRs whose runs the gate skipped and re-runs them once every upstream is green or merged, using the repository's own GITHUB_TOKEN. It exits within seconds when no open PR has a Depends-on: line. Scheduled workflows run only from the default branch.
name: depends-on-rerun
on:
  schedule:
    - cron: "*/30 * * * *"
  workflow_dispatch:
jobs:
  rerun:
    permissions:
      actions: write
      pull-requests: read
    uses: PredictiveEcology/actions/.github/workflows/depends-on-rerun.yaml@main

Reusable workflows

These are the primary interface. A caller supplies its triggers and any overrides; the matrix, system dependencies, caching and pins live here. See each file's header comment for its inputs.

workflow what it does
R-CMD-check.yaml the check matrix, incl. a _R_CHECK_DEPENDS_ONLY_ leg
test-coverage.yaml covr, uploaded with codecov-action (caller passes CODECOV_TOKEN)
test-downstream.yaml check downstream packages against the branch under test
pkgdown.yaml build the site and deploy to gh-pages
revdeps.yaml reverse dependency checks (wraps revdeps-check)
citation.yaml regenerate CITATION.cff from DESCRIPTION
render-module-rmd.yaml render a SpaDES module's .Rmd and commit the rendered .md
testthat-module.yaml run a SpaDES module's testthat suite
pkgdown-module.yaml build a SpaDES module's pkgdown site and deploy it to gh-pages
depends-on-rerun.yaml opt-in, scheduled: re-run PR runs the Depends-on gate skipped, once the upstream is ready
jobs:
  R-CMD-check:
    uses: PredictiveEcology/actions/.github/workflows/R-CMD-check.yaml@main
    secrets: inherit

Inputs at a glance

Every input each reusable workflow accepts, with its default. A ⚠️ marks an input a caller cannot set here although other workflows of the same kind offer it; the legend is under the second table.

Input R-CMD-check test-coverage pkgdown test-downstream revdeps citation render-module-rmd testthat-module pkgdown-module depends-on-rerun
system-deps ✅ true ✅ true ⚠️ no ⚠️ no ⚠️ no ✅ true ✅ true ✅ true ✅ true ⚠️ no
pandoc ✅ true ✅ true ⚠️ no ⚠️ no ⚠️ no ⚠️ no – – – ⚠️ no
extra-env ✅ "" ✅ "" ⚠️ no ⚠️ no ⚠️ no ⚠️ no – – – ⚠️ no
dependencies ✅ "all" ✅ "all" ⚠️ no ✅ "all" ⚠️ no ✅ "all" – – – ⚠️ no
extra-packages ✅ "" ✅ "" ✅ "" ✅ "" ✅ "" ✅ "" – – – ⚠️ no
post-install ✅ "" ✅ "" ✅ "" ✅ "" ⚠️ no ⚠️ no – – – ⚠️ no
extra-repositories ✅ https://PredictiveEcology.r-u… ⚠️ no ⚠️ no ⚠️ no ✅ "" ⚠️ no – – – ⚠️ no
extra-apt – – – – – – ✅ "" ✅ "" ✅ "" –
cache-version ✅ 1 ⚠️ no ⚠️ no ⚠️ no ⚠️ no ⚠️ no – – – ⚠️ no
error-on ✅ "warning" – – ✅ "error" – – – – – –
check-args ✅ c("--no-manual", "--as-cran") – – ✅ c("--no-manual", "--as-cran",… – – – – – –
build-args ✅ c("--no-manual", "--compact-v… – – – – – – – – –
extra-config ✅ [] – – – – – – – – –
r-version – – – – – – ✅ release ✅ release ✅ release –
module – – – – – – ✅ required ✅ required ✅ required –
coverage – – – – – – – ✅ true – –
url – – – – – – – – ✅ "" –
config – – – – ✅ [{"os": "ubuntu-latest", "r":… – – – – –
cranonly – – – – ✅ true – – – – –
quiet – – – – ✅ true – – – – –
timeout – – – – ✅ 30 – – – – –
downstream – – – ✅ required – – – – – –
run-in-tmux – ✅ false – – – – – – – –
check-timeout-minutes ✅ 45 – – – – – – – – –
depends-on-gate ✅ false ✅ false ✅ false – – – ✅ false ✅ false ✅ false –
depends-on-reduced-matrix ✅ false – – – – – – – – –
depends-on-virtual-bump ✅ false ✅ false ✅ false – – – ✅ false ✅ false ✅ false –
deps-timeout-minutes ✅ 60 – – – – – – – – –
module-dir – – – – – – ✅ "" ✅ "" – –
timeout-minutes ✅ 120 – – – – – – – – –

Behaviour at a glance

What each workflow does regardless of inputs.

Behaviour R-CMD-check test-coverage pkgdown test-downstream revdeps citation render-module-rmd testthat-module pkgdown-module depends-on-rerun
Uses setup-r-deps ✅ yes ⚠️ no ⚠️ no ⚠️ no ⚠️ no ✅ yes – – – ⚠️ no
Cancels superseded PR runs ✅ yes ✅ yes ⚠️ no ✅ yes ✅ yes ⚠️ no ✅ yes ✅ yes ✅ yes ✅ yes
Dependency source ✅ input, r-universe by default ⚠️ r-universe, fixed ⚠️ r-universe, fixed ⚠️ r-universe, fixed ✅ input, CRAN by default ⚠️ CRAN only, fixed – Require – Require – Require ⚠️ CRAN only, fixed
Accepts secrets GOOGLEDRIVE_AUTH GOOGLEDRIVE_AUTH, CODECOV_TOKEN – GOOGLEDRIVE_AUTH – – – GOOGLEDRIVE_AUTH – –
R versions tested release release release release caller's config release caller's r-version caller's r-version caller's r-version release

✅ the caller can set it  ·  ⚠️ not available here, though other workflows of the same kind offer it  ·  – not applicable

Both tables are generated from the workflow files by tools/gen_readme_tables.py, and CI fails if they drift from the workflows they describe.

Composite actions

The building blocks the workflows above are made of. Use them directly only when no reusable workflow fits. For details and example usage see each action's README.

  1. install-depends-on - install the open PRs named by Depends-on: lines in the PR description;
  2. install-apt-packages - apt packages on Ubuntu, capped, retried, with the downloaded .deb files cached;
  3. install-module-sysdeps - the system libraries the module workflows need (incl. fonts for textshaping), defined once;
  4. install-Require - installs Require (and remotes);
  5. install-Rmd-pkgs - installs packages commonly needed to render SpaDES module manuals;
  6. install-SpaDES - installs SpaDES packages;
  7. install-spatial-deps - system dependencies for geospatial packages on Ubuntu Linux and macOS;
  8. report-timeout - say "Timed out" when a step hit its timeout-minutes;
  9. setup-r-deps - R, pandoc, system deps and the package dependency cache in one step;
  10. stage-gdrive-auth - stage a Google Drive credential for tests that need one;
  11. unpin-remotes - drop one package from a DESCRIPTION's Remotes, leaving other fields untouched;
  12. revdeps-check - run reverse dependency checks for R packages;

Skipping a run

Use one of GitHub's own keywords in the commit message: [skip ci], [ci skip], [no ci], [skip actions] or [actions skip]. GitHub then does not start the run at all, on push and pull_request events.

The hyphenated [skip-ci] is not one of them and is no longer honoured here. These workflows used to carry a job-level guard for that spelling, which only skipped the jobs after the run had already started.

Keeping the pins current

.github/dependabot.yml watches the third-party actions this repository uses -- actions/checkout, r-lib/actions/*, codecov/codecov-action, and so on -- and opens a pull request when one of them needs attention.

Those pins all float on a major tag, so patches and minor releases already arrive without a pull request. Dependabot speaks up only when a major moves, which is when someone has to read a changelog anyway.

This does not change the advice above. Callers follow @main, and Dependabot leaves those references alone of its own accord: a branch name is not a version, so its parser never treats PredictiveEcology/actions/...@main as a dependency.

Every composite action directory is named in that file, because Dependabot does not look inside subdirectories on its own. Adding a composite action therefore means adding a line there, and the dependabot-directories job in self-test.yaml fails the build if that list and the directories on disk ever diverge.

More information on GitHub Actions

https://github.com/r-lib/actions

About

collection of GitHub Actions workflows

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages