Skip to content

Commit 2cdfd11

Browse files
lazappircannood
andauthored
Update GitHub actions based on those used by {rhdf5} (#378)
* Add R-CMD-check-bioc GHA * Remove rhdf5 reinstall from pkgdown GHA * Add test-coverage GHA * Use latest OS versions in R-CMD-check-bioc GHA * Only run BiocCheck on Ubuntu devel * Run usethis::use_coverage() * Remove R-CMD-check GHA * Use checkout@v5 in R-CMD-check-bioc * Show testthat output and update results * Adjust directory to show testthat output * Try finding check directory * Try manually setting paths * Show working directory * Add Linux dependencies for rhdf5 * Show more paths... * Fix working-dir variable * Normalise working dir * Use R to normalise paths for Windows compatibility * Move paths after R is installed * Adjust path logic * Use R to set paths * Fix path name * Only normalise output paths * More path fixes * Adjust check path for non-Windows * Fix typo * Fix .Platform instead of platform * Fix pkg_dir instead of pkg_name * Tidy R-CMD-check-bioc workflow * Add Linux dependencies to test-coverage GHA * Restore README whitespace * Fix README whitespace * Run R-CMD-check-bioc on all PRs Co-authored-by: Robrecht Cannoodt <rcannood@gmail.com> * Use checkout@v5 in test-coverage Co-authored-by: Robrecht Cannoodt <rcannood@gmail.com> * Remove README.md whitespace Co-authored-by: Robrecht Cannoodt <rcannood@gmail.com> --------- Co-authored-by: Robrecht Cannoodt <rcannood@gmail.com>
1 parent eb1f739 commit 2cdfd11

7 files changed

Lines changed: 211 additions & 97 deletions

File tree

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
^Meta$
1717
^man/figures/*\.svg$
1818
^data$
19+
^codecov\.yml$
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Based on workflows from https://github.com/Huber-group-EMBL/rhdf5
2+
# Uses steps from https://github.com/grimbough/bioc-actions
3+
on:
4+
push:
5+
branches:
6+
- devel
7+
pull_request:
8+
9+
name: R-CMD-check-bioc
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
17+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
18+
19+
jobs:
20+
R-CMD-check-bioc:
21+
runs-on: ${{ matrix.config.os }}
22+
23+
name: ${{ matrix.config.os }} (${{ matrix.config.bioc-version }})
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
config:
29+
- { os: windows-latest, bioc-version: 'devel', bioc-mirror: 'https://bioconductor.posit.co/', Ncpus: 2}
30+
- { os: macOS-latest, bioc-version: 'devel', bioc-mirror: 'https://bioconductor.posit.co/', Ncpus: 3}
31+
- { os: macOS-15-intel, bioc-version: 'devel', bioc-mirror: 'https://bioconductor.posit.co/', Ncpus: 3}
32+
- { os: ubuntu-latest, bioc-version: 'devel', bioc-mirror: 'https://bioconductor.posit.co/', Ncpus: 4}
33+
- { os: ubuntu-latest, bioc-version: 'release', bioc-mirror: 'https://packagemanager.posit.co/bioconductor', Ncpus: 4}
34+
steps:
35+
36+
## R CMD check complains about Windows line endings without this
37+
- name: Configure git
38+
run: |
39+
git config --global core.autocrlf false
40+
41+
- name: Checkout repository
42+
uses: actions/checkout@v5
43+
44+
- name: Install Linux dependencies
45+
if: runner.os == 'Linux'
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get -y install hdf5-tools libsz2 libaec-dev
49+
50+
- name: Setup R and Bioconductor
51+
uses: grimbough/bioc-actions/setup-bioc@v1
52+
with:
53+
bioc-version: ${{ matrix.config.bioc-version }}
54+
bioc-mirror: ${{ matrix.config.bioc-mirror }}
55+
56+
- name: Set paths
57+
id: set-paths
58+
run: |
59+
current_dir <- getwd()
60+
cat("Current dir:", normalizePath(current_dir), "\n")
61+
62+
sep <- ifelse(.Platform$OS.type == "windows", "\\\\", "/")
63+
64+
pkg_name <- basename(current_dir)
65+
cat("Package name:", pkg_name, "\n")
66+
cat("pkg-name=", pkg_name, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
67+
68+
working_dir <- ".."
69+
working_dir_norm <- normalizePath(working_dir)
70+
cat("Working dir:", working_dir_norm, "\n")
71+
cat("working-dir=", working_dir_norm, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
72+
73+
pkg_dir <- file.path(working_dir, pkg_name)
74+
pkg_dir_norm <- normalizePath(pkg_dir)
75+
cat("Package dir:", pkg_dir_norm, "\n")
76+
cat("pkg-dir=", pkg_dir_norm, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
77+
78+
# Handle different behavior of normalizePath on Windows
79+
check_dir <- if (.Platform$OS.type == "windows") {
80+
paste0(pkg_dir, ".Rcheck")
81+
} else {
82+
paste0(normalizePath(pkg_dir), ".Rcheck")
83+
}
84+
check_dir_norm <- normalizePath(check_dir)
85+
cat("Check dir:", check_dir_norm, "\n")
86+
cat("check-dir=", check_dir_norm, "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
87+
shell: Rscript {0}
88+
89+
- name: Install pandoc
90+
uses: r-lib/actions/setup-pandoc@v2
91+
92+
- name: Install R dependencies
93+
uses: r-lib/actions/setup-r-dependencies@v2
94+
with:
95+
extra-packages: any::rcmdcheck
96+
needs: check
97+
98+
- name: Bioc - Build, Install, Check
99+
uses: grimbough/bioc-actions/build-install-check@v1
100+
101+
- name: Show testthat output
102+
run: |
103+
find . -name 'testthat.Rout*' -exec cat '{}' \; || true
104+
shell: bash
105+
working-directory: ${{ steps.set-paths.outputs.working-dir }}
106+
107+
- name: Upload check results
108+
if: failure()
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: ${{ format('{0}-{1}-bioc-{2}-results', runner.os, runner.arch, env.R_BIOC_VERSION ) }}
112+
path: ${{ steps.set-paths.outputs.check-dir }}
113+
114+
- name: Run BiocCheck
115+
if: matrix.config.os == 'ubuntu-latest' && matrix.config.bioc-version == 'devel'
116+
uses: grimbough/bioc-actions/run-BiocCheck@v1
117+
with:
118+
error-on: 'never'
119+
arguments: '--no-check-bioc-help'

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

Lines changed: 0 additions & 82 deletions
This file was deleted.

.github/workflows/pkgdown.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,6 @@ jobs:
4040
extra-packages: local::.
4141
needs: website
4242

43-
# Avoid a caching issue where {rhdf5} was not restored properly
44-
- name: Reinstall {rhdf5} and check availability
45-
run: |
46-
BiocManager::install(c("rhdf5", "Rhdf5lib"), force = TRUE)
47-
48-
if (requireNamespace("rhdf5")) {
49-
cat(as.character(packageVersion("rhdf5")))
50-
} else {
51-
stop("rhdf5 not found")
52-
}
53-
shell: Rscript {0}
54-
5543
- name: Build site
5644
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
5745
shell: Rscript {0}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: devel
7+
pull_request:
8+
9+
name: test-coverage.yaml
10+
11+
permissions: read-all
12+
13+
jobs:
14+
test-coverage:
15+
runs-on: ubuntu-latest
16+
env:
17+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v5
22+
23+
- name: Install Linux dependencies
24+
if: runner.os == 'Linux'
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get -y install hdf5-tools libsz2 libaec-dev
28+
29+
- name: Setup R
30+
uses: r-lib/actions/setup-r@v2
31+
with:
32+
use-public-rspm: true
33+
34+
- name: Install R dependencies
35+
uses: r-lib/actions/setup-r-dependencies@v2
36+
with:
37+
extra-packages: any::covr, any::xml2
38+
needs: coverage
39+
40+
- name: Test coverage
41+
run: |
42+
cov <- covr::package_coverage(
43+
quiet = FALSE,
44+
clean = FALSE,
45+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
46+
)
47+
print(cov)
48+
covr::to_cobertura(cov)
49+
shell: Rscript {0}
50+
51+
- name: Upload coverage to Codecov
52+
uses: codecov/codecov-action@v5
53+
with:
54+
# Fail if error if not on PR, or if on PR and token is given
55+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
56+
files: ./cobertura.xml
57+
plugins: noop
58+
disable_search: true
59+
token: ${{ secrets.CODECOV_TOKEN }}
60+
61+
- name: Show testthat output
62+
if: always()
63+
run: |
64+
## --------------------------------------------------------------------
65+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
66+
shell: bash
67+
68+
- name: Upload test results
69+
if: failure()
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: coverage-test-failures
73+
path: ${{ runner.temp }}/package

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
<!-- badges: start -->
44
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
5-
[![R-CMD-check](https://github.com/scverse/anndataR/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/scverse/anndataR/actions/workflows/R-CMD-check.yaml)
5+
[![R-CMD-check-bioc](https://github.com/scverse/anndataR/actions/workflows/R-CMD-check-bioc.yaml/badge.svg)](https://github.com/scverse/anndataR/actions/workflows/R-CMD-check-bioc.yaml)
6+
[![Codecov test coverage](https://codecov.io/gh/scverse/anndataR/graph/badge.svg)](https://app.codecov.io/gh/scverse/anndataR)
67
[![Bioc release status](http://www.bioconductor.org/shields/build/release/bioc/anndataR.svg)](https://bioconductor.org/checkResults/release/bioc-LATEST/anndataR)
78
[![Bioc devel status](http://www.bioconductor.org/shields/build/devel/bioc/anndataR.svg)](https://bioconductor.org/checkResults/devel/bioc-LATEST/anndataR)
89
[![Bioc downloads rank](https://bioconductor.org/shields/downloads/release/anndataR.svg)](http://bioconductor.org/packages/stats/bioc/anndataR/)
@@ -77,11 +78,11 @@ Take note that you need all suggested dependencies available, and that building
7778
`vignette("anndataR", package = "anndataR")`
7879
- [**Read/write `Seurat` objects**](https://anndatar.data-intuitive.com/articles/usage_seurat.html): How to convert between `AnnData` and `Seurat` objects.
7980
`vignette("usage_seurat", package = "anndataR")`
80-
- [**Read/write `SingleCellExperiment` objects**](https://anndatar.data-intuitive.com/articles/usage_singlecellexperiment.html): How to convert between `AnnData` and `SingleCellExperiment` objects
81+
- [**Read/write `SingleCellExperiment` objects**](https://anndatar.data-intuitive.com/articles/usage_singlecellexperiment.html): How to convert between `AnnData` and `SingleCellExperiment` objects
8182
`vignette("usage_singlecellexperiment", package = "anndataR")`
8283
- [**Software Design**](https://anndatar.data-intuitive.com/articles/software_design.html): An overview of the design of the package
8384
- [**Development Status**](https://anndatar.data-intuitive.com/articles/development_status.html): An overview of the development status of the package
84-
85+
8586
## Citing **{anndataR}**
8687

8788
If you use **{anndataR}** in your work, please cite [_"anndataR improves interoperability between R and Python in single-cell transcriptomics"_](https://doi.org/10.1101/2025.08.18.669052):

codecov.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
comment: false
2+
3+
coverage:
4+
status:
5+
project:
6+
default:
7+
target: auto
8+
threshold: 1%
9+
informational: true
10+
patch:
11+
default:
12+
target: auto
13+
threshold: 1%
14+
informational: true

0 commit comments

Comments
 (0)