Skip to content

Commit b64964b

Browse files
Align CI workflow with bancr: multi-OS matrix, secret file write, CRANT_ON_CI
- Rewrite R-CMD-check.yaml to match bancr's structure: multi-OS/R-version matrix (macOS, Windows, Ubuntu), permissions, build args - Write CAVE secret to crantr-specific file paths (proofreading.zetta.ai-cave-secret.json) instead of old env var approach - Set CRANT_ON_CI env var so testthat.R CI setup block executes - Remove stale Python/fafbseg install and token-via-R steps - Update testthat.R secret path to match crantr's CAVE server - Fix test-urls.R test name from "banc_scene" to "crant_scene" - Add .claude to .Rbuildignore Note: requires CRANT_CHUNKEDGRAPH_SECRET_JSON GitHub secret to be configured. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 079ffe2 commit b64964b

4 files changed

Lines changed: 70 additions & 66 deletions

File tree

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
^LICENSE\.md$
66
^pkgdown$
77
^\.github$
8+
^\.claude$

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

Lines changed: 55 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,78 @@
1-
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
2-
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
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
33
on:
44
push:
5-
branches:
6-
- main
7-
- master
5+
branches: [main, master]
86
pull_request:
9-
branches:
10-
- main
11-
- master
127

13-
name: R-CMD-check
8+
name: R-CMD-check.yaml
9+
10+
permissions: read-all
1411

1512
jobs:
1613
R-CMD-check:
17-
runs-on: ubuntu-latest
14+
runs-on: ${{ matrix.config.os }}
15+
16+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
config:
22+
- {os: macos-latest, r: 'release'}
23+
- {os: windows-latest, r: 'release'}
24+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
25+
- {os: ubuntu-latest, r: 'release'}
26+
- {os: ubuntu-latest, r: 'oldrel-1'}
27+
1828
env:
19-
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
2029
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
21-
CHUNKEDGRAPH_SECRET: ${{ secrets.CHUNKEDGRAPH_SECRET }}
22-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
23-
FLYTABLE_TOKEN: ${{ secrets.FLYTABLE_TOKEN }}
24-
RETICULATE_MINICONDA_PYTHON_VERSION: 3.8
25-
RGL_USE_NULL: TRUE
26-
_R_CHECK_DONTTEST_EXAMPLES_: FALSE
27-
_R_CHECK_TESTS_NLINES_: 0
28-
_R_CHECK_CRAN_INCOMING_REMOTE_: false
30+
R_KEEP_PKG_SOURCE: yes
31+
RGL_USE_NULL: "TRUE"
32+
CRANT_ON_CI: "true"
2933

3034
steps:
3135
- uses: actions/checkout@v4
3236

37+
# Unix (macOS + Linux) – bash + heredoc
38+
- name: Write CRANT cave secret (Unix)
39+
if: runner.os != 'Windows'
40+
shell: bash
41+
run: |
42+
mkdir -p ~/.cloudvolume/secrets
43+
cat << 'EOF' > ~/.cloudvolume/secrets/proofreading.zetta.ai-cave-secret.json
44+
${{ secrets.CRANT_CHUNKEDGRAPH_SECRET_JSON }}
45+
EOF
46+
cp ~/.cloudvolume/secrets/proofreading.zetta.ai-cave-secret.json \
47+
~/.cloudvolume/secrets/data.proofreading.zetta.ai-cave-secret.json
48+
49+
# Windows – PowerShell + Set-Content
50+
- name: Write CRANT cave secret (Windows)
51+
if: runner.os == 'Windows'
52+
shell: pwsh
53+
run: |
54+
$secretDir = Join-Path $env:USERPROFILE ".cloudvolume\secrets"
55+
New-Item -ItemType Directory -Force -Path $secretDir | Out-Null
56+
$secret = '${{ secrets.CRANT_CHUNKEDGRAPH_SECRET_JSON }}'
57+
$path1 = Join-Path $secretDir "proofreading.zetta.ai-cave-secret.json"
58+
$path2 = Join-Path $secretDir "data.proofreading.zetta.ai-cave-secret.json"
59+
Set-Content -Path $path1 -Value $secret -NoNewline
60+
Set-Content -Path $path2 -Value $secret -NoNewline
61+
62+
- uses: r-lib/actions/setup-pandoc@v2
63+
3364
- uses: r-lib/actions/setup-r@v2
3465
with:
66+
r-version: ${{ matrix.config.r }}
67+
http-user-agent: ${{ matrix.config.http-user-agent }}
3568
use-public-rspm: true
3669

37-
- uses: r-lib/actions/setup-pandoc@v2
38-
3970
- uses: r-lib/actions/setup-r-dependencies@v2
4071
with:
41-
extra-packages: any::rcmdcheck, any::pkgdown, catmaid=natverse/rcatmaid
72+
extra-packages: any::rcmdcheck
4273
needs: check
4374

44-
- name: Fix Conda permissions on macOS
45-
if: runner.os == 'macOS'
46-
run: sudo chown -R $UID $CONDA
47-
48-
- name: Install fafbseg + python
49-
run: |
50-
pak::local_install()
51-
library(crantr)
52-
library(fafbseg)
53-
simple_python()
54-
simple_python('none', pkgs='cloud-volume~=8.32.1')
55-
dr_fafbseg()
56-
shell: Rscript {0}
57-
58-
- name: writetoken
59-
run: |
60-
if(nzchar(Sys.getenv("CHUNKEDGRAPH_SECRET"))) {
61-
fafbseg::flywire_set_token(token = Sys.getenv("CHUNKEDGRAPH_SECRET"))
62-
} else {
63-
message("CHUNKEDGRAPH_SECRET not set, skipping token configuration")
64-
}
65-
shell: Rscript {0}
66-
6775
- uses: r-lib/actions/check-r-package@v2
68-
69-
- name: Upload check results
70-
if: failure()
71-
uses: actions/upload-artifact@v4
7276
with:
73-
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
74-
path: check
75-
76-
- name: Upload check log results
77-
if: failure()
78-
uses: actions/upload-artifact@v4
79-
with:
80-
name: ${{ matrix.config.tag }}-results
81-
path: ${{ github.event.repository.name }}.Rcheck/00check.log
82-
83-
- name: Test coverage
84-
# if: runner.os == 'macOS'
85-
if: ${{ runner.os == 'Linux' && matrix.config.r == 'release'}}
86-
run: covr::codecov(errorsAreFatal=FALSE)
87-
shell: Rscript {0}
77+
upload-snapshots: true
78+
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

tests/testthat.R

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
library(testthat)
22
library(crantr)
3-
3+
if (identical(Sys.getenv("CRANT_ON_CI"), "true")) {
4+
# Only run this on CI
5+
simple_python("basic")
6+
# Token file is written by the GitHub Actions workflow;
7+
# only call crant_set_token() if it is missing
8+
secret_path <- file.path(Sys.getenv("HOME"), ".cloudvolume", "secrets", "proofreading.zetta.ai-cave-secret.json")
9+
if (!file.exists(secret_path) || file.size(secret_path) == 0) {
10+
message("No chunkedgraph secret found at: ", secret_path)
11+
}
12+
tryCatch(fafbseg::dr_fafbseg(), error = function(e) {
13+
message("dr_fafbseg() failed: ", e$message)
14+
})
15+
}
416
test_check("crantr")

tests/testthat/test-urls.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
test_that("banc_scene works", {
1+
test_that("crant_scene works", {
22
skip_if_offline()
33
skip_if_not(crant_token_available(),
44
message="Unable to obtain a crant access token")

0 commit comments

Comments
 (0)