diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c9951a3..cc99276 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,7 +8,7 @@ on: branches_ignore: [] jobs: - build: + test: runs-on: ubuntu-latest @@ -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" diff --git a/.test/condarc.yaml b/.test/condarc.yaml new file mode 100644 index 0000000..c4e3a72 --- /dev/null +++ b/.test/condarc.yaml @@ -0,0 +1,4 @@ +channel_alias: https://prefix.dev/ +always_yes: true +show_channel_urls: true + diff --git a/README.md b/README.md index 05c4ef2..b969d94 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/action.yml b/action.yml index 25ff55b..c90d72b 100644 --- a/action.yml +++ b/action.yml @@ -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' @@ -59,6 +62,7 @@ runs: fi sudo apt-get update sudo apt-get install -y apptainer + - name: Prepare .snakemake.environment.yaml shell: bash -el {0} run: | @@ -66,10 +70,20 @@ runs: 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 @@ -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