Add Phase 4: code quality, CI/CD, and formatting
- testthat infrastructure with 15 tests covering env-var guards, return types for all format/save functions, and spelling - inst/WORDLIST with 52 domain terms (LightGBM, MinIO, Parquet, etc.) - Spelling test wired into devtools::test() via test-spelling.R - styler::style_file() added as step 0 in deploy.R (auto-fixes before ship) - .gitea/workflows/test.yaml: runs testthat suite on push - .gitea/workflows/lint.yaml: lychee link check + styler dry-run on push - Removed internal IP address from comment in train_production_model() - Language: en-US added to DESCRIPTION Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
55
.gitea/workflows/lint.yaml
Normal file
55
.gitea/workflows/lint.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
name: Lint & Format Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
pull_request:
|
||||
branches: [main, master]
|
||||
|
||||
jobs:
|
||||
lychee:
|
||||
name: Link Check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check links
|
||||
uses: lycheeverse/lychee-action@v2
|
||||
with:
|
||||
# Scan markdown and HTML; skip local anchors and MinIO endpoints
|
||||
args: >
|
||||
--verbose
|
||||
--no-progress
|
||||
--exclude 'minio:'
|
||||
--exclude 'localhost'
|
||||
--exclude '192\.168\.'
|
||||
--exclude '172\.'
|
||||
--exclude 'git\.robwiederstein\.org'
|
||||
'**/*.md'
|
||||
'**/*.qmd'
|
||||
fail: true
|
||||
|
||||
style:
|
||||
name: Format Check (styler)
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: rocker/tidyverse:4.4
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install styler
|
||||
run: Rscript -e "install.packages('styler')"
|
||||
|
||||
- name: Check R/functions.R is styled
|
||||
run: |
|
||||
Rscript -e "
|
||||
result <- styler::style_file('R/functions.R', dry = 'fail')
|
||||
if (any(result\$changed)) {
|
||||
cat('Formatting errors in R/functions.R. Run styler::style_file() locally.\n')
|
||||
quit(status = 1)
|
||||
}
|
||||
"
|
||||
31
.gitea/workflows/test.yaml
Normal file
31
.gitea/workflows/test.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
name: R Package Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
pull_request:
|
||||
branches: [main, master]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: rocker/tidyverse:4.4
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
apt-get update -y
|
||||
apt-get install -y libcurl4-openssl-dev libssl-dev libxml2-dev
|
||||
|
||||
- name: Install R package dependencies
|
||||
run: |
|
||||
Rscript -e "install.packages(c('remotes', 'testthat', 'withr'))"
|
||||
Rscript -e "remotes::install_deps(dependencies = TRUE)"
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
Rscript -e "devtools::test()"
|
||||
Reference in New Issue
Block a user