Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
16 changes: 15 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
branches_ignore: []

jobs:
build:
test:

runs-on: ubuntu-latest

Expand All @@ -33,3 +33,17 @@ jobs:
- name: Show Dockerfile
run: |
cat Dockerfile

test-condarc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Test condarc-file
uses: ./
with:
directory: .test
snakefile: .test/Snakefile
condarc-file: .test/condarc.yaml
stagein: "conda list"
args: "--cores 1"
4 changes: 4 additions & 0 deletions .test/condarc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
channel_alias: https://prefix.dev/
always_yes: true
show_channel_urls: true

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)

### `condarc-file`

Path to a custom condarc file (e.g., 'etc/condarc.yaml')

## 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
condarc-file: 'condarc.yaml'


- name: Create container file
Expand Down
18 changes: 17 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ inputs:
description: Install Apptainer (true/false)
required: false
default: false
condarc-file:
description: Path to a custom condarc file for workflow action environment (e.g. '.condarc').
default: ''

runs:
using: 'composite'
Expand All @@ -59,17 +62,28 @@ runs:
fi
sudo apt-get update
sudo apt-get install -y apptainer

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

- name: Setup conda
uses: conda-incubator/setup-miniconda@v3
Expand All @@ -78,6 +92,8 @@ runs:
channel-priority: strict
miniforge-version: latest
environment-file: .snakemake.environment.yaml
conda-remove-defaults: "true"
condarc-file: ${{ inputs.condarc-file }}
activate-environment: snakemake

- name: Display snakemake version
Expand Down
Loading