Skip to content

Commit a81f38f

Browse files
committed
feat: Use composite action instead of docker action
1 parent 8fe6e99 commit a81f38f

File tree

4 files changed

+43
-39
lines changed

4 files changed

+43
-39
lines changed

Dockerfile

Lines changed: 0 additions & 4 deletions
This file was deleted.

action.yml

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,44 @@ inputs:
2727
required: false
2828
default: 'run'
2929
show-disk-usage-on-error:
30-
descriptions: Whether to return the used disk space on failing.
30+
description: Whether to return the used disk space on failing.
3131
required: false
3232
default: false
33+
snakemake-version:
34+
description: Which snakemake version to use
35+
required: false
36+
default: 8.25.5
3337

3438
runs:
35-
using: 'docker'
36-
image: 'Dockerfile'
37-
args:
38-
- ${{ inputs.directory }}
39-
- ${{ inputs.snakefile }}
40-
- ${{ inputs.args }}
41-
- ${{ inputs.stagein }}
42-
- ${{ inputs.task }}
43-
- ${{ inputs.show-disk-usage-on-error }}
39+
using: 'composite'
40+
steps:
41+
- shell: bash -el {0}
42+
run: sed 's/{{ snakemake_version }}/${{ inputs.snakemake-version }}/g' environment.yaml.template > environment.yaml
43+
- name: Setup conda
44+
uses: conda-incubator/setup-miniconda@v3
45+
with:
46+
channels: conda-forge,bioconda
47+
channel-priority: strict
48+
miniforge-version: latest
49+
environment-file: environment.yaml
50+
- name: Run snakemake
51+
if: ${{ inputs.task == 'run' }}
52+
shell: bash -el {0}
53+
run: |
54+
snakemake --directory ${{ inputs.directory }} --snakefile ${{ inputs.snakefile }} --show-failed-logs ${{ inputs.args }}
55+
if [[ "$?" -ne 0 ]]; then
56+
if [[ "$6" = true ]]; then
57+
# return disk usage and space on failing
58+
df -h
59+
printf "disk usage working directory"
60+
du -h -d3 $1
61+
fi
62+
exit 1
63+
fi
64+
- name: Containerize snakemake
65+
if: ${{ inputs.task == 'containerize' }}
66+
shell: bash -el {0}
67+
run: snakemake --directory ${{ inputs.directory }} --snakefile ${{ inputs.snakefile }} --show-failed-logs ${{ inputs.args }} --containerize > Dockerfile
68+
- if: ${{ ! (inputs.task == 'containerize' || inputs.task == 'run' )}}
69+
run: echo "Invalid value for 'task': '${{ inputs.task }}'. Options: 'containerize', 'run'." && exit 1
70+

entrypoint.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

environment.yaml.template

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
channels:
2+
- conda-forge
3+
- bioconda
4+
- nodefaults
5+
dependencies:
6+
- snakemake =={{ snakemake_version }}

0 commit comments

Comments
 (0)