Conda lock files #96
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
name: Wave | |
# 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 | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-name: conda-lock-env | |
create-args: >- | |
python=3.11 | |
conda-lock | |
mamba | |
# Print debugging information | |
# - name: Print debug info | |
# run: | | |
# conda-lock --version | |
# mamba --version | |
# echo Locking ${{ inputs.file }} file for ${{ inputs.platform }} platform. | |
# shell: bash -l {0} | |
# Run conda-lock | |
- name: Run conda-lock | |
run: | | |
rm --force conda-lock.yml | |
conda-lock lock $MAMBA --file "${{ matrix.files }}" --kind lock --platform linux-64 | |
env: | |
MAMBA: "--mamba" | |
shell: bash -l {0} | |
- name: Commit and push changes | |
uses: devops-infra/action-commit-push@master | |
with: | |
github_token: "${{ secrets.GITHUB_TOKEN }}" | |
commit_message: "[automated] autogenerated conda-lock files" | |
- 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: Install wave-cli | |
run: | | |
wget -q https://github.com/seqeralabs/wave-cli/releases/download/v${WAVE_VER}/wave-${WAVE_VER}-linux-x86_64 | |
sudo mv wave-${WAVE_VER}-linux-x86_64 /usr/local/bin/wave | |
chmod +x /usr/local/bin/wave | |
- name: Build container | |
if: matrix.profile == 'docker' | |
run: | | |
wave --conda-package "${{steps.lockfile-name.outputs.result}}" \ | |
--freeze \ | |
--await \ | |
--tower-token ${{ secrets.TOWER_ACCESS_TOKEN }} \ | |
--tower-workspace-id ${{ secrets.TOWER_WORKSPACE_ID }} | |
- name: Build Singularity | |
if: matrix.profile == 'singularity' | |
run: | | |
wave --conda-package "${{steps.lockfile-name.outputs.result}}" \ | |
--freeze \ | |
--await \ | |
--tower-token ${{ secrets.TOWER_ACCESS_TOKEN }} \ | |
--tower-workspace-id ${{ secrets.TOWER_WORKSPACE_ID }} \ | |
--singularity | |
# TODO Build from Dockerfiles |