Skip to content

Commit 3e23b30

Browse files
authored
Update GitHub Actions workflows, and make necessary tweaks to support them (#279)
* Bump Ubuntu version from 18.04 to 20.04 * Fully update GitHub Actions workflows * Avoid `R_compact_intrange()` in favor of `:` Closes #280 * Avoid unused variable warning on Windows about `cpp11::preserved` * Add a remote on r-lib/testthat#1673 * Add old archives to be able to install gcc 4.8 * Depend only on dev testthat now that the PR has been merged * Set `CC` as well for `pkgbuild:::has_compiler_colored_diagnostics()` Otherwise this will incorrectly return `TRUE` because it compiles a C program rather than a C++ one to check if color support is available, which adds the `-fdiagnostics-color=always` flag, but g++ 4.8 doesn't actually support that, so the compilation of the C++ code in the vignettes would fail * NEWS bullet * Pin to a specific testthat SHA * Use `seq()` rather than `:` to generate the ALTREP compact-seq vector
1 parent cb1a688 commit 3e23b30

File tree

11 files changed

+172
-160
lines changed

11 files changed

+172
-160
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 47 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
# NOTE: This workflow is overkill for most R packages
2-
# check-standard.yaml is likely a better choice
3-
# usethis::use_github_action("check-standard") will install it.
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
43
#
5-
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
6-
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
4+
# NOTE: This workflow is overkill for most R packages and
5+
# check-standard.yaml is likely a better choice.
6+
# usethis::use_github_action("check-standard") will install it.
77
on:
88
push:
9-
branches:
10-
- main
11-
- master
9+
branches: [main, master]
1210
pull_request:
13-
branches:
14-
- main
15-
- master
11+
branches: [main, master]
1612

1713
name: R-CMD-check
1814

@@ -27,92 +23,74 @@ jobs:
2723
matrix:
2824
config:
2925
- {os: macOS-latest, r: 'release'}
26+
3027
- {os: windows-latest, r: 'release'}
31-
- {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"}
32-
- {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.1.0 (ubuntu-18.04) R (4.1.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
33-
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", custom: 'no-cpp11test'}
34-
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", custom: 'gcc 4.8'}
35-
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
36-
- {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
37-
- {os: ubuntu-18.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
38-
- {os: ubuntu-18.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
39-
- {os: ubuntu-18.04, r: '3.4', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
28+
# Use 3.6 to trigger usage of RTools35
29+
- {os: windows-latest, r: '3.6'}
30+
31+
# Use older ubuntu to maximise backward compatibility
32+
- {os: ubuntu-20.04, r: 'devel', http-user-agent: 'release'}
33+
- {os: ubuntu-20.04, r: 'release'}
34+
- {os: ubuntu-20.04, r: 'release', custom: 'no-cpp11test'}
35+
- {os: ubuntu-20.04, r: 'release', custom: 'gcc 4.8'}
36+
- {os: ubuntu-20.04, r: 'oldrel-1'}
37+
- {os: ubuntu-20.04, r: 'oldrel-2'}
38+
- {os: ubuntu-20.04, r: 'oldrel-3'}
39+
- {os: ubuntu-20.04, r: 'oldrel-4'}
4040

4141
env:
42-
RSPM: ${{ matrix.config.rspm }}
4342
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
43+
R_KEEP_PKG_SOURCE: yes
4444

4545
steps:
4646
- uses: actions/checkout@v2
4747

48-
- uses: r-lib/actions/setup-r@v1
49-
id: install-r
48+
- uses: r-lib/actions/setup-pandoc@v2
49+
50+
- uses: r-lib/actions/setup-r@v2
5051
with:
5152
r-version: ${{ matrix.config.r }}
5253
http-user-agent: ${{ matrix.config.http-user-agent }}
53-
54-
- uses: r-lib/actions/setup-pandoc@v1
55-
56-
- name: Install pak and query dependencies
57-
run: |
58-
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
59-
saveRDS(pak::pkg_deps("local::.", dependencies = TRUE), ".github/r-depends.rds")
60-
shell: Rscript {0}
61-
62-
- name: Restore R package cache
63-
uses: actions/cache@v2
64-
with:
65-
path: |
66-
${{ env.R_LIBS_USER }}/*
67-
!${{ env.R_LIBS_USER }}/pak
68-
key: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
69-
restore-keys: ${{ matrix.config.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
70-
71-
- name: Install system dependencies
72-
if: runner.os == 'Linux'
73-
run: |
74-
pak::local_system_requirements(execute = TRUE)
75-
pak::pkg_system_requirements("rcmdcheck", execute = TRUE)
76-
shell: Rscript {0}
54+
use-public-rspm: true
7755

7856
- name : Install compiler version
57+
# We check on this old compiler specifically to support CentOS 7,
58+
# which uses this gcc version. RStudio products support CentOS 7 through
59+
# June 2024.
60+
# https://github.com/r-lib/cpp11/pull/78
61+
# https://www.rstudio.com/about/platform-support/
62+
# Ubuntu 20.04 technically dropped support for gcc 4.8, so we have to
63+
# add old archives back in manually to install it
64+
# https://github.com/r-lib/cpp11/pull/279
7965
if: matrix.config.custom == 'gcc 4.8'
8066
run: |
67+
echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial main" | sudo tee -a /etc/apt/sources.list
68+
echo "deb http://dk.archive.ubuntu.com/ubuntu/ xenial universe" | sudo tee -a /etc/apt/sources.list
69+
sudo apt update
8170
sudo apt-get install -y g++-4.8
8271
mkdir ~/.R/
83-
echo $'CXX1X=g++-4.8\nCXX11=g++-4.8' >> ~/.R/Makevars
72+
echo $'CXX1X=g++-4.8\nCXX11=g++-4.8\nCC=gcc-4.8' >> ~/.R/Makevars
8473
85-
- name: install macOS system dependecies
74+
- name: Install macOS system dependencies
8675
if: runner.os == 'macOS'
8776
run: brew install --cask xquartz
8877

89-
- name: Install dependencies
90-
run: |
91-
pak::local_install_dev_deps(upgrade = TRUE)
92-
pak::pkg_install("rcmdcheck")
93-
shell: Rscript {0}
78+
- uses: r-lib/actions/setup-r-dependencies@v2
79+
with:
80+
extra-packages: any::rcmdcheck
81+
needs: check
9482

95-
- name: Install cpp11 and cpp11test
83+
- name: Install cpp11test
9684
if: matrix.config.custom != 'no-cpp11test'
9785
run: |
9886
options(warn = 2)
99-
install.packages(".", repos = NULL, type = "source")
100-
pak::local_install_dev_deps("cpp11test")
87+
pak::local_install_dev_deps("cpp11test", dependencies = TRUE)
10188
install.packages("cpp11test", repos = NULL, INSTALL_opts = "--install-tests", type = "source")
10289
shell: Rscript {0}
10390

104-
- name: Session info
105-
run: |
106-
options(width = 100)
107-
pkgs <- installed.packages()[, "Package"]
108-
sessioninfo::session_info(pkgs, include_base = TRUE)
109-
shell: Rscript {0}
110-
111-
- name: Check
112-
env:
113-
_R_CHECK_CRAN_INCOMING_: false
114-
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
115-
shell: Rscript {0}
91+
- uses: r-lib/actions/check-r-package@v2
92+
with:
93+
upload-snapshots: true
11694

11795
- name: Run cpp11test tests
11896
if: matrix.config.custom != 'no-cpp11test'
@@ -122,20 +100,3 @@ jobs:
122100
library(cpp11test)
123101
test_check("cpp11test", reporter = "progress")
124102
shell: Rscript {0}
125-
126-
- name: Show testthat output
127-
if: always()
128-
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
129-
shell: bash
130-
131-
- name: Upload check results
132-
if: failure()
133-
uses: actions/upload-artifact@main
134-
with:
135-
name: ${{ matrix.config.os }}-r${{ matrix.config.r }}-results
136-
path: check
137-
138-
- name: Don't use tar from old Rtools to store the cache
139-
if: ${{ runner.os == 'Windows' && startsWith(steps.install-r.outputs.installed-r-version, '3.6' ) }}
140-
shell: bash
141-
run: echo "C:/Program Files/Git/usr/bin" >> $GITHUB_PATH

.github/workflows/format.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name: format_check
99

1010
jobs:
1111
format_check:
12-
runs-on: ubuntu-18.04
12+
runs-on: ubuntu-20.04
1313
steps:
1414
- uses: actions/checkout@v2
1515

.github/workflows/pkgdown.yaml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,48 @@
1-
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
22
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
33
on:
44
push:
55
branches: [main, master]
6-
tags: ['*']
6+
pull_request:
7+
branches: [main, master]
8+
release:
9+
types: [published]
10+
workflow_dispatch:
711

812
name: pkgdown
913

1014
jobs:
1115
pkgdown:
1216
runs-on: ubuntu-latest
17+
# Only restrict concurrency for non-PR jobs
18+
concurrency:
19+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
1320
env:
1421
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1522
steps:
1623
- uses: actions/checkout@v2
1724

18-
- uses: r-lib/actions/setup-pandoc@v1
25+
- uses: r-lib/actions/setup-pandoc@v2
1926

20-
- uses: r-lib/actions/setup-r@v1
27+
- uses: r-lib/actions/setup-r@v2
2128
with:
2229
use-public-rspm: true
2330

24-
- uses: r-lib/actions/setup-r-dependencies@v1
31+
- uses: r-lib/actions/setup-r-dependencies@v2
2532
with:
26-
extra-packages: local::. local::cpp11test pkgdown
33+
extra-packages: any::pkgdown, local::., local::cpp11test
2734
needs: website
2835

29-
- name: Deploy package
36+
- name: Build site
3037
env:
3138
CPP11_EVAL: true
32-
run: |
33-
git config --local user.name "$GITHUB_ACTOR"
34-
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
35-
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
39+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
40+
shell: Rscript {0}
41+
42+
- name: Deploy to GitHub pages 🚀
43+
if: github.event_name != 'pull_request'
44+
uses: JamesIves/github-pages-deploy-action@4.1.4
45+
with:
46+
clean: false
47+
branch: gh-pages
48+
folder: docs

.github/workflows/pr-commands.yaml

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,79 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
13
on:
24
issue_comment:
35
types: [created]
6+
47
name: Commands
8+
59
jobs:
610
document:
7-
if: startsWith(github.event.comment.body, '/document')
11+
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
812
name: document
9-
runs-on: macOS-latest
13+
runs-on: ubuntu-latest
1014
env:
1115
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1216
steps:
1317
- uses: actions/checkout@v2
14-
- uses: r-lib/actions/pr-fetch@v1
18+
19+
- uses: r-lib/actions/pr-fetch@v2
1520
with:
1621
repo-token: ${{ secrets.GITHUB_TOKEN }}
17-
- uses: r-lib/actions/setup-r@v1
18-
- name: Install dependencies
19-
run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)'
22+
23+
- uses: r-lib/actions/setup-r@v2
24+
with:
25+
use-public-rspm: true
26+
27+
- uses: r-lib/actions/setup-r-dependencies@v2
28+
with:
29+
extra-packages: any::roxygen2
30+
needs: pr-document
31+
2032
- name: Document
21-
run: Rscript -e 'roxygen2::roxygenise()'
33+
run: roxygen2::roxygenise()
34+
shell: Rscript {0}
35+
2236
- name: commit
2337
run: |
24-
git config --local user.email "actions@github.com"
25-
git config --local user.name "GitHub Actions"
38+
git config --local user.name "$GITHUB_ACTOR"
39+
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
2640
git add man/\* NAMESPACE
2741
git commit -m 'Document'
28-
- uses: r-lib/actions/pr-push@v1
42+
43+
- uses: r-lib/actions/pr-push@v2
2944
with:
3045
repo-token: ${{ secrets.GITHUB_TOKEN }}
46+
3147
style:
32-
if: startsWith(github.event.comment.body, '/style')
48+
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }}
3349
name: style
34-
runs-on: macOS-latest
50+
runs-on: ubuntu-latest
3551
env:
3652
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
3753
steps:
3854
- uses: actions/checkout@v2
39-
- uses: r-lib/actions/pr-fetch@v1
55+
56+
- uses: r-lib/actions/pr-fetch@v2
4057
with:
4158
repo-token: ${{ secrets.GITHUB_TOKEN }}
42-
- uses: r-lib/actions/setup-r@v1
59+
60+
- uses: r-lib/actions/setup-r@v2
61+
4362
- name: Install dependencies
44-
run: Rscript -e 'install.packages("styler")'
63+
run: install.packages("styler")
64+
shell: Rscript {0}
65+
4566
- name: Style
46-
run: Rscript -e 'styler::style_pkg()'
67+
run: styler::style_pkg()
68+
shell: Rscript {0}
69+
4770
- name: commit
4871
run: |
49-
git config --local user.email "actions@github.com"
50-
git config --local user.name "GitHub Actions"
72+
git config --local user.name "$GITHUB_ACTOR"
73+
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
5174
git add \*.R
5275
git commit -m 'Style'
53-
- uses: r-lib/actions/pr-push@v1
76+
77+
- uses: r-lib/actions/pr-push@v2
5478
with:
5579
repo-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)