Skip to content

Commit 968fd10

Browse files
authored
Merge branch 'integrate-conda' into chain-multiple-labels
2 parents 33949e5 + 7c76534 commit 968fd10

12 files changed

Lines changed: 158 additions & 23 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ Put an `x` in the boxes that apply. You can also fill these out after creating t
1717

1818
- [ ] Changes have been tested to ensure that fix is effective or that a feature works.
1919
- [ ] Changes pass the unit tests
20+
- [ ] Changes pass the wet run tests
2021
- [ ] Code has been run through the `poe quality` task
2122
- [ ] I have included necessary documentation or comments (as necessary)
2223
- [ ] Any dependent changes have been merged and published
2324

2425
## Notes
25-
All PRs will undergo the unit testing before being reviewed. You may be requested to explain or make additional changes before the PR is accepted.
26+
All PRs will undergo unit and wet run testing before being reviewed. You may be requested to explain or make additional changes before the PR is accepted.

.github/workflows/push_conda.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
# .github/workflows/build-conda.yml
3+
name: Build and Upload Conda Package
4+
on:
5+
push:
6+
branches: [integrate-conda]
7+
workflow_dispatch:
8+
jobs:
9+
build-and-upload:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
- name: Cache conda build cache
15+
uses: actions/cache@v3
16+
with:
17+
path: /home/runner/miniconda3/conda-bld
18+
key: ${{ runner.os }}-conda-bld-${{ hashFiles('recipe/meta.yaml') }}
19+
restore-keys: |
20+
${{ runner.os }}-conda-bld-
21+
- name: Setup Miniforge and mamba
22+
uses: conda-incubator/setup-miniconda@v3
23+
with:
24+
miniforge-variant: Miniforge3
25+
miniforge-version: latest
26+
mamba-version: '*'
27+
use-mamba: true
28+
conda-solver: libmamba
29+
auto-activate-base: true
30+
- name: Install dependencies
31+
run: |
32+
mamba install -y -c conda-forge conda-build anaconda-client boa
33+
- name: Get latest commit SHA from integrate-conda branch
34+
id: get_sha
35+
run: |
36+
echo "Fetching latest commit on integrate-conda branch..."
37+
COMMIT_SHA=$(git ls-remote origin refs/heads/integrate-conda | cut -f1)
38+
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
39+
- name: Update meta.yaml with latest ref and sha256
40+
run: |
41+
echo "Updating meta.yaml with commit: $COMMIT_SHA"
42+
43+
# 1) Update the Jinja-set 'ref' (this is fine)
44+
sed -i "s|^{% set ref = \".*\" %}|{% set ref = \"$COMMIT_SHA\" %}|" ./recipe/meta.yaml
45+
46+
# 2) Download the tarball and compute the checksum
47+
curl -L -o source.tar.gz \
48+
https://github.com/khanlab/labelmerge/archive/${COMMIT_SHA}.tar.gz
49+
SHA256_SUM=$(sha256sum source.tar.gz | awk '{print $1}')
50+
echo "New sha256: $SHA256_SUM"
51+
52+
# 3) Replace the literal 'sha256:' line under source:
53+
sed -i "s|^\(\s*sha256:\s*\).*|\1$SHA256_SUM|" ./recipe/meta.yaml
54+
- name: Build & capture path
55+
id: build
56+
run: |
57+
cd recipe
58+
OUT=$(conda build . -c conda-forge -c bioconda --output 2>/dev/null)
59+
echo "PACKAGE_PATH=$OUT" >> $GITHUB_ENV
60+
conda mambabuild . -c conda-forge -c bioconda
61+
- name: Upload package to Khanlab channel
62+
shell: bash -l {0}
63+
run: |-
64+
conda activate base
65+
anaconda login \
66+
--username ${{ secrets.ANACONDA_USERNAME }} \
67+
--password ${{ secrets.ANACONDA_PASSWORD }}
68+
anaconda upload "$PACKAGE_PATH" \
69+
--label main \
70+
--force \
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,3 @@ jobs:
1010
secrets:
1111
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
1212
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
13-
deploy-pypi:
14-
uses: khanlab/actions/.github/workflows/workflow-release_task-deployPypi.yml@v0.3.4
15-
secrets:
16-
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/quality.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
name: Lint and format workflow
33
on:
44
push:
5-
branches: ["*", "!push-action/*"]
5+
branches: ['*', '!push-action/*']
66
pull_request:
7-
branches: ["*", "!push-action/*"]
7+
branches: ['*', '!push-action/*']
88
jobs:
99
quality:
1010
name: Lint code
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup Python environment
1515
uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.4
1616
with:
17-
python-version: "3.11"
17+
python-version: '3.11'
1818
- name: yamlfix
1919
run: poetry run poe yamlfix-check
2020
- name: ruff

.github/workflows/wetrun_test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,18 @@ jobs:
3232
echo "LABELMERGE_CACHE_DIR=`pwd`/test_data/labelmerge_cache_dir" >> $GITHUB_ENV
3333
- name: Run wet-run test for cortical and subcortical files
3434
shell: bash -l {0}
35-
run: |
35+
run: |-
3636
conda activate snakebids-env
3737
./labelmerge/run.py test_data/bids_wetrun_testing/tpl-MNI152NLin2009cAsym test_out participant \
3838
--base-desc 100Parcels7Networks --overlay_bids_dir test_data/bids_wetrun_testing/tpl-MNI152NLin2009cAsym \
3939
--overlay_desc tn --cores all --force-output --conda-frontend mamba | tee labelmerge_output.log
40+
<<<<<<< chain-multiple-labels
4041
- name: Run wet-run test for merging 3 labels
4142
shell: bash -l {0}
4243
run: |
4344
conda activate snakebids-env
4445
./labelmerge/run.py test_data/bids_wetrun_testing/tpl-MNI152NLin2009cAsym test_out participant \
4546
--base-desc 100Parcels7Networks --overlay_bids_dir test_data/bids_wetrun_testing/tpl-MNI152NLin2009cAsym \
46-
--overlay_desc tn --overlay2_bids_dir test_data/bids_wetrun_testing/tpl-MNI152NLin2009cAsym/ --overlay2_desc carpet --cores all --force-output --conda-frontend mamba | tee labelmerge_output.log
47+
--overlay_desc tn --overlay2_bids_dir test_data/bids_wetrun_testing/tpl-MNI152NLin2009cAsym/ --overlay2_desc carpet --cores all --force-output --conda-frontend mamba | tee labelmerge_output.log
48+
=======
49+
>>>>>>> integrate-conda

.readthedocs.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
1+
---
12
# .readthedocs.yml
23
# Read the Docs configuration file
34
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
45

56
# Required
67
version: 2
7-
88
# Build documentation in the docs/ directory with Sphinx
99
sphinx:
1010
configuration: docs/conf.py
11-
1211
# Build documentation with MkDocs
13-
#mkdocs:
12+
# mkdocs:
1413
# configuration: mkdocs.yml
1514

1615
# Optionally build your docs in additional formats such as PDF
17-
formats:
18-
- pdf
19-
16+
formats: [pdf]
2017
build:
21-
os: 'ubuntu-20.04'
18+
os: ubuntu-20.04
2219
tools:
2320
python: '3.11'
24-
2521
python:
2622
install:
2723
- requirements: docs/requirements.txt

labelmerge-dev.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: labelmerge-dev
3+
channels: [conda-forge, bioconda, defaults]
4+
dependencies:
5+
- python=3.11
6+
- snakebids=0.14.0
7+
- pytest>=7.0.1,<8.0.0
8+
- pytest-console-scripts>=1.2,<2.0
9+
- poethepoet>=0.10.0,<0.11.0
10+
- pre-commit>=2.17.0,<3.0.0
11+
- snakefmt>=0.6.1,<0.7.0
12+
- yamlfix>=1.1.0,<2.0.0
13+
- mypy>=0.991,<1.0.0
14+
- ruff>=0.1.14,<0.2.0

labelmerge/run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
if "SNAKEMAKE_CONDA_PREFIX" not in os.environ:
3131
os.environ["SNAKEMAKE_CONDA_PREFIX"] = str(conda_prefix)
3232

33+
3334
def get_parser():
3435
"""Exposes parser for sphinx doc generation, cwd is the docs dir"""
3536
return app.build_parser().parser
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
name: merge_labels
33
channels: [conda-forge, defaults]
4-
dependencies:
4+
dependencies:
55
- python=3.9
66
- numpy>=1.22.3,<2.0
77
- nibabel>=3.2.2,<4.0
8-
- xarray>=2022.11.0,<2023.0.0
8+
- xarray>=2022.11.0,<2023.0.0
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
use-conda: True
1+
---
2+
use-conda: true

0 commit comments

Comments
 (0)