-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Use composite action with conda instead of docker action #39
base: master
Are you sure you want to change the base?
Changes from 15 commits
a81f38f
34e5f69
35f7d8c
2551a81
786074d
d84999b
eeb286c
68b501b
8ae8997
53479d3
8a08969
991091f
861c528
8c55e2b
8d6dd04
dedc6dc
cebcb23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,17 +27,77 @@ inputs: | |
required: false | ||
default: 'run' | ||
show-disk-usage-on-error: | ||
descriptions: Whether to return the used disk space on failing. | ||
description: Whether to return the used disk space on failing. | ||
required: false | ||
default: false | ||
snakemake-version: | ||
description: Snakemake version to use. If not specified, uses latest version. Pin a specific version (e.g., '8.25.5') for reproducibility. | ||
required: false | ||
default: '*' | ||
install-apptainer: | ||
description: Install Apptainer (true/false) | ||
required: false | ||
default: false | ||
|
||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.directory }} | ||
- ${{ inputs.snakefile }} | ||
- ${{ inputs.args }} | ||
- ${{ inputs.stagein }} | ||
- ${{ inputs.task }} | ||
- ${{ inputs.show-disk-usage-on-error }} | ||
using: 'composite' | ||
steps: | ||
- name: Validate inputs | ||
if: ${{ ! (inputs.task == 'containerize' || inputs.task == 'run' )}} | ||
shell: bash -el {0} | ||
run: | | ||
echo 'Invalid value for "task": "${{ inputs.task }}". Options: "containerize", "run".' | ||
exit 1 | ||
|
||
- name: Install Apptainer | ||
if: ${{ inputs.install-apptainer == 'true' }} | ||
shell: bash -el {0} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y apptainer | ||
|
||
johanneskoester marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Prepare .snakemake.environment.yaml | ||
shell: bash -el {0} | ||
run: | | ||
cat <<EOF > .snakemake.environment.yaml | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
- nodefaults | ||
dependencies: | ||
- snakemake ==${{ inputs.snakemake-version }} | ||
EOF | ||
|
||
- 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 | ||
activate-environment: snakemake | ||
|
||
- name: Display snakemake version | ||
shell: bash -el {0} | ||
run: snakemake --version | ||
|
||
- name: Run snakemake | ||
if: ${{ inputs.task == 'run' }} | ||
shell: bash -el {0} | ||
run: | | ||
snakemake --directory ${{ inputs.directory }} --snakefile ${{ inputs.snakefile }} --show-failed-logs ${{ inputs.args }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Quote paths to handle spaces and special characters The directory and snakefile paths should be quoted to handle spaces and special characters correctly. - snakemake --directory ${{ inputs.directory }} --snakefile ${{ inputs.snakefile }} --show-failed-logs ${{ inputs.args }}
+ snakemake --directory "${{ inputs.directory }}" --snakefile "${{ inputs.snakefile }}" --show-failed-logs ${{ inputs.args }} - run: snakemake --directory ${{ inputs.directory }} --snakefile ${{ inputs.snakefile }} --show-failed-logs ${{ inputs.args }} --containerize > Dockerfile
+ run: snakemake --directory "${{ inputs.directory }}" --snakefile "${{ inputs.snakefile }}" --show-failed-logs ${{ inputs.args }} --containerize > Dockerfile Also applies to: 105-105 |
||
if [[ "$?" -ne 0 ]]; then | ||
if [[ ${{ inputs.show-disk-usage-on-error }} = true ]]; then | ||
# return disk usage and space on failing | ||
df -h | ||
printf "disk usage working directory" | ||
du -h -d3 ${{ inputs.directory }} | ||
fi | ||
exit 1 | ||
fi | ||
|
||
- name: Containerize snakemake | ||
if: ${{ inputs.task == 'containerize' }} | ||
shell: bash -el {0} | ||
run: snakemake --directory ${{ inputs.directory }} --snakefile ${{ inputs.snakefile }} --show-failed-logs ${{ inputs.args }} --containerize > Dockerfile | ||
johanneskoester marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
- nodefaults | ||
dependencies: | ||
- snakemake =={{ snakemake_version }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix invalid conda version specifier
The default value
'*'
is not a valid version specifier for conda packages. When this default is used, the environment creation will fail because the conda dependency specificationsnakemake ==*
is invalid.Consider these options: