Skip to content

Commit 47e5e9f

Browse files
authored
Merge pull request #186 from COMBINE-lab/refactor
Refactor
2 parents c6f88e1 + 99d3576 commit 47e5e9f

57 files changed

Lines changed: 3898 additions & 1419 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/release.yml

Lines changed: 61 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# This file was autogenerated by cargo-dist: https://opensource.axo.dev/cargo-dist/
1+
# This file was autogenerated by dist: https://axodotdev.github.io/cargo-dist
22
#
33
# Copyright 2022-2024, axodotdev
44
# SPDX-License-Identifier: MIT or Apache-2.0
55
#
66
# CI that:
77
#
88
# * checks for a Git Tag that looks like a release
9-
# * builds artifacts with cargo-dist (archives, installers, hashes)
9+
# * builds artifacts with dist (archives, installers, hashes)
1010
# * uploads those artifacts to temporary workflow zip
1111
# * on success, uploads the artifacts to a GitHub Release
1212
#
@@ -24,10 +24,10 @@ permissions:
2424
# must be a Cargo-style SemVer Version (must have at least major.minor.patch).
2525
#
2626
# If PACKAGE_NAME is specified, then the announcement will be for that
27-
# package (erroring out if it doesn't have the given version or isn't cargo-dist-able).
27+
# package (erroring out if it doesn't have the given version or isn't dist-able).
2828
#
2929
# If PACKAGE_NAME isn't specified, then the announcement will be for all
30-
# (cargo-dist-able) packages in the workspace with that version (this mode is
30+
# (dist-able) packages in the workspace with that version (this mode is
3131
# intended for workspaces with only one dist-able package, or with all dist-able
3232
# packages versioned/released in lockstep).
3333
#
@@ -45,9 +45,9 @@ on:
4545
- '**[0-9]+.[0-9]+.[0-9]+*'
4646

4747
jobs:
48-
# Run 'cargo dist plan' (or host) to determine what tasks we need to do
48+
# Run 'dist plan' (or host) to determine what tasks we need to do
4949
plan:
50-
runs-on: "ubuntu-20.04"
50+
runs-on: "ubuntu-22.04"
5151
outputs:
5252
val: ${{ steps.plan.outputs.manifest }}
5353
tag: ${{ !github.event.pull_request && github.ref_name || '' }}
@@ -56,32 +56,33 @@ jobs:
5656
env:
5757
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5858
steps:
59-
- uses: actions/checkout@v4
59+
- uses: actions/checkout@v6
6060
with:
61+
persist-credentials: false
6162
submodules: recursive
62-
- name: Install cargo-dist
63+
- name: Install dist
6364
# we specify bash to get pipefail; it guards against the `curl` command
6465
# failing. otherwise `sh` won't catch that `curl` returned non-0
6566
shell: bash
66-
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.21.1/cargo-dist-installer.sh | sh"
67-
- name: Cache cargo-dist
68-
uses: actions/upload-artifact@v4
67+
run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.31.0/cargo-dist-installer.sh | sh"
68+
- name: Cache dist
69+
uses: actions/upload-artifact@v6
6970
with:
7071
name: cargo-dist-cache
71-
path: ~/.cargo/bin/cargo-dist
72+
path: ~/.cargo/bin/dist
7273
# sure would be cool if github gave us proper conditionals...
7374
# so here's a doubly-nested ternary-via-truthiness to try to provide the best possible
7475
# functionality based on whether this is a pull_request, and whether it's from a fork.
7576
# (PRs run on the *source* but secrets are usually on the *target* -- that's *good*
7677
# but also really annoying to build CI around when it needs secrets to work right.)
7778
- id: plan
7879
run: |
79-
cargo dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
80-
echo "cargo dist ran successfully"
80+
dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json
81+
echo "dist ran successfully"
8182
cat plan-dist-manifest.json
8283
echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"
8384
- name: "Upload dist-manifest.json"
84-
uses: actions/upload-artifact@v4
85+
uses: actions/upload-artifact@v6
8586
with:
8687
name: artifacts-plan-dist-manifest
8788
path: plan-dist-manifest.json
@@ -95,33 +96,42 @@ jobs:
9596
if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') }}
9697
strategy:
9798
fail-fast: false
98-
# Target platforms/runners are computed by cargo-dist in create-release.
99+
# Target platforms/runners are computed by dist in create-release.
99100
# Each member of the matrix has the following arguments:
100101
#
101102
# - runner: the github runner
102-
# - dist-args: cli flags to pass to cargo dist
103-
# - install-dist: expression to run to install cargo-dist on the runner
103+
# - dist-args: cli flags to pass to dist
104+
# - install-dist: expression to run to install dist on the runner
104105
#
105106
# Typically there will be:
106107
# - 1 "global" task that builds universal installers
107108
# - N "local" tasks that build each platform's binaries and platform-specific installers
108109
matrix: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix }}
109110
runs-on: ${{ matrix.runner }}
111+
container: ${{ matrix.container && matrix.container.image || null }}
110112
env:
111113
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112114
BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json
113115
steps:
114116
- name: enable windows longpaths
115117
run: |
116118
git config --global core.longpaths true
117-
- uses: actions/checkout@v4
119+
- uses: actions/checkout@v6
118120
with:
121+
persist-credentials: false
119122
submodules: recursive
120-
- name: Install cargo-dist
121-
run: ${{ matrix.install_dist }}
123+
- name: Install Rust non-interactively if not already installed
124+
if: ${{ matrix.container }}
125+
run: |
126+
if ! command -v cargo > /dev/null 2>&1; then
127+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
128+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
129+
fi
130+
- name: Install dist
131+
run: ${{ matrix.install_dist.run }}
122132
# Get the dist-manifest
123133
- name: Fetch local artifacts
124-
uses: actions/download-artifact@v4
134+
uses: actions/download-artifact@v7
125135
with:
126136
pattern: artifacts-*
127137
path: target/distrib/
@@ -132,8 +142,8 @@ jobs:
132142
- name: Build artifacts
133143
run: |
134144
# Actually do builds and make zips and whatnot
135-
cargo dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
136-
echo "cargo dist ran successfully"
145+
dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json
146+
echo "dist ran successfully"
137147
- id: cargo-dist
138148
name: Post-build
139149
# We force bash here just because github makes it really hard to get values up
@@ -143,12 +153,12 @@ jobs:
143153
run: |
144154
# Parse out what we just built and upload it to scratch storage
145155
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
146-
jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"
156+
dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"
147157
echo "EOF" >> "$GITHUB_OUTPUT"
148158
149159
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
150160
- name: "Upload artifacts"
151-
uses: actions/upload-artifact@v4
161+
uses: actions/upload-artifact@v6
152162
with:
153163
name: artifacts-build-local-${{ join(matrix.targets, '_') }}
154164
path: |
@@ -160,32 +170,33 @@ jobs:
160170
needs:
161171
- plan
162172
- build-local-artifacts
163-
runs-on: "ubuntu-20.04"
173+
runs-on: "ubuntu-22.04"
164174
env:
165175
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
166176
BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json
167177
steps:
168-
- uses: actions/checkout@v4
178+
- uses: actions/checkout@v6
169179
with:
180+
persist-credentials: false
170181
submodules: recursive
171-
- name: Install cached cargo-dist
172-
uses: actions/download-artifact@v4
182+
- name: Install cached dist
183+
uses: actions/download-artifact@v7
173184
with:
174185
name: cargo-dist-cache
175186
path: ~/.cargo/bin/
176-
- run: chmod +x ~/.cargo/bin/cargo-dist
187+
- run: chmod +x ~/.cargo/bin/dist
177188
# Get all the local artifacts for the global tasks to use (for e.g. checksums)
178189
- name: Fetch local artifacts
179-
uses: actions/download-artifact@v4
190+
uses: actions/download-artifact@v7
180191
with:
181192
pattern: artifacts-*
182193
path: target/distrib/
183194
merge-multiple: true
184195
- id: cargo-dist
185196
shell: bash
186197
run: |
187-
cargo dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
188-
echo "cargo dist ran successfully"
198+
dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json
199+
echo "dist ran successfully"
189200
190201
# Parse out what we just built and upload it to scratch storage
191202
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
@@ -194,7 +205,7 @@ jobs:
194205
195206
cp dist-manifest.json "$BUILD_MANIFEST_NAME"
196207
- name: "Upload artifacts"
197-
uses: actions/upload-artifact@v4
208+
uses: actions/upload-artifact@v6
198209
with:
199210
name: artifacts-build-global
200211
path: |
@@ -206,46 +217,47 @@ jobs:
206217
- plan
207218
- build-local-artifacts
208219
- build-global-artifacts
209-
# Only run if we're "publishing", and only if local and global didn't fail (skipped is fine)
210-
if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
220+
# Only run if we're "publishing", and only if plan, local and global didn't fail (skipped is fine)
221+
if: ${{ always() && needs.plan.result == 'success' && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}
211222
env:
212223
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
213-
runs-on: "ubuntu-20.04"
224+
runs-on: "ubuntu-22.04"
214225
outputs:
215226
val: ${{ steps.host.outputs.manifest }}
216227
steps:
217-
- uses: actions/checkout@v4
228+
- uses: actions/checkout@v6
218229
with:
230+
persist-credentials: false
219231
submodules: recursive
220-
- name: Install cached cargo-dist
221-
uses: actions/download-artifact@v4
232+
- name: Install cached dist
233+
uses: actions/download-artifact@v7
222234
with:
223235
name: cargo-dist-cache
224236
path: ~/.cargo/bin/
225-
- run: chmod +x ~/.cargo/bin/cargo-dist
237+
- run: chmod +x ~/.cargo/bin/dist
226238
# Fetch artifacts from scratch-storage
227239
- name: Fetch artifacts
228-
uses: actions/download-artifact@v4
240+
uses: actions/download-artifact@v7
229241
with:
230242
pattern: artifacts-*
231243
path: target/distrib/
232244
merge-multiple: true
233245
- id: host
234246
shell: bash
235247
run: |
236-
cargo dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
248+
dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json
237249
echo "artifacts uploaded and released successfully"
238250
cat dist-manifest.json
239251
echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"
240252
- name: "Upload dist-manifest.json"
241-
uses: actions/upload-artifact@v4
253+
uses: actions/upload-artifact@v6
242254
with:
243255
# Overwrite the previous copy
244256
name: artifacts-dist-manifest
245257
path: dist-manifest.json
246258
# Create a GitHub Release while uploading all files to it
247259
- name: "Download GitHub Artifacts"
248-
uses: actions/download-artifact@v4
260+
uses: actions/download-artifact@v7
249261
with:
250262
pattern: artifacts-*
251263
path: artifacts
@@ -274,10 +286,11 @@ jobs:
274286
# still allowing individual publish jobs to skip themselves (for prereleases).
275287
# "host" however must run to completion, no skipping allowed!
276288
if: ${{ always() && needs.host.result == 'success' }}
277-
runs-on: "ubuntu-20.04"
289+
runs-on: "ubuntu-22.04"
278290
env:
279291
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
280292
steps:
281-
- uses: actions/checkout@v4
293+
- uses: actions/checkout@v6
282294
with:
295+
persist-credentials: false
283296
submodules: recursive

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ TEST_REF
2222
TEST_REF_CLAPV4
2323
TEST_REF_ROERS
2424
blarg
25+
26+
# macOS Finder metadata
27+
**/.DS_Store

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "simpleaf"
33
version = "0.19.5"
4-
edition = "2021"
4+
edition = "2024"
55
authors = [
66
"Rob Patro <rob@cs.umd.edu>",
77
"Dongze He <dhe17@umd.edu>",
@@ -15,6 +15,7 @@ homepage = "https://simpleaf.readthedocs.io"
1515
#documentation = "https://fry.readthedocs.io/en/latest/"
1616
include = [
1717
"/src/*.rs",
18+
"/src/core/*.rs",
1819
"/src/utils/*.rs",
1920
"/src/utils/af_utils/*.rs",
2021
"/src/atac/*.rs",
@@ -85,6 +86,7 @@ regex = { version = "1.11.1", default-features = false, features = [
8586
tempfile = "3.19.1"
8687
ureq = { version = "3.0.11", features = ["json"] }
8788
af-anndata = { version = "0.3.3", git = "https://github.com/COMBINE-lab/af-anndata" }
89+
file-requirements = "0.1.0"
8890

8991
[profile.release]
9092
lto = "thin"
@@ -94,27 +96,3 @@ opt-level = 3
9496
[profile.dist]
9597
inherits = "release"
9698
lto = "thin"
97-
98-
# Config for 'cargo dist'
99-
[workspace.metadata.dist]
100-
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
101-
cargo-dist-version = "0.21.1"
102-
# CI backends to support
103-
ci = "github"
104-
# The installers to generate for each app
105-
installers = ["shell"]
106-
# Target platforms to build apps for (Rust target-triple syntax)
107-
targets = [
108-
"aarch64-apple-darwin",
109-
"x86_64-apple-darwin",
110-
"x86_64-unknown-linux-gnu",
111-
]
112-
# Which actions to run on pull requests
113-
pr-run-mode = "plan"
114-
# Whether to install an updater program
115-
install-updater = true
116-
# Path that installers should place binaries in
117-
install-path = "CARGO_HOME"
118-
119-
[workspace.metadata.dist.github-custom-runners]
120-
aarch64-apple-darwin = "macos-14"

dist-workspace.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[workspace]
2+
members = ["cargo:."]
3+
4+
# Config for 'dist'
5+
[dist]
6+
# The preferred dist version to use in CI (Cargo.toml SemVer syntax)
7+
cargo-dist-version = "0.31.0"
8+
# CI backends to support
9+
ci = "github"
10+
# The installers to generate for each app
11+
installers = ["shell"]
12+
# Target platforms to build apps for (Rust target-triple syntax)
13+
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu"]
14+
# Which actions to run on pull requests
15+
pr-run-mode = "plan"
16+
# Whether to install an updater program
17+
install-updater = true
18+
# Path that installers should place binaries in
19+
install-path = "CARGO_HOME"
20+
21+
[dist.github-custom-runners]
22+
aarch64-apple-darwin = "macos-14"

0 commit comments

Comments
 (0)