Skip to content

Commit 3f68622

Browse files
authored
Merge pull request #12 from OpenBioSim/feature_rattler
Switch to pixi and rattler-build
2 parents 93e0668 + d303506 commit 3f68622

16 files changed

Lines changed: 342 additions & 262 deletions

.github/workflows/devel.yaml

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release Devel
33
on:
44
workflow_dispatch:
55
push:
6-
branches: [ devel ]
6+
branches: [devel]
77

88
jobs:
99
build:
@@ -18,11 +18,9 @@ jobs:
1818
- { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" }
1919
- { name: "macos", os: "macos-latest", shell: "bash -l {0}" }
2020
exclude:
21-
# Exclude all but the latest Python from all
22-
# but Linux
2321
- platform:
2422
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
25-
python-version: "3.12" # MacOS can't run 3.12 yet... We want 3.10 and 3.11
23+
python-version: "3.12" # MacOS can't run 3.12 yet... We want 3.10 and 3.11
2624
environment:
2725
name: loch-build
2826
defaults:
@@ -32,30 +30,43 @@ jobs:
3230
SIRE_DONT_PHONEHOME: 1
3331
SIRE_SILENT_PHONEHOME: 1
3432
steps:
35-
- uses: conda-incubator/setup-miniconda@v3
33+
#
34+
- uses: actions/checkout@v4
3635
with:
37-
auto-update-conda: true
38-
python-version: ${{ matrix.python-version }}
39-
activate-environment: loch_build
40-
miniforge-version: latest
41-
#
42-
- name: Clone the devel branch
43-
run: git clone -b devel https://github.com/openbiosim/loch
44-
#
45-
- name: Setup Conda
46-
run: conda install -y -c conda-forge boa anaconda-client packaging
47-
#
48-
- name: Update Conda recipe
49-
run: python ${{ github.workspace }}/loch/actions/update_recipe.py
50-
#
51-
- name: Prepare build location
52-
run: mkdir ${{ github.workspace }}/build
53-
#
54-
- name: Build Conda package using conda build
55-
run: conda build --no-test -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/loch/recipes/loch
56-
#
57-
- name: Upload Conda package
58-
run: python ${{ github.workspace }}/loch/actions/upload_package.py
36+
fetch-depth: 0
37+
#
38+
- name: Compute version info
39+
shell: bash
40+
run: python actions/update_recipe.py
41+
#
42+
- name: Create sdist
43+
run: pip install build && python -m build --sdist && mv dist/*.tar.gz loch-source.tar.gz
44+
working-directory: ${{ github.workspace }}
45+
#
46+
- name: Install pixi
47+
uses: prefix-dev/setup-pixi@v0.9.4
48+
with:
49+
run-install: false
50+
#
51+
- name: Install rattler-build
52+
shell: bash
53+
run: pixi global install rattler-build
54+
#
55+
- name: Write Python variant config
56+
shell: bash
57+
run: printf 'python:\n - "${{ matrix.python-version }}"\n' > "${{ github.workspace }}/python_variant.yaml"
58+
#
59+
- name: Build package using rattler-build
60+
shell: bash
61+
run: rattler-build build --recipe "${{ github.workspace }}/recipes/loch" -c conda-forge -c openbiosim/label/dev --variant-config "${{ github.workspace }}/python_variant.yaml"
62+
#
63+
- name: Install anaconda-client
64+
shell: bash
65+
run: python -m pip install anaconda-client
66+
#
67+
- name: Upload package
68+
shell: bash
69+
run: python actions/upload_package.py
5970
env:
6071
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
6172
ANACONDA_LABEL: dev

.github/workflows/main.yaml

Lines changed: 40 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
exclude:
2424
- platform:
2525
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
26-
python-version: "3.12" # MacOS can't run 3.12 yet... We want 3.10 and 3.11
26+
python-version: "3.12" # MacOS can't run 3.12 yet... We want 3.10 and 3.11
2727
environment:
2828
name: loch-build
2929
defaults:
@@ -33,30 +33,46 @@ jobs:
3333
SIRE_DONT_PHONEHOME: 1
3434
SIRE_SILENT_PHONEHOME: 1
3535
steps:
36-
- uses: conda-incubator/setup-miniconda@v3
36+
#
37+
- uses: actions/checkout@v4
3738
with:
38-
auto-update-conda: true
39-
python-version: ${{ matrix.python-version }}
40-
activate-environment: loch_build
41-
miniforge-version: latest
42-
#
43-
- name: Clone the main branch
44-
run: git clone -b main https://github.com/openbiosim/loch
45-
#
46-
- name: Setup Conda
47-
run: conda install -y -c conda-forge boa anaconda-client packaging
48-
#
49-
- name: Update Conda recipe
50-
run: python ${{ github.workspace }}/loch/actions/update_recipe.py
51-
#
52-
- name: Prepare build location
53-
run: mkdir ${{ github.workspace }}/build
54-
#
55-
- name: Build Conda package using conda build
56-
run: conda build --no-test -c conda-forge -c openbiosim/label/main ${{ github.workspace }}/loch/recipes/loch
57-
#
58-
- name: Upload Conda package
59-
run: python ${{ github.workspace }}/loch/actions/upload_package.py
39+
ref: main
40+
fetch-depth: 0
41+
#
42+
- name: Compute version info
43+
shell: bash
44+
run: python actions/update_recipe.py
45+
#
46+
- name: Create sdist
47+
run: pip install build && python -m build --sdist && mv dist/*.tar.gz loch-source.tar.gz
48+
working-directory: ${{ github.workspace }}
49+
#
50+
- name: Install pixi
51+
uses: prefix-dev/setup-pixi@v0.9.4
52+
with:
53+
run-install: false
54+
#
55+
- name: Install rattler-build
56+
shell: bash
57+
run: pixi global install rattler-build
58+
#
59+
- name: Write Python variant config
60+
shell: bash
61+
run: printf 'python:\n - "${{ matrix.python-version }}"\n' > "${{ github.workspace }}/python_variant.yaml"
62+
#
63+
- name: Build package using rattler-build
64+
shell: bash
65+
run: rattler-build build --recipe "${{ github.workspace }}/recipes/loch" -c conda-forge -c openbiosim/label/main --variant-config "${{ github.workspace }}/python_variant.yaml"
66+
#
67+
- name: Install anaconda-client
68+
shell: bash
69+
run: python -m pip install anaconda-client
70+
if: github.event.inputs.upload_packages == 'true'
71+
#
72+
- name: Upload package
73+
shell: bash
74+
run: python actions/upload_package.py
6075
env:
6176
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
6277
ANACONDA_LABEL: main
78+
if: github.event.inputs.upload_packages == 'true'

.github/workflows/pr.yaml

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,12 @@ jobs:
1717
- { name: "linux", os: "ubuntu-latest", shell: "bash -l {0}" }
1818
- { name: "macos", os: "macos-latest", shell: "bash -l {0}" }
1919
exclude:
20-
# Exclude all but the latest Python from all
21-
# but Linux
2220
- platform:
2321
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
2422
python-version: "3.10"
2523
- platform:
2624
{ name: "macos", os: "macos-latest", shell: "bash -l {0}" }
27-
python-version: "3.12" # MacOS can't run 3.12 yet...
25+
python-version: "3.12" # MacOS can't run 3.12 yet...
2826
environment:
2927
name: loch-build
3028
defaults:
@@ -33,31 +31,39 @@ jobs:
3331
env:
3432
SIRE_DONT_PHONEHOME: 1
3533
SIRE_SILENT_PHONEHOME: 1
36-
REPO: "${{ github.event.pull_request.head.repo.full_name || github.repository }}"
3734
steps:
38-
- uses: conda-incubator/setup-miniconda@v3
35+
#
36+
- uses: actions/checkout@v4
3937
with:
40-
auto-update-conda: true
41-
python-version: ${{ matrix.python-version }}
42-
activate-environment: loch_build
43-
miniforge-version: latest
44-
#
45-
- name: Clone the feature branch
46-
run: git clone -b ${{ github.head_ref }} --single-branch https://github.com/${{ env.REPO }} loch
47-
#
48-
- name: Setup Conda
49-
run: conda install -y -c conda-forge boa anaconda-client packaging
50-
#
51-
- name: Update Conda recipe
52-
run: python ${{ github.workspace }}/loch/actions/update_recipe.py
53-
#
54-
- name: Prepare build location
55-
run: mkdir ${{ github.workspace }}/build
56-
#
57-
- name: Build Conda package using conda build using main channel
38+
fetch-depth: 0
39+
#
40+
- name: Compute version info
41+
shell: bash
42+
run: python actions/update_recipe.py
43+
#
44+
- name: Create sdist
45+
run: pip install build && python -m build --sdist && mv dist/*.tar.gz loch-source.tar.gz
46+
working-directory: ${{ github.workspace }}
47+
#
48+
- name: Install pixi
49+
uses: prefix-dev/setup-pixi@v0.9.4
50+
with:
51+
run-install: false
52+
#
53+
- name: Install rattler-build
54+
shell: bash
55+
run: pixi global install rattler-build
56+
#
57+
- name: Write Python variant config
58+
shell: bash
59+
run: printf 'python:\n - "${{ matrix.python-version }}"\n' > "${{ github.workspace }}/python_variant.yaml"
60+
#
61+
- name: Build package using rattler-build (main channel)
5862
if: ${{ github.base_ref == 'main' }}
59-
run: conda build --no-test -c conda-forge -c openbiosim/label/main ${{ github.workspace }}/loch/recipes/loch
60-
#
61-
- name: Build Conda package using conda build using dev channel
63+
shell: bash
64+
run: rattler-build build --recipe "${{ github.workspace }}/recipes/loch" -c conda-forge -c openbiosim/label/main --variant-config "${{ github.workspace }}/python_variant.yaml"
65+
#
66+
- name: Build package using rattler-build (dev channel)
6267
if: ${{ github.base_ref != 'main' }}
63-
run: conda build --no-test -c conda-forge -c openbiosim/label/dev ${{ github.workspace }}/loch/recipes/loch
68+
shell: bash
69+
run: rattler-build build --recipe "${{ github.workspace }}/recipes/loch" -c conda-forge -c openbiosim/label/dev --variant-config "${{ github.workspace }}/python_variant.yaml"

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ setup.err
2020
dist/
2121
build/
2222
loch.egg-info
23-
src/loch/_version.py
2423

2524
# Test output.
2625
output.yaml
@@ -35,5 +34,5 @@ output.yaml
3534
# VSCode config
3635
.vscode/
3736

38-
# Conda recipe (it is auto-generated)
39-
recipes/loch/meta.yaml
37+
# Auto-generated version file.
38+
src/loch/_version.py

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
files: ^(src|tests)/
2+
exclude: ^tests/(input|output)/
3+
4+
repos:
5+
# General file quality checks
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v5.0.0
8+
hooks:
9+
- id: trailing-whitespace
10+
- id: end-of-file-fixer
11+
- id: check-added-large-files
12+
args: [--maxkb=1000] # Prevent files larger than 1MB
13+
- id: check-merge-conflict
14+
15+
# Python formatting and linting
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.8.4
18+
hooks:
19+
# Run the formatter
20+
- id: ruff-format
21+
# Run the linter (optional - remove if too strict)
22+
- id: ruff
23+
args: [--fix, --exit-zero] # Auto-fix but don't block commits

0 commit comments

Comments
 (0)