Skip to content

Commit

Permalink
Merge pull request #560 from olivroy/ci
Browse files Browse the repository at this point in the history
Update CI + apply some linting
  • Loading branch information
rich-iannone committed Aug 7, 2024
2 parents a147ccb + 76104c3 commit f54d9c8
Show file tree
Hide file tree
Showing 15 changed files with 148 additions and 140 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,4 @@ tests/testthat/test-utils_profiling.R
tests/testthat/test-write_testthat_file.R
tests/testthat/test-yaml.R
tests/testthat/test-yaml_exec.R
^.lintr$
42 changes: 23 additions & 19 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
# 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
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
on:
push:
branches:
- main
branches: [main, master]
pull_request:
branches:
- main
branches: [main, master]

name: R-CMD-check
name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
Expand All @@ -21,21 +27,18 @@ jobs:
- {os: macos-latest, r: 'release'}

- {os: windows-latest, r: 'release'}
# # use 4.2 to check with rtools42's older compiler
- {os: windows-latest, r: '4.2'}
# # use 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: '4.1'}

- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'oldrel-4'}
# use 4.0 or 4.1 to check with rtools40's older compiler
- {os: windows-latest, r: 'oldrel-4'}

- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: ubuntu-latest, r: 'oldrel-2'}
- {os: ubuntu-latest, r: 'oldrel-3'}
- {os: ubuntu-latest, r: 'oldrel-4'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GHA_PAT }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
Expand All @@ -57,3 +60,4 @@ jobs:
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
54 changes: 16 additions & 38 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,56 +1,34 @@
on: [push, pull_request]
# 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:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: lint
name: lint.yaml

permissions: read-all

jobs:
lint:
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.GHA_PAT }}

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-pandoc@v2

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Install package
run: R CMD INSTALL .

- name: Install dependencies
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("lintr")
shell: Rscript {0}
extra-packages: any::lintr, local::.
needs: lint

- name: Lint
run: |
out <-
lintr::lint_package(
linters = lintr::linters_with_defaults(
object_usage_linter = NULL,
trailing_whitespace_linter = NULL,
cyclocomp_linter = NULL,
indentation_linter = NULL
),
exclusions = c(
list.files("tests", recursive = TRUE, full.names = TRUE),
list.files("man", recursive = TRUE, full.names = TRUE),
list.files("vignettes", recursive = TRUE, full.names = TRUE),
list.files("data-raw", recursive = TRUE, full.names = TRUE),
list.files("inst", recursive = TRUE, full.names = TRUE)
)
)
print(out)
if (length(out)) stop("lints found")
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
47 changes: 30 additions & 17 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,50 @@
# 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:
push:
branches: main
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown
name: pkgdown.yaml

permissions: read-all

jobs:
pkgdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GHA_PAT }}

GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

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

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

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

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgdown, local::.
needs: website

- name: Install package
run: R CMD INSTALL .

- name: Build and deploy pkgdown site
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'

- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
folder: docs
44 changes: 31 additions & 13 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,61 @@
# 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:
push:
branches:
- main
branches: [main, master]
pull_request:
branches:
- main
branches: [main, master]

name: test-coverage
name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GHA_PAT }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3
- 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::covr
extra-packages: any::covr, any::xml2
needs: coverage

- name: Test coverage
run: |
covr::codecov(
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}


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

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
14 changes: 14 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
linters: linters_with_defaults(
object_usage_linter = NULL,
trailing_whitespace_linter = NULL,
# cyclocomp_linter is no longer a default linter in lintr 3.2.0
cyclocomp_linter = NULL,
indentation_linter = NULL
)
exclusions: list(
"tests",
"man",
"vignettes",
"data-raw",
"inst"
)
4 changes: 2 additions & 2 deletions R/column_roles.R
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ get_column_role_character <- function(data_column) {

}

return("string")
"string"
}

get_column_role_numeric <- function(data_column) {
Expand Down Expand Up @@ -864,7 +864,7 @@ get_column_role_numeric <- function(data_column) {
return(paste0(role, "numeric.continuous"))
}

return(paste0(role, "numeric"))
paste0(role, "numeric")
}

strptime_8601_formats <-
Expand Down
2 changes: 1 addition & 1 deletion R/get_multiagent_report.R
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,6 @@ generate_cell_content <- function(

return(cell_content)
}

NULL
# nocov end
}
6 changes: 3 additions & 3 deletions R/has_columns.R
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ has_columns <- function(
}
# Return length-0 vector if "column not found" or "0 columns" error
return(character(0L))
} else {
## If columns succesfully resolved to character, return only existing ones
return(intersect(columns, colnames(x)))
}

## If columns succesfully resolved to character, return only existing ones
intersect(columns, colnames(x))
}

# A list of columns (character vector) selected by elements of `columns`
Expand Down
4 changes: 2 additions & 2 deletions R/interrogate.R
Original file line number Diff line number Diff line change
Expand Up @@ -3161,7 +3161,7 @@ perform_action <- function(
}
}

return(NULL)
NULL
}

perform_end_action <- function(agent) {
Expand Down Expand Up @@ -3258,7 +3258,7 @@ perform_end_action <- function(agent) {
y %>% rlang::f_rhs() %>% rlang::eval_tidy()
})

return(NULL)
NULL
}

add_table_extract <- function(
Expand Down
16 changes: 7 additions & 9 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -1633,16 +1633,14 @@ print_time <- function(time_diff_s) {

if (time_diff_s < 1) {
return("")
} else {
return(
paste0(
" {.time_taken (",
round(time_diff_s, 1) %>%
formatC(format = "f", drop0trailing = FALSE, digits = 1),
" s)}"
)
)
}

paste0(
" {.time_taken (",
round(time_diff_s, 1) %>%
formatC(format = "f", drop0trailing = FALSE, digits = 1),
" s)}"
)
}

gt_missing <-
Expand Down
5 changes: 2 additions & 3 deletions R/validate_rmd.R
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,7 @@ stop_if_not <- function(...) {

return(TRUE)

} else {

return()
}

NULL
}
Loading

0 comments on commit f54d9c8

Please sign in to comment.