Skip to content

Commit 5106c95

Browse files
committed
Update GitHub Actions workflows
1 parent 63b7891 commit 5106c95

3 files changed

Lines changed: 95 additions & 52 deletions

File tree

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

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
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
23
on:
34
push:
4-
branches:
5-
- master
5+
branches: [main, master]
66
pull_request:
7-
branches:
8-
- master
9-
10-
workflow_dispatch:
7+
branches: [main, master]
118

129
name: R-CMD-check
1310

@@ -21,7 +18,7 @@ jobs:
2118
fail-fast: false
2219
matrix:
2320
config:
24-
- {os: macOS-latest, r: 'release'}
21+
- {os: macos-latest, r: 'release'}
2522
- {os: windows-latest, r: 'release'}
2623
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
2724
- {os: ubuntu-latest, r: 'release'}
@@ -32,30 +29,21 @@ jobs:
3229
R_KEEP_PKG_SOURCE: yes
3330

3431
steps:
35-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v3
3633

37-
- uses: r-lib/actions/setup-pandoc@v1
34+
- uses: r-lib/actions/setup-pandoc@v2
3835

39-
- uses: r-lib/actions/setup-r@v1
36+
- uses: r-lib/actions/setup-r@v2
4037
with:
4138
r-version: ${{ matrix.config.r }}
4239
http-user-agent: ${{ matrix.config.http-user-agent }}
4340
use-public-rspm: true
4441

45-
- uses: r-lib/actions/setup-r-dependencies@v1
42+
- uses: r-lib/actions/setup-r-dependencies@v2
4643
with:
47-
extra-packages: rcmdcheck
48-
49-
- uses: r-lib/actions/check-r-package@v1
50-
51-
- name: Show testthat output
52-
if: always()
53-
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
54-
shell: bash
44+
extra-packages: any::rcmdcheck
45+
needs: check
5546

56-
- name: Upload check results
57-
if: failure()
58-
uses: actions/upload-artifact@main
47+
- uses: r-lib/actions/check-r-package@v2
5948
with:
60-
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
61-
path: check
49+
upload-snapshots: true

.github/workflows/lintr.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# lintr provides static code analysis for R.
6+
# It checks for adherence to a given style,
7+
# identifying syntax errors and possible semantic issues,
8+
# then reports them to you so you can take action.
9+
# More details at https://lintr.r-lib.org/
10+
11+
name: lintr
12+
13+
on:
14+
push:
15+
branches: [ "master" ]
16+
pull_request:
17+
branches: [ "master" ]
18+
19+
permissions:
20+
contents: read
21+
22+
jobs:
23+
lintr:
24+
name: Run lintr scanning
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read # for checkout to fetch code
28+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
29+
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v3
33+
34+
- name: Setup R
35+
uses: r-lib/actions/setup-r@v2
36+
37+
- name: Setup lintr
38+
uses: r-lib/actions/setup-r-dependencies@v2
39+
with:
40+
extra-packages: lintr
41+
42+
- name: Run lintr
43+
run: lintr::sarif_output(lintr::lint_dir("."), "lintr-results.sarif")
44+
shell: Rscript {0}
45+
continue-on-error: true
46+
47+
- name: Upload analysis results to GitHub
48+
uses: github/codeql-action/upload-sarif@v2
49+
with:
50+
sarif_file: lintr-results.sarif
51+
wait-for-processing: true
Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,50 @@
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
push:
3-
branches:
4-
- master
5+
branches: [main, master]
56
pull_request:
6-
branches:
7-
- master
7+
branches: [main, master]
88

99
name: test-coverage
1010

1111
jobs:
1212
test-coverage:
13-
runs-on: macOS-latest
13+
runs-on: ubuntu-latest
1414
env:
1515
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
1617
steps:
17-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
1819

19-
- uses: r-lib/actions/setup-r@master
20+
- uses: r-lib/actions/setup-r@v2
21+
with:
22+
use-public-rspm: true
2023

21-
- uses: r-lib/actions/setup-pandoc@master
24+
- uses: r-lib/actions/setup-r-dependencies@v2
25+
with:
26+
extra-packages: any::covr
27+
needs: coverage
2228

23-
- name: Query dependencies
29+
- name: Test coverage
2430
run: |
25-
install.packages('remotes')
26-
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
27-
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
31+
covr::codecov(
32+
quiet = FALSE,
33+
clean = FALSE,
34+
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
35+
)
2836
shell: Rscript {0}
2937

30-
- name: Cache R packages
31-
uses: actions/cache@v2
32-
with:
33-
path: ${{ env.R_LIBS_USER }}
34-
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
35-
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
36-
37-
- name: Install dependencies
38+
- name: Show testthat output
39+
if: always()
3840
run: |
39-
install.packages(c("remotes"))
40-
remotes::install_deps(dependencies = TRUE)
41-
remotes::install_cran("covr")
42-
shell: Rscript {0}
41+
## --------------------------------------------------------------------
42+
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
43+
shell: bash
4344

44-
- name: Test coverage
45-
run: covr::codecov()
46-
shell: Rscript {0}
45+
- name: Upload test results
46+
if: failure()
47+
uses: actions/upload-artifact@v3
48+
with:
49+
name: coverage-test-failures
50+
path: ${{ runner.temp }}/package

0 commit comments

Comments
 (0)