Conda lock files #104
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# TODO Change to Wave | |
name: Generate conda-lock | |
# When environment.yml is changed | |
on: | |
pull_request: | |
paths: | |
- "**/environment.yml" | |
env: | |
WAVE_VER: "1.4.1" | |
jobs: | |
gen-matrix: | |
name: generate-matrix | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
- name: Calculate file differences | |
id: diff | |
uses: tj-actions/changed-files@v44 | |
with: | |
json: true | |
quotepath: false | |
# TODO Add Dockerfiles | |
files: | | |
modules/**/environment.yml | |
- name: Debug | |
run: echo ${{ steps.diff.outputs.all_changed_files }} | |
- id: set-matrix | |
run: echo "matrix={\"profile\":[\"docker\", \"singularity\"],\"files\":${{ steps.diff.outputs.all_changed_files }} }" >> "$GITHUB_OUTPUT" | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
build: | |
if: "${{ fromJson(needs.gen-matrix.outputs.matrix) }}" | |
needs: gen-matrix | |
name: build | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: "${{ fromJson(needs.gen-matrix.outputs.matrix) }}" | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-name: conda-lock-env | |
create-args: >- | |
python=3.11 | |
conda-lock | |
mamba | |
- name: Get the lock file path | |
uses: actions/github-script@v7 | |
id: lockfile-name | |
with: | |
result-encoding: string | |
script: | | |
return '${{ matrix.files }}'.replace('/environment.yml', '/conda-lock.yml'); | |
- name: Run conda-lock | |
run: | | |
rm --force "${{steps.lockfile-name.outputs.result}}" | |
conda-lock lock $MAMBA --file "${{ matrix.files }}" --kind lock --platform linux-64 --conda-lock --lockfile "${{steps.lockfile-name.outputs.result}}" | |
env: | |
MAMBA: "--mamba" | |
shell: bash -l {0} | |
- name: Commit & push changes | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "nf-core-bot" | |
git config push.default upstream | |
git add . | |
git status | |
git commit -m "[automated] autogenerated conda-lock file" | |
git push | |
# TODO Build containers with Wave |