Skip to content

Commit d51ffd8

Browse files
update github workflow
1 parent 1947b33 commit d51ffd8

File tree

6 files changed

+138
-33
lines changed

6 files changed

+138
-33
lines changed

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
# 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
3+
#
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.
37
on:
48
push:
59
branches: [main, master]
610
pull_request:
7-
branches: [main, master]
811

9-
name: R-CMD-check
12+
name: R-CMD-check.yaml
13+
14+
permissions: read-all
1015

1116
jobs:
1217
R-CMD-check:
@@ -19,17 +24,24 @@ jobs:
1924
matrix:
2025
config:
2126
- {os: macos-latest, r: 'release'}
27+
2228
- {os: windows-latest, r: 'release'}
23-
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
24-
- {os: ubuntu-latest, r: 'release'}
25-
- {os: ubuntu-latest, r: 'oldrel-1'}
29+
# use 4.0 or 4.1 to check with rtools40's older compiler
30+
- {os: windows-latest, r: 'oldrel-4'}
31+
32+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
33+
- {os: ubuntu-latest, r: 'release'}
34+
- {os: ubuntu-latest, r: 'oldrel-1'}
35+
- {os: ubuntu-latest, r: 'oldrel-2'}
36+
- {os: ubuntu-latest, r: 'oldrel-3'}
37+
- {os: ubuntu-latest, r: 'oldrel-4'}
2638

2739
env:
2840
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
2941
R_KEEP_PKG_SOURCE: yes
3042

3143
steps:
32-
- uses: actions/checkout@v3
44+
- uses: actions/checkout@v4
3345

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

@@ -47,3 +59,4 @@ jobs:
4759
- uses: r-lib/actions/check-r-package@v2
4860
with:
4961
upload-snapshots: true
62+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

.github/workflows/pkgdown.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ on:
44
push:
55
branches: [main, master]
66
pull_request:
7-
branches: [main, master]
87
release:
98
types: [published]
109
workflow_dispatch:
1110

12-
name: pkgdown
11+
name: pkgdown.yaml
12+
13+
permissions: read-all
1314

1415
jobs:
1516
pkgdown:
@@ -19,8 +20,10 @@ jobs:
1920
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
2021
env:
2122
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
23+
permissions:
24+
contents: write
2225
steps:
23-
- uses: actions/checkout@v3
26+
- uses: actions/checkout@v4
2427

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

@@ -39,7 +42,7 @@ jobs:
3942

4043
- name: Deploy to GitHub pages 🚀
4144
if: github.event_name != 'pull_request'
42-
uses: JamesIves/github-pages-deploy-action@v4.4.1
45+
uses: JamesIves/github-pages-deploy-action@v4.5.0
4346
with:
4447
clean: false
4548
branch: gh-pages

.github/workflows/pr-commands.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
name: pr-commands.yaml
8+
9+
permissions: read-all
10+
11+
jobs:
12+
document:
13+
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
14+
name: document
15+
runs-on: ubuntu-latest
16+
env:
17+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
permissions:
19+
contents: write
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- uses: r-lib/actions/pr-fetch@v2
24+
with:
25+
repo-token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- uses: r-lib/actions/setup-r@v2
28+
with:
29+
use-public-rspm: true
30+
31+
- uses: r-lib/actions/setup-r-dependencies@v2
32+
with:
33+
extra-packages: any::roxygen2
34+
needs: pr-document
35+
36+
- name: Document
37+
run: roxygen2::roxygenise()
38+
shell: Rscript {0}
39+
40+
- name: commit
41+
run: |
42+
git config --local user.name "$GITHUB_ACTOR"
43+
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
44+
git add man/\* NAMESPACE
45+
git commit -m 'Document'
46+
47+
- uses: r-lib/actions/pr-push@v2
48+
with:
49+
repo-token: ${{ secrets.GITHUB_TOKEN }}
50+
51+
style:
52+
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }}
53+
name: style
54+
runs-on: ubuntu-latest
55+
env:
56+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
57+
permissions:
58+
contents: write
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- uses: r-lib/actions/pr-fetch@v2
63+
with:
64+
repo-token: ${{ secrets.GITHUB_TOKEN }}
65+
66+
- uses: r-lib/actions/setup-r@v2
67+
68+
- name: Install dependencies
69+
run: install.packages("styler")
70+
shell: Rscript {0}
71+
72+
- name: Style
73+
run: styler::style_pkg()
74+
shell: Rscript {0}
75+
76+
- name: commit
77+
run: |
78+
git config --local user.name "$GITHUB_ACTOR"
79+
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
80+
git add \*.R
81+
git commit -m 'Style'
82+
83+
- uses: r-lib/actions/pr-push@v2
84+
with:
85+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-coverage.yaml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ on:
44
push:
55
branches: [main, master]
66
pull_request:
7-
branches: [main, master]
87

9-
name: test-coverage
8+
name: test-coverage.yaml
9+
10+
permissions: read-all
1011

1112
jobs:
1213
test-coverage:
@@ -15,36 +16,46 @@ jobs:
1516
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1617

1718
steps:
18-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
1920

2021
- uses: r-lib/actions/setup-r@v2
2122
with:
2223
use-public-rspm: true
2324

2425
- uses: r-lib/actions/setup-r-dependencies@v2
2526
with:
26-
extra-packages: any::covr
27+
extra-packages: any::covr, any::xml2
2728
needs: coverage
2829

2930
- name: Test coverage
3031
run: |
31-
covr::codecov(
32+
cov <- covr::package_coverage(
3233
quiet = FALSE,
3334
clean = FALSE,
34-
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
35+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
3536
)
37+
covr::to_cobertura(cov)
3638
shell: Rscript {0}
3739

40+
- uses: codecov/codecov-action@v4
41+
with:
42+
# Fail if error if not on PR, or if on PR and token is given
43+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
44+
file: ./cobertura.xml
45+
plugin: noop
46+
disable_search: true
47+
token: ${{ secrets.CODECOV_TOKEN }}
48+
3849
- name: Show testthat output
3950
if: always()
4051
run: |
4152
## --------------------------------------------------------------------
42-
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
53+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
4354
shell: bash
4455

4556
- name: Upload test results
4657
if: failure()
47-
uses: actions/upload-artifact@v3
58+
uses: actions/upload-artifact@v4
4859
with:
4960
name: coverage-test-failures
5061
path: ${{ runner.temp }}/package

README.Rmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ knitr::opts_chunk$set(
1414
```
1515

1616
<!-- badges: start -->
17-
[![R-CMD-check](https://github.com/ThinkR-open/attachment/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/attachment/actions)
1817
[![Coverage status](https://codecov.io/gh/ThinkR-open/attachment/branch/main/graph/badge.svg)](https://app.codecov.io/github/ThinkR-open/attachment/tree/main)
1918
[![CRAN status](https://www.r-pkg.org/badges/version/attachment)](https://cran.r-project.org/package=attachment)
2019
![downloads](http://cranlogs.r-pkg.org/badges/attachment)
20+
[![R-CMD-check](https://github.com/ThinkR-open/attachment/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ThinkR-open/attachment/actions/workflows/R-CMD-check.yaml)
21+
[![Codecov test coverage](https://codecov.io/gh/ThinkR-open/attachment/graph/badge.svg)](https://app.codecov.io/gh/ThinkR-open/attachment)
2122
<!-- badges: end -->
2223

2324
# attachment <img src="man/figures/logo.png" align="right" alt="" width="120" />

README.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
<!-- README.md is generated from README.Rmd. Please edit that file -->
33
<!-- badges: start -->
44

5-
[![R-CMD-check](https://github.com/ThinkR-open/attachment/workflows/R-CMD-check/badge.svg)](https://github.com/ThinkR-open/attachment/actions)
65
[![Coverage
76
status](https://codecov.io/gh/ThinkR-open/attachment/branch/main/graph/badge.svg)](https://app.codecov.io/github/ThinkR-open/attachment/tree/main)
87
[![CRAN
98
status](https://www.r-pkg.org/badges/version/attachment)](https://cran.r-project.org/package=attachment)
109
![downloads](http://cranlogs.r-pkg.org/badges/attachment)
10+
[![R-CMD-check](https://github.com/ThinkR-open/attachment/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ThinkR-open/attachment/actions/workflows/R-CMD-check.yaml)
11+
[![Codecov test
12+
coverage](https://codecov.io/gh/ThinkR-open/attachment/graph/badge.svg)](https://app.codecov.io/gh/ThinkR-open/attachment)
1113
<!-- badges: end -->
1214

1315
# attachment <img src="man/figures/logo.png" align="right" alt="" width="120" />
@@ -114,22 +116,12 @@ desc_file <- attachment::att_amend_desc(path = dummypackage, inside_rmd = TRUE,
114116
#> 'update.config' was set to TRUE, hence, 'use.config' was forced to FALSE
115117
#> Saving attachment parameters to yaml config file
116118
#> Updating dummypackage documentation
117-
#> ────────────────────────────────────────────────────────────────────────────────
118-
#> Changes in roxygen2 7.0.0:
119-
#> * `%` is now escaped automatically in Markdown mode.
120-
#> Please carefully check .Rd files for changes
121-
#> ────────────────────────────────────────────────────────────────────────────────
122-
#>
123-
#> Setting `RoxygenNote` to "7.2.2"
119+
#> Setting `RoxygenNote` to "7.3.2"
120+
#> Writing 'NAMESPACE'
124121
#> ℹ Loading dummypackage
125-
#> Writing ']8;;file:///tmp/Rtmp3Dpn4h/fakepkg3538450e5c49/dummypackage/NAMESPACENAMESPACE]8;;'
126-
#> Writing ']8;;file:///tmp/Rtmp3Dpn4h/fakepkg3538450e5c49/dummypackage/NAMESPACENAMESPACE]8;;'
122+
#> Writing 'NAMESPACE'
127123
#> ℹ Loading dummypackage
128124
#> Package(s) Rcpp is(are) in category 'LinkingTo'. Check your Description file to be sure it is really what you want.
129-
#>
130-
#> [-] 1 package(s) removed: utils.
131-
#>
132-
#> [+] 2 package(s) added: stats, glue.
133125

134126
# Add Remotes if you have some installed
135127
attachment::set_remotes_to_desc(path.d = desc_file)

0 commit comments

Comments
 (0)