From 6ebadf3a3fb0c55674972df32ba372826f5c06a1 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Wed, 24 Aug 2022 14:27:32 +0100 Subject: [PATCH 01/12] Update the pkgdown workflow to use r-lib v2 --- .github/workflows/pkgdown.yaml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 63cbb18..aeb3b66 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -1,4 +1,4 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/master/examples +# 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: @@ -17,19 +17,25 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: r-lib/actions/setup-pandoc@v1 + - uses: r-lib/actions/setup-pandoc@v2 - - uses: r-lib/actions/setup-r@v1 + - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v1 + - uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: pkgdown + extra-packages: any::pkgdown, local::. needs: website - - name: Deploy package - run: | - git config --local user.name "$GITHUB_ACTOR" - git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" - Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' + - name: Build site + run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) + shell: Rscript {0} + + - name: Deploy to GitHub pages 🚀 + if: github.event_name != 'pull_request' + uses: JamesIves/github-pages-deploy-action@4.1.4 + with: + clean: false + branch: gh-pages + folder: docs From 84d091c35bed9f6b0ad597bd5725db9bb5a9f3e2 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Wed, 24 Aug 2022 14:43:05 +0100 Subject: [PATCH 02/12] Add an R CMD Check workflow Will run on a collection of R versions which will hopefully capture the PHS current and future set-ups. Also added a badge to the readme to report the status. --- .github/workflows/R-CMD-check.yaml | 54 ++++++++++++++++++++++++++++++ README.Rmd | 5 +++ 2 files changed, 59 insertions(+) create mode 100644 .github/workflows/R-CMD-check.yaml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..60199e5 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,54 @@ +# 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: + branches: [main, master] + pull_request: + branches: [main, master] + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + continue-on-error: ${{ matrix.config.must_pass }} + + strategy: + fail-fast: false + matrix: + config: + # Windows + - {os: windows-latest, r: 'release', must_pass: true} + # Use 3.6 to trigger usage of RTools35 + - {os: windows-latest, r: '3.6', must_pass: true} + # Linux + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release', must_pass: false} + - {os: ubuntu-latest, r: 'release', must_pass: true} + - {os: ubuntu-latest, r: 'oldrel-1', must_pass: true} + - {os: ubuntu-latest, r: 'oldrel-2', must_pass: true} + - {os: ubuntu-latest, r: '3.6.1', must_pass: true} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v2 + + - 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-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true diff --git a/README.Rmd b/README.Rmd index 0be9934..87cbecd 100644 --- a/README.Rmd +++ b/README.Rmd @@ -14,8 +14,13 @@ knitr::opts_chunk$set( # phsstyles + [![GitHub release (latest by date)](https://img.shields.io/github/v/release/Public-Health-Scotland/phsstyles)](https://github.com/Public-Health-Scotland/phsstyles/releases/latest) + +[![R-CMD-check](https://github.com/Public-Health-Scotland/phsstyles/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Public-Health-Scotland/phsstyles/actions/workflows/R-CMD-check.yaml) + + There are 8 colours for use in [Public Health Scotland (PHS)](https://www.publichealthscotland.scot/): - 4 main colours (PHS purple, PHS magenta, PHS blue and PHS green) From c9e654d154b2b5ce50bc2292c104710a88a1a035 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Wed, 24 Aug 2022 14:44:26 +0100 Subject: [PATCH 03/12] Add a test coverage workflow This will check and report how much of the package is covered by the tests. It will report the results to codecov.io as well as commenting on relevant PRs --- .Rbuildignore | 1 + .github/workflows/test-coverage.yaml | 31 ++++++++++++++++++++++++++++ DESCRIPTION | 1 + README.Rmd | 3 ++- codecov.yml | 14 +++++++++++++ 5 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-coverage.yaml create mode 100644 codecov.yml diff --git a/.Rbuildignore b/.Rbuildignore index 828a499..433d3e0 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -8,3 +8,4 @@ ^docs$ ^pkgdown$ ^\.github$ +^codecov\.yml$ diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 0000000..4b65418 --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,31 @@ +# 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: + branches: [main, master] + pull_request: + branches: [main, master] + +name: test-coverage + +jobs: + test-coverage: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::covr + needs: coverage + + - name: Test coverage + run: covr::codecov(quiet = FALSE) + shell: Rscript {0} diff --git a/DESCRIPTION b/DESCRIPTION index 8bd9346..1bd39db 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -15,6 +15,7 @@ Imports: ggplot2, scales Suggests: + covr, testthat (>= 3.0.0) Encoding: UTF-8 LazyData: true diff --git a/README.Rmd b/README.Rmd index 87cbecd..f07e64a 100644 --- a/README.Rmd +++ b/README.Rmd @@ -17,6 +17,7 @@ knitr::opts_chunk$set( [![GitHub release (latest by date)](https://img.shields.io/github/v/release/Public-Health-Scotland/phsstyles)](https://github.com/Public-Health-Scotland/phsstyles/releases/latest) +[![Codecov test coverage](https://codecov.io/gh/Public-Health-Scotland/phsstyles/branch/master/graph/badge.svg)](https://app.codecov.io/gh/Public-Health-Scotland/phsstyles?branch=master) [![R-CMD-check](https://github.com/Public-Health-Scotland/phsstyles/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Public-Health-Scotland/phsstyles/actions/workflows/R-CMD-check.yaml) @@ -110,7 +111,7 @@ library(ggplot2) # Apply PHS theme to a chart qplot(mpg, wt, data = mtcars) + theme_phs() -# Overwirte a feature (e.g. remove vertical gridlines and add horizontal ones) +# Overwrite a feature (e.g. remove vertical gridlines and add horizontal ones) qplot(mpg, wt, data = mtcars) + theme_phs() + theme(panel.grid.major.x = element_blank(), panel.grid.major.y = element_line(colour = diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..04c5585 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,14 @@ +comment: false + +coverage: + status: + project: + default: + target: auto + threshold: 1% + informational: true + patch: + default: + target: auto + threshold: 1% + informational: true From 7a293a4e2c23bd95ffd9516abf556c63c7b72f90 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Wed, 24 Aug 2022 14:45:03 +0100 Subject: [PATCH 04/12] Add a workflow to document the package Will run when any files in the `R` directory are modified and ensure the package documentation is up to date. --- .github/workflows/document.yaml | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/document.yaml diff --git a/.github/workflows/document.yaml b/.github/workflows/document.yaml new file mode 100644 index 0000000..9a772c0 --- /dev/null +++ b/.github/workflows/document.yaml @@ -0,0 +1,44 @@ +# 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: + paths: ["R/**"] + pull_request: + paths: ["R/**"] + +name: Document + +jobs: + document: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - name: Install dependencies + uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::roxygen2 + needs: roxygen2 + + - name: Document + run: roxygen2::roxygenise() + shell: Rscript {0} + + - name: Commit and push changes + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git add man/\* NAMESPACE + git commit -m "Update documentation" || echo "No changes to commit" + git pull --ff-only + git push origin From 411f1e7324007bbc245360d9ce0281de8dba8903 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Wed, 24 Aug 2022 14:46:29 +0100 Subject: [PATCH 05/12] Add a workflow to style the package This will run whenever a relevant filetype is modified and style the package with `styler` to the tidyverse style. All the changes will be only cosmetic btu will ensure consistency. --- .github/workflows/style.yaml | 68 ++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/style.yaml diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml new file mode 100644 index 0000000..f0bb30c --- /dev/null +++ b/.github/workflows/style.yaml @@ -0,0 +1,68 @@ +# 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: + paths: ["**.[rR]", "**.[rR]md", "**.[rR]markdown", "**.[rR]nw"] + pull_request: + paths: ["**.[rR]", "**.[rR]md", "**.[rR]markdown", "**.[rR]nw"] + +name: Style + +jobs: + style: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - name: Install dependencies + uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::styler + needs: styler + + - name: Enable styler cache + run: styler::cache_activate() + shell: Rscript {0} + + - name: Determine cache location + id: styler-location + run: | + cat( + "##[set-output name=location;]", + styler::cache_info(format = "tabular")$location, + "\n", + sep = "" + ) + shell: Rscript {0} + + - name: Cache styler + uses: actions/cache@v2 + with: + path: ${{ steps.styler-location.outputs.location }} + key: ${{ runner.os }}-styler-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-styler- + ${{ runner.os }}- + + - name: Style + run: styler::style_pkg(filetype = c(".R", ".Rmd", ".Rmarkdown", ".Rnw")) + shell: Rscript {0} + + - name: Commit and push changes + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git add R/\* + git commit -m "Style code" || echo "No changes to commit" + git pull --ff-only + git push origin From 88865f18eb45fe0566d6b319521201902014db87 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Wed, 24 Aug 2022 14:47:22 +0100 Subject: [PATCH 06/12] Add a workflow to lint the package It will run on any push or pull and add annotiations to the commit / PR with suggestions from `lintr` which provides best practice. --- .github/workflows/lint.yaml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..381410b --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,30 @@ +# 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: + branches: [main, master] + pull_request: + branches: [main, master] + +name: lint + +jobs: + lint: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::lintr, local::. + needs: lint + + - name: Lint + run: lintr::lint_package() + shell: Rscript {0} From c6dc0e499c8a620c4a625e3026a0e235b7c1a43f Mon Sep 17 00:00:00 2001 From: Moohan Date: Wed, 24 Aug 2022 13:49:31 +0000 Subject: [PATCH 07/12] Style code --- R/data.R | 4 ++-- R/phs_pal.R | 5 ++--- R/phs_pal1.R | 12 ++++++++---- R/phsstyles.R | 10 +++++++--- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/R/data.R b/R/data.R index fb7a71d..3863617 100644 --- a/R/data.R +++ b/R/data.R @@ -34,7 +34,7 @@ #' | x | supporting-liberties | #' | x | supporting-rusts | #' -#'@md +#' @md #' #' @format A character list "phs_palettes" @@ -64,7 +64,7 @@ #' | x | supporting-liberties | #' | x | supporting-rusts | #' -#'@md +#' @md #' #' @format A character list "phs_palette_types" diff --git a/R/phs_pal.R b/R/phs_pal.R index b69abfc..7b4e526 100644 --- a/R/phs_pal.R +++ b/R/phs_pal.R @@ -8,10 +8,9 @@ phs_pal <- function(type = "seq", palette = 1, direction = 1, if (direction == -1) { pal <- rev(pal) } - if(colour_names == TRUE){ + if (colour_names == TRUE) { pal - } - else{ + } else { as.vector(pal) } } diff --git a/R/phs_pal1.R b/R/phs_pal1.R index becf45a..4a8074e 100644 --- a/R/phs_pal1.R +++ b/R/phs_pal1.R @@ -3,13 +3,17 @@ phs_pal1 <- function(n, name) { phs_palettes <- phsstyles::phs_palettes if (!(name %in% names(phs_palettes))) { - stop(paste(name,"is not a valid palette name.\n")) + stop(paste(name, "is not a valid palette name.\n")) } if (n > length(phs_palettes[[name]]) & !(name %in% phs_palette_types[["seq"]])) { - warning(paste("n too large, allowed maximum for palette", name, "is", - length(phs_palettes[[name]])), - "\nReturning the palette you asked for with that many colors\n") + warning( + paste( + "n too large, allowed maximum for palette", name, "is", + length(phs_palettes[[name]]) + ), + "\nReturning the palette you asked for with that many colors\n" + ) return(phs_pal1(length(phs_palettes[[name]]), name)) } diff --git a/R/phsstyles.R b/R/phsstyles.R index 73d3372..d911ae1 100644 --- a/R/phsstyles.R +++ b/R/phsstyles.R @@ -11,6 +11,10 @@ NULL # Stops notes from appearing in R CMD check because of undefined global # variables -if (getRversion() >= "2.15.1") utils::globalVariables(c("phs_colour_values", - "phs_palette_types", - "phs_palettes")) +if (getRversion() >= "2.15.1") { + utils::globalVariables(c( + "phs_colour_values", + "phs_palette_types", + "phs_palettes" + )) +} From 6b9b179cab154dafbea4156f1dbe38db0e16526f Mon Sep 17 00:00:00 2001 From: James McMahon Date: Fri, 2 Dec 2022 12:36:28 +0000 Subject: [PATCH 08/12] Update style.yaml to use the same actions as phsmethods --- .github/workflows/style.yaml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml index f0bb30c..25fb952 100644 --- a/.github/workflows/style.yaml +++ b/.github/workflows/style.yaml @@ -2,9 +2,9 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - paths: ["**.[rR]", "**.[rR]md", "**.[rR]markdown", "**.[rR]nw"] + paths: ["**.[rR]", "**.[qrR]md", "**.[rR]markdown", "**.[rR]nw"] pull_request: - paths: ["**.[rR]", "**.[rR]md", "**.[rR]markdown", "**.[rR]nw"] + paths: ["**.[rR]", "**.[qrR]md", "**.[rR]markdown", "**.[rR]nw"] name: Style @@ -15,7 +15,7 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 @@ -38,15 +38,17 @@ jobs: id: styler-location run: | cat( - "##[set-output name=location;]", + "location=", styler::cache_info(format = "tabular")$location, "\n", + file = Sys.getenv("GITHUB_OUTPUT"), + append = TRUE, sep = "" ) shell: Rscript {0} - name: Cache styler - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ${{ steps.styler-location.outputs.location }} key: ${{ runner.os }}-styler-${{ github.sha }} @@ -58,11 +60,7 @@ jobs: run: styler::style_pkg(filetype = c(".R", ".Rmd", ".Rmarkdown", ".Rnw")) shell: Rscript {0} - - name: Commit and push changes - run: | - git config --local user.name "$GITHUB_ACTOR" - git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" - git add R/\* - git commit -m "Style code" || echo "No changes to commit" - git pull --ff-only - git push origin + - name: Commit and push changes on all other branches + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "Style code" From fb6b4e9e7247b41efb9902a27ffc2e238c2d88e7 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Fri, 2 Dec 2022 12:37:50 +0000 Subject: [PATCH 09/12] Update document.yaml to use the same actions as phsmethods --- .github/workflows/document.yaml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/document.yaml b/.github/workflows/document.yaml index 9a772c0..b810433 100644 --- a/.github/workflows/document.yaml +++ b/.github/workflows/document.yaml @@ -15,7 +15,7 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 @@ -35,10 +35,6 @@ jobs: shell: Rscript {0} - name: Commit and push changes - run: | - git config --local user.name "$GITHUB_ACTOR" - git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" - git add man/\* NAMESPACE - git commit -m "Update documentation" || echo "No changes to commit" - git pull --ff-only - git push origin + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "Update documentation" From 1e310cf88f60bad5c99c95164f3e536346bb2d00 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Fri, 2 Dec 2022 12:43:57 +0000 Subject: [PATCH 10/12] Add required packages to style workflow --- .github/workflows/style.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml index 25fb952..0171170 100644 --- a/.github/workflows/style.yaml +++ b/.github/workflows/style.yaml @@ -27,7 +27,7 @@ jobs: - name: Install dependencies uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::styler + extra-packages: any::styler, any::roxygen2, any::knitr needs: styler - name: Enable styler cache From 6b082aef8885a5603d673241f7ec6e05baa27b58 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Thu, 30 Nov 2023 15:41:23 +0000 Subject: [PATCH 11/12] Update to the latest workflow examples And simplify the R CMD check --- .github/workflows/R-CMD-check.yaml | 22 +++++++++++++--------- .github/workflows/document.yaml | 12 +++++++----- .github/workflows/lint.yaml | 2 +- .github/workflows/pkgdown.yaml | 11 +++++++++-- .github/workflows/style.yaml | 25 ++++++++++++++++--------- .github/workflows/test-coverage.yaml | 23 +++++++++++++++++++++-- 6 files changed, 67 insertions(+), 28 deletions(-) diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 60199e5..001c2e5 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -11,30 +11,34 @@ name: R-CMD-check jobs: R-CMD-check: runs-on: ${{ matrix.config.os }} + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - continue-on-error: ${{ matrix.config.must_pass }} strategy: fail-fast: false matrix: config: # Windows - - {os: windows-latest, r: 'release', must_pass: true} + - {os: windows-latest, r: 'release'} # Use 3.6 to trigger usage of RTools35 - - {os: windows-latest, r: '3.6', must_pass: true} + - {os: windows-latest, r: '3.6'} # Linux - - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release', must_pass: false} - - {os: ubuntu-latest, r: 'release', must_pass: true} - - {os: ubuntu-latest, r: 'oldrel-1', must_pass: true} - - {os: ubuntu-latest, r: 'oldrel-2', must_pass: true} - - {os: ubuntu-latest, r: '3.6.1', must_pass: true} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + # Mac OS + - {os: macos-latest, r: 'release'} + + # Vesions in use on PHS PWB + - {os: ubuntu-latest, r: '4.0.2'} + - {os: ubuntu-latest, r: '4.1.2'} + - {os: ubuntu-latest, r: '3.6.1'} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 diff --git a/.github/workflows/document.yaml b/.github/workflows/document.yaml index b810433..6c118dd 100644 --- a/.github/workflows/document.yaml +++ b/.github/workflows/document.yaml @@ -3,8 +3,6 @@ on: push: paths: ["R/**"] - pull_request: - paths: ["R/**"] name: Document @@ -35,6 +33,10 @@ jobs: shell: Rscript {0} - name: Commit and push changes - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: "Update documentation" + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git add man/\* NAMESPACE DESCRIPTION + git commit -m "Update documentation" || echo "No changes to commit" + git pull --ff-only + git push origin diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 381410b..24d656d 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -14,7 +14,7 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index aeb3b66..ed7650c 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -3,6 +3,8 @@ on: push: branches: [main, master] + pull_request: + branches: [main, master] release: types: [published] workflow_dispatch: @@ -12,10 +14,15 @@ name: pkgdown jobs: pkgdown: runs-on: ubuntu-latest + # Only restrict concurrency for non-PR jobs + concurrency: + group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: write steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-pandoc@v2 @@ -34,7 +41,7 @@ jobs: - name: Deploy to GitHub pages 🚀 if: github.event_name != 'pull_request' - uses: JamesIves/github-pages-deploy-action@4.1.4 + uses: JamesIves/github-pages-deploy-action@v4.4.1 with: clean: false branch: gh-pages diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml index 0171170..bee3e48 100644 --- a/.github/workflows/style.yaml +++ b/.github/workflows/style.yaml @@ -2,9 +2,7 @@ # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help on: push: - paths: ["**.[rR]", "**.[qrR]md", "**.[rR]markdown", "**.[rR]nw"] - pull_request: - paths: ["**.[rR]", "**.[qrR]md", "**.[rR]markdown", "**.[rR]nw"] + paths: ["**.[rR]", "**.[qrR]md", "**.[rR]markdown", "**.[rR]nw", "**.[rR]profile"] name: Style @@ -27,7 +25,7 @@ jobs: - name: Install dependencies uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::styler, any::roxygen2, any::knitr + extra-packages: any::styler, any::roxygen2 needs: styler - name: Enable styler cache @@ -57,10 +55,19 @@ jobs: ${{ runner.os }}- - name: Style - run: styler::style_pkg(filetype = c(".R", ".Rmd", ".Rmarkdown", ".Rnw")) + run: styler::style_pkg() shell: Rscript {0} - - name: Commit and push changes on all other branches - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: "Style code" + - name: Commit and push changes + run: | + if FILES_TO_COMMIT=($(git diff-index --name-only ${{ github.sha }} \ + | egrep --ignore-case '\.(R|[qR]md|Rmarkdown|Rnw|Rprofile)$')) + then + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git commit ${FILES_TO_COMMIT[*]} -m "Style code (GHA)" + git pull --ff-only + git push origin + else + echo "No changes to commit." + fi diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index 4b65418..27d4528 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -15,7 +15,7 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: r-lib/actions/setup-r@v2 with: @@ -27,5 +27,24 @@ jobs: needs: coverage - name: Test coverage - run: covr::codecov(quiet = FALSE) + run: | + covr::codecov( + quiet = FALSE, + clean = FALSE, + install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package") + ) shell: Rscript {0} + + - name: Show testthat output + if: always() + run: | + ## -------------------------------------------------------------------- + find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v3 + with: + name: coverage-test-failures + path: ${{ runner.temp }}/package From 1374be72e8b5e43e87faf2ec0dddc8b3e0297748 Mon Sep 17 00:00:00 2001 From: James McMahon Date: Thu, 30 Nov 2023 15:44:42 +0000 Subject: [PATCH 12/12] Add dependabot.yml --- .github/dependabot.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..adb332c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" + day: "sunday"