Add CI to build mulled containers with Wave #60
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.2.0" | |
jobs: | |
gen-matrix: | |
name: generate-matrix | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Calculate file differences | |
id: diff | |
uses: tj-actions/changed-files@v35 | |
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 | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: "${{ fromJson(needs.gen-matrix.outputs.matrix) }}" | |
steps: | |
# Use the @nf-core-bot token to check out so we can push later | |
- uses: actions/checkout@v3 | |
- 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: Create a registry name | |
uses: actions/github-script@v7 | |
id: registry-name | |
with: | |
result-encoding: string | |
script: | | |
return '${{ matrix.files }}'.replace('modules/nf-core/', '').replace('/environment.yml', '').replace('/', '_'); | |
- name: Build container | |
if: matrix.profile == 'docker' | |
run: | | |
wave --conda-file "${{ matrix.files }}" \ | |
--freeze \ | |
--await \ | |
--build-repo quay.io/nf-core/modules/${{steps.registry-name.outputs.result}} \ | |
--cache-repository quay.io/nf-core/wave-cache \ | |
--tower-token ${{ secrets.TOWER_ACCESS_TOKEN }} \ | |
--tower-workspace-id ${{ secrets.TOWER_WORKSPACE_ID }} | |
- name: Build Singularity | |
if: matrix.profile == 'singularity' | |
run: | | |
wave --conda-file "${{ matrix.files }}" \ | |
--freeze \ | |
--await \ | |
--build-repo quay.io/nf-core/modules/${{steps.registry-name.outputs.result}}/singularity \ | |
--cache-repository quay.io/nf-core/wave-cache/singularity \ | |
--tower-token ${{ secrets.TOWER_ACCESS_TOKEN }} \ | |
--tower-workspace-id ${{ secrets.TOWER_WORKSPACE_ID }} \ | |
--singularity | |
# TODO Build from Dockerfiles |