Skip to content

Commit 6c5b9f2

Browse files
feat: allow to use custom snakemake branch instead of conda version (#53)
* feat: allow to use custom snakemake branch instead of conda version * test * use latest miniforge again
1 parent ae3c4be commit 6c5b9f2

3 files changed

Lines changed: 51 additions & 4 deletions

File tree

.github/workflows/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ jobs:
2121
snakefile: .test/Snakefile
2222
args: "--cores 1"
2323

24+
- name: Test run branch
25+
uses: ./
26+
with:
27+
directory: .test
28+
snakefile: .test/Snakefile
29+
args: "--cores 1"
30+
snakemake-branch: "main"
31+
2432
- name: Test containerize
2533
uses: ./
2634
with:

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ Whether to run Snakemake or to generate a container image specification (in the
2828

2929
Whether used disk space shall be printed if Snakemake fails. Can be either `true` or `false` (default: `false`).
3030

31+
### `snakemake-version`
32+
33+
Snakemake version to install from conda. Default `*` (latest available version from the configured channels).
34+
35+
### `snakemake-branch`
36+
37+
Optional Snakemake git branch to install from `https://github.com/snakemake/snakemake`. If set, this takes precedence over `snakemake-version` and Snakemake is installed from source via pip.
38+
3139
## Example usage
3240

3341
```yaml
@@ -47,6 +55,14 @@ Whether used disk space shall be printed if Snakemake fails. Can be either `true
4755
stagein: "" # additional preliminary commands to run (can be multiline)
4856
show-disk-usage-on-error: true
4957

58+
- name: Testing with custom Snakemake branch
59+
uses: snakemake/snakemake-github-action@v2
60+
with:
61+
directory: ".test"
62+
snakefile: "workflow/Snakefile"
63+
args: "--cores 1 --sdm conda --conda-cleanup-pkgs cache"
64+
snakemake-branch: main
65+
5066
- name: Create container file
5167
uses: snakemake/snakemake-github-action@v2
5268
with:

action.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,22 @@ inputs:
2929
show-disk-usage-on-error:
3030
description: Whether to return the used disk space on failing.
3131
required: false
32-
default: false
32+
default: "false"
3333
snakemake-version:
34-
description: Snakemake version to use. If not specified, uses latest version. Pin a specific version (e.g., '8.25.5') for reproducibility.
34+
description: |
35+
Snakemake version to use. If not specified, uses latest version. Pin a specific version (e.g., '8.25.5') for reproducibility.
3536
required: false
3637
default: "*"
38+
snakemake-branch:
39+
description: |
40+
Optional Snakemake git branch to install from https://github.com/snakemake/snakemake.
41+
If set, this takes precedence over snakemake-version and Snakemake is installed via pip.
42+
required: false
43+
default: ""
3744
install-apptainer:
3845
description: Install Apptainer (true/false)
3946
required: false
40-
default: false
47+
default: "false"
4148

4249
runs:
4350
using: "composite"
@@ -70,18 +77,34 @@ runs:
7077
- bioconda
7178
- nodefaults
7279
dependencies:
80+
EOF
81+
82+
if [[ -n "${{ inputs.snakemake-branch }}" ]]; then
83+
cat <<EOF >> .snakemake.environment.yaml
84+
- python
85+
- pip
86+
EOF
87+
else
88+
cat <<EOF >> .snakemake.environment.yaml
7389
- snakemake ==${{ inputs.snakemake-version }}
7490
EOF
91+
fi
7592
7693
- name: Setup conda
7794
uses: conda-incubator/setup-miniconda@v3
7895
with:
7996
channels: conda-forge,bioconda
8097
channel-priority: strict
81-
miniforge-version: 25.9.1-0 # TODO: set back to "latest" once this issue in the conda installer (template) is fixed and released: https://github.com/conda/constructor/pull/1135
98+
miniforge-version: latest
8299
environment-file: .snakemake.environment.yaml
83100
activate-environment: snakemake
84101

102+
- name: Install snakemake from git branch
103+
if: ${{ inputs.snakemake-branch != '' }}
104+
shell: bash -el {0}
105+
run: |
106+
python -m pip install "git+https://github.com/snakemake/snakemake@${{ inputs.snakemake-branch }}"
107+
85108
- name: Display snakemake version
86109
shell: bash -el {0}
87110
run: snakemake --version

0 commit comments

Comments
 (0)