Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/actions/r-check-env/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Setup R check environment"
description: "Common R environment (Pandoc, system libs, R, renv) for R CMD check and Copilot"

runs:
using: "composite"
steps:
- name: Setup Pandoc
uses: r-lib/actions/setup-pandoc@v2

- name: Install system libraries (Linux only)
if: runner.os == 'Linux'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
libcurl4-openssl-dev \
libgit2-dev libssh2-1-dev libssl-dev \
libfontconfig1-dev libfreetype6-dev libharfbuzz-dev libfribidi-dev \
libpng-dev libtiff5-dev libjpeg-dev libcairo2-dev \
libx11-dev \
libxml2-dev

- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: renv # pick R version from renv.lock
Ncpus: 6
use-public-rspm: true # faster Linux binaries

- name: Setup renv
uses: r-lib/actions/setup-renv@v2
41 changes: 41 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copilot Instructions

## Goal
Maintain passing CI (lint, unit tests, R CMD check).
Automatically fix failing tests and re-run until green.

## Stack
R (≥4.2.2), Shiny, renv, testthat (edition 3), lintr, GitHub Actions.

## Code and Naming Conventions
- Use native pipe |>, line length ≤80 and indent of 4 spaces.
- Ideally, the body of a function/module fits within 50 lines and
should rarely exceed 100 lines. If it does, consider refactoring.
- Document all functions with roxygen2 headers. The header should end
with an @noRd tag unless they are @export ed.
- Maintain file naming consistent with existing structure.

## Test Practices
- Add tests for new logic immediately.
- Name tests: tests/testthat/test_<source>.R
- Individual files can be tested via devtools::test(filter = <source>.R).
- Use mockery for external deps.
- If a test fails: inspect, patch code or tests, and
re-run devtools::test(filter = <source>.R).

#### Full check (= “green CI pipeline”)

When working on an issue, *before* creating a Pull Request,
you MUST follow these steps:

1) `lintr::lint_package()` — fix all lints.
2) `devtools::test()` — fix failing tests.
3) `rcmdcheck::rcmdcheck(args='--no-manual', error_on='warning')` — fix all errors/warnings.

Target in step 3: **0 errors / 0 warnings** (notes preferably 0).

If you are unable to fix all issues within **45 minutes**,
commit your latest changes, then stop, and do *not* open a PR.

## Commit Messages
Conventional commits (feat:, fix:, test:, refactor:, docs:).
31 changes: 4 additions & 27 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ jobs:
r-version: renv # pick R version from renv.lock
Ncpus: 6
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::lintr
needs: lintr

- name: Lint
shell: Rscript {0}
run: |
Expand Down Expand Up @@ -62,37 +64,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v4
with:
lfs: true

# Pandoc for rmarkdown/knitr/pkgdown/vignettes
- uses: r-lib/actions/setup-pandoc@v2

- name: Install system libraries
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
cmake \
libcurl4-openssl-dev \
libgit2-dev libssh2-1-dev libssl-dev \
libfontconfig1-dev libfreetype6-dev libharfbuzz-dev libfribidi-dev \
libpng-dev libtiff5-dev libjpeg-dev libcairo2-dev \
libx11-dev \
libxml2-dev

- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
r-version: renv # pick R version from renv.lock
Ncpus: 6
use-public-rspm: true # faster Linux binaries
# working-directory: . # set if renv.lock is not at repo root

- name: Setup renv
uses: r-lib/actions/setup-renv@v2
- uses: ./.github/actions/r-check-env

- name: R CMD check with renv-pinned deps
shell: Rscript {0}
Expand All @@ -106,7 +84,6 @@ jobs:
TESTTHAT_CPUS: 6
_R_CHECK_LIMIT_CORES_: FALSE # allow more than 2 cores


- name: R CMD check against current CRAN
uses: r-lib/actions/check-r-package@v2
with:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Copilot Setup Steps"

# Automatically run the setup steps when they are changed to allow for easy validation, and
# allow manual testing through the repository's "Actions" tab. In addition, the setup steps
# are run each time before Copilot starts working independently from below filters.
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml


jobs:
copilot-setup-steps:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
lfs: true

- uses: ./.github/actions/r-check-env
Loading