|
| 1 | +# GitHub Actions CI for multiDetectR (DGEC standards). |
| 2 | +# |
| 3 | +# Mirrors the previous GitLab pipeline: R CMD check (including vignettes) and |
| 4 | +# the testthat suite, on a public rocker/r-ver image. |
| 5 | +# |
| 6 | +# DGEC GitHub Actions conformance: |
| 7 | +# - Third-party actions are pinned to a full commit SHA (not a moving tag), |
| 8 | +# with the human-readable version in a trailing comment. |
| 9 | +# - GITHUB_TOKEN is granted the minimum permission (contents: read). |
| 10 | +# - No secrets are referenced; no self-hosted runners are used. |
| 11 | +name: R-CMD-check |
| 12 | + |
| 13 | +on: |
| 14 | + push: |
| 15 | + branches: [main] |
| 16 | + pull_request: |
| 17 | + branches: [main] |
| 18 | + workflow_dispatch: |
| 19 | + |
| 20 | +# Least-privilege token: the workflow only needs to read the repository. |
| 21 | +permissions: |
| 22 | + contents: read |
| 23 | + |
| 24 | +jobs: |
| 25 | + R-CMD-check: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + container: |
| 28 | + image: rocker/r-ver:4.6.1 |
| 29 | + env: |
| 30 | + _R_CHECK_FORCE_SUGGESTS_: "false" |
| 31 | + _R_CHECK_NO_STOP_ON_TEST_ERROR_: "true" |
| 32 | + R_KEEP_PKG_SOURCE: "yes" |
| 33 | + steps: |
| 34 | + # actions/checkout@v4.2.2 |
| 35 | + - name: Check out repository |
| 36 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 |
| 37 | + |
| 38 | + - name: Install system dependencies |
| 39 | + run: | |
| 40 | + apt-get update -qq |
| 41 | + apt-get install -y --no-install-recommends \ |
| 42 | + libcurl4-openssl-dev libssl-dev libxml2-dev pandoc git |
| 43 | +
|
| 44 | + - name: Install R package dependencies |
| 45 | + run: | |
| 46 | + Rscript -e 'install.packages(c("remotes", "rcmdcheck"), repos = "https://cloud.r-project.org", Ncpus = 4)' |
| 47 | + Rscript -e 'remotes::install_deps(dependencies = TRUE, upgrade = "never", Ncpus = 4)' |
| 48 | + Rscript -e 'need <- c("knitr", "rmarkdown", "rcmdcheck", "remotes", "shiny", "DT", "testthat"); miss <- need[!vapply(need, requireNamespace, logical(1), quietly = TRUE)]; if (length(miss)) stop(paste("missing packages", paste(miss, collapse = ", ")))' |
| 49 | +
|
| 50 | + - name: R CMD check |
| 51 | + run: | |
| 52 | + Rscript -e 'rcmdcheck::rcmdcheck(args = c("--no-manual"), error_on = "error", check_dir = "check")' |
| 53 | +
|
| 54 | + - name: Run testthat suite |
| 55 | + run: | |
| 56 | + Rscript -e 'testthat::test_local(stop_on_failure = TRUE)' |
| 57 | +
|
| 58 | + # actions/upload-artifact@v4.4.3 |
| 59 | + - name: Upload check results |
| 60 | + if: always() |
| 61 | + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 |
| 62 | + with: |
| 63 | + name: r-cmd-check-results |
| 64 | + path: check/ |
| 65 | + retention-days: 7 |
0 commit comments