Skip to content

Commit

Permalink
Update github workflow (2, lintr)
Browse files Browse the repository at this point in the history
  • Loading branch information
RJMW authored Jul 16, 2024
1 parent 43e4fad commit 66132b9
Showing 1 changed file with 15 additions and 35 deletions.
50 changes: 15 additions & 35 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,52 +167,32 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
r-version: ['4.0.1']
r-version: ['release']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: r-lib/actions/setup-r@main
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}
- name: Cache R packages
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ env.R_LIBS_USER }}
key: r_cache_${{ matrix.os }}_${{ matrix.r-version }}
- name: Install non-R lintr dependencies
run: sudo apt-get install libcurl4-openssl-dev
- name: Install lintr
run: |
install.packages('remotes')
remotes::install_cran("lintr")
shell: Rscript {0}
- name: Save repositories to file
run: echo '${{ needs.setup.outputs.repository-list }}' > repository_list.txt
- name: Install packages
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: |
any::argparse
any::styler
- name: lintr
run: |
library(lintr)
linters <- with_defaults(line_length_linter = NULL, cyclocomp_linter = NULL, object_usage_linter = NULL)
con <- file("repository_list.txt", "r")
status <- 0
while (TRUE) {
repo <- readLines(con, n = 1)
if (length(repo) == 0) {
break
}
lnt <- lint_dir(repo, relative_path=T, linters=linters)
if (length(lnt) > 0) {
status <- 1
for (l in lnt) {
rel_path <- paste(repo, l$filename, sep="/")
write(paste(paste(rel_path, l$line_number, l$column_number, sep=":"), l$message), stderr())
write(paste(paste(rel_path, l$line_number, l$column_number, sep=":"), l$message), "rlint_report.txt", append=TRUE)
}
}
}
quit(status = status)
shell: Rscript {0}
- uses: actions/upload-artifact@v2
set -eo pipefail
echo '${{ needs.setup.outputs.repository-list }}' | xargs -d '\n' -n 1 ./.github/styler.R --dry off
git status
git diff --exit-code | tee rlint_report.txt
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: 'R linting output'
Expand Down

0 comments on commit 66132b9

Please sign in to comment.