Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ jobs:
snakefile: .test/Snakefile
args: "--cores 1"

- name: Test environment-file
uses: ./
with:
directory: .test
snakefile: .test/Snakefile
environment-file: .test/environment.yaml
args: "--cores 1"

- name: Test containerize
uses: ./
with:
Expand Down
6 changes: 6 additions & 0 deletions .test/environment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
channels:
- https://prefix.dev/conda-forge
- https://prefix.dev/bioconda
- nodefaults
dependencies:
- snakemake ==9.5.1
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ Whether to run Snakemake or to generate a container image specification (in the

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

### `snakemake-version`

Snakemake version to use. If not specified, uses latest version. Pin a specific version (e.g., '8.25.5') for reproducibility.

### `install-apptainer`

Install Apptainer (true/false)

### `environment-file`

Path to a custom Conda environment file containing snakemake (e.g., 'etc/custom-environment.yml'). If not specified, a default environment with snakemake is generated.

## Example usage

```yaml
Expand All @@ -46,6 +58,7 @@ Whether used disk space shall be printed if Snakemake fails. Can be either `true
args: '--cores 1 --sdm conda --conda-cleanup-pkgs cache'
stagein: '' # additional preliminary commands to run (can be multiline)
show-disk-usage-on-error: true
environment-file: 'my-environment.yaml'


- name: Create container file
Expand Down
19 changes: 18 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ inputs:
description: Install Apptainer (true/false)
required: false
default: false
environment-file:
description: Path to a custom Conda environment file containing snakemake (e.g., 'etc/custom-environment.yml'). If not specified, a default environment with snakemake is generated.
required: false
default: ''

runs:
using: 'composite'
Expand All @@ -59,7 +63,9 @@ runs:
fi
sudo apt-get update
sudo apt-get install -y apptainer

- name: Prepare .snakemake.environment.yaml
if: ${{ inputs.environment-file == '' }}
shell: bash -el {0}
run: |
cat <<EOF > .snakemake.environment.yaml
Expand All @@ -71,13 +77,24 @@ runs:
- snakemake ==${{ inputs.snakemake-version }}
EOF

- name: Validate custom environment file
if: ${{ inputs.environment-file != '' }}
shell: bash -el {0}
run: |
if [[ -f "${{ inputs.environment-file }}" ]]; then
echo "Using custom environment file: ${{ inputs.environment-file }}"
else
echo "Error: Custom environment file '${{ inputs.environment-file }}' not found"
exit 1
fi

- name: Setup conda
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge,bioconda
channel-priority: strict
miniforge-version: latest
environment-file: .snakemake.environment.yaml
environment-file: ${{ inputs.environment-file || '.snakemake.environment.yaml' }}
activate-environment: snakemake

- name: Display snakemake version
Expand Down
Loading