Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update workflows based on epiverse template #280

Merged
merged 4 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md

This file was deleted.

12 changes: 5 additions & 7 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,18 @@ jobs:
fail-fast: false
matrix:
config:
# Test with the 3 R versions and the 3 platforms from CRAN checks
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
# Exists since R 4.3.0 but `false` by default
_R_CHECK_LENGTH_COLON_: true

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/dependency-change.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ jobs:

message("Dependencies have changed! Analyzing...")

if (nrow(deps_added) > 0) {
nudge <- "Reach out on slack (`#code-review` or `#help` channels) to double check if there are base R alternatives to the new dependencies.\n"
} else {
nudge <- ""
}

msg <- glue::glue(
.sep = "\n",
"This pull request:",
Expand All @@ -60,7 +66,8 @@ jobs:
"- Removes {nrow(deps_removed)} existing dependencies (direct and indirect)",
"- Removes {length(unique(deps_removed$sysreqs))} existing system dependencies",
"",
"(Note that results may be inacurrate if you branched from an outdated version of the target branch.)"
nudge,
"(Note that results may be inaccurate if you branched from an outdated version of the target branch.)"
)

message("Posting results as a pull request comment.")
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/lint-changed-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 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:
workflow_dispatch:
pull_request:
branches: [main, master]
paths:
- '**.R'
- '**.Rmd'
- '**/.lintr'
- '**/.lintr.R'

name: lint-changed-files

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint-changed-files:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
any::gh
any::lintr
any::purrr
any::cyclocomp
epiverse-trace/etdev
needs: check

- name: Install package
run: R CMD INSTALL .

- name: Extract and lint files changed by this PR
run: |
files <- gh::gh("/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files")
changed_files <- purrr::map_chr(files, "filename")
all_files <- list.files(recursive = TRUE)
exclusions_list <- as.list(setdiff(all_files, changed_files))
lintr::lint_package(exclusions = exclusions_list)
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
16 changes: 11 additions & 5 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# ```
on:
push:
branches: [main, master, dev]
branches: [main, master]
paths:
- 'README.Rmd'
- 'README.md'
Expand Down Expand Up @@ -45,15 +45,16 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
pkgdown:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

Expand All @@ -70,9 +71,14 @@ jobs:
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Check website links
uses: untitaker/hyperlink@0.1.43
with:
args: docs/

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'merge_group' && github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@v4.7.2
with:
# We clean on releases because we want to remove old vignettes,
# figures, etc. that have been deleted from the `main` branch.
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/render_readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Reproduce locally by running:
# ```r
# pak::pak(c("any::rmarkdown", "any::usethis", "."))
# writeLines(
# knitr::knit_expand(
# "README.Rmd",
# packagename = read.dcf("DESCRIPTION", "Package"),
# gh_repo = usethis:::github_remote_list()$repo_spec
# ),
# "README_expanded.Rmd"
# )
# rmarkdown::render(
# "README_expanded.Rmd",
# output_file = "README.md",
# output_dir = "."
# )
# unlink("README_expanded.Rmd")
# ```
name: render-readme

# Controls when the action will run. Triggers include:
#
# - button trigger from github action page
# - on changes to readme.Rmd

on:
workflow_dispatch:
push:
branches:
# This may seem like a no-op but it prevents triggering on tags
# We use '**' rather '*' to accomodate names like 'dev/branch-1'
- '**'
paths:
- 'README.Rmd'
- '.github/workflows/render_readme.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
render-readme:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repos
uses: actions/checkout@v4

- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Setup pandoc
uses: r-lib/actions/setup-pandoc@v2

- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rmarkdown, local::.

- name: Compile the readme
run: |
writeLines(
knitr::knit_expand(
"README.Rmd",
packagename = read.dcf("DESCRIPTION", "Package"),
gh_repo = Sys.getenv("GITHUB_REPOSITORY")
),
"README_expanded.Rmd"
)
rmarkdown::render(
"README_expanded.Rmd",
output_file = "README.md",
output_dir = "."
)
shell: Rscript {0}

- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add README.md
# Also add README figures if they exist
if [ -d man/figures ]
then
git add man/figures/
fi
git diff-index --quiet HEAD || git commit -m "Automatic readme update"
git pull --rebase origin ${{ github.ref.name }}
git push origin || echo "No changes to push"
10 changes: 5 additions & 5 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# ```
on:
push:
branches: [main, master, dev]
branches: [main, master]
paths:
- 'R/**'
- 'src/**'
Expand Down Expand Up @@ -62,11 +62,11 @@ jobs:
covr::to_cobertura(cov)
shell: Rscript {0}

- uses: codecov/codecov-action@v4
- uses: codecov/codecov-action@v5
with:
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
files: ./cobertura.xml
plugins: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -82,4 +82,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
path: ${{ runner.temp }}/package
2 changes: 1 addition & 1 deletion .github/workflows/update-citation-cff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:

shell: Rscript {0}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
commit-message: Update `CITATION.cff`
title: Update `CITATION.cff`
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/update-copyright-year.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Update copyright year(s) in license file

on:
workflow_dispatch:
schedule:
- cron: '0 3 1 1 *'

permissions:
contents: write
pull-requests: write

jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: FantasticFiasco/action-update-license-year@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
path: |
LICENSE.md
prBody: >
This PR updates the copyright license for this new year! If you're reading this while you're celebrating, enjoy! Don't worry about this one :blush:

![Happy new year!](https://media.giphy.com/media/HyDfNCZlTn5iU/giphy.gif?cid=ecf05e4777yl7dbo1xfha6bx1z5lrl13uq7biv6rs9dqsyoh&ep=v1_gifs_search&rid=giphy.gif&ct=g)
- uses: FantasticFiasco/action-update-license-year@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
path: |
LICENSE
prBody: >
This PR updates the copyright license for this new year! If you're reading this while you're celebrating, enjoy! Don't worry about this one :blush:

![Happy new year!](https://media.giphy.com/media/HyDfNCZlTn5iU/giphy.gif?cid=ecf05e4777yl7dbo1xfha6bx1z5lrl13uq7biv6rs9dqsyoh&ep=v1_gifs_search&rid=giphy.gif&ct=g)
transform: (?<=YEAR:\s)(?<from>\d{4})?-?(\d{4})?
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
YEAR: 2023
YEAR: 2025
COPYRIGHT HOLDER: serofoi authors
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2023 serofoi authors
Copyright (c) 2025 serofoi authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Binary file modified man/figures/README-data_test-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.