-
Notifications
You must be signed in to change notification settings - Fork 714
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conda lock files #5827
base: master
Are you sure you want to change the base?
Conda lock files #5827
Changes from all commits
dbad13e
6ea762d
b740f85
95ba6cc
07a250e
b3ef764
98cbce3
253a398
f085cc1
fe828fa
8433c87
a9f4d26
22c4985
3afecb6
c6b7ae6
251b8ca
de2fdf7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,87 @@ | ||||||||||||
name: Generate conda-lock | ||||||||||||
# When environment.yml is changed | ||||||||||||
on: | ||||||||||||
pull_request: | ||||||||||||
paths: | ||||||||||||
- "**/environment.yml" | ||||||||||||
|
||||||||||||
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 | ||||||||||||
files: | | ||||||||||||
modules/**/environment.yml | ||||||||||||
- name: Debug | ||||||||||||
run: echo ${{ steps.diff.outputs.all_changed_files }} | ||||||||||||
- id: set-matrix | ||||||||||||
run: echo "matrix={\"files\":${{ steps.diff.outputs.all_changed_files }} }" >> "$GITHUB_OUTPUT" | ||||||||||||
|
||||||||||||
outputs: | ||||||||||||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||||||||||||
|
||||||||||||
lock: | ||||||||||||
if: "${{ fromJson(needs.gen-matrix.outputs.matrix) }}" | ||||||||||||
needs: gen-matrix | ||||||||||||
name: Generate conda-lock file | ||||||||||||
permissions: | ||||||||||||
contents: write | ||||||||||||
runs-on: ubuntu-latest | ||||||||||||
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 --lockfile "${{steps.lockfile-name.outputs.result}}" | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Nextflow needs it to be a .yml, but use of Platforms should probably be set in the environment.ymls actually. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just do...
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't look like that works 😞 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The But by doing |
||||||||||||
env: | ||||||||||||
MAMBA: "--mamba" | ||||||||||||
shell: bash -l {0} | ||||||||||||
|
||||||||||||
- name: Commit & push changes | ||||||||||||
id: commit-and-push | ||||||||||||
run: | | ||||||||||||
git config user.email "core@nf-co.re" | ||||||||||||
git config user.name "nf-core-bot" | ||||||||||||
git config push.default upstream | ||||||||||||
git add . | ||||||||||||
git status | ||||||||||||
git commit -m "[automated] autogenerated conda-lock file" | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should just be a single commit per lock file I think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One lock file per platform |
||||||||||||
git push | ||||||||||||
|
||||||||||||
- name: If no conda-lock update | ||||||||||||
if: steps.commit-and-push.outcome == 'failure' | ||||||||||||
run: | | ||||||||||||
echo "No conda-lock update" | ||||||||||||
|
||||||||||||
# TODO Build containers with Wave |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -15,3 +15,4 @@ __pycache__ | |||||
*.pyo | ||||||
*.pyc | ||||||
.github/renovate.json5 | ||||||
**/conda-lock.yml | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I tested why the lock file didn't work, and I think it's because of the default unified lock files. To get a lock file compatible with Nextflow (which just does like this), you have to render it to a platform specific one:
We can also just do:
... which automatically renders to all the specified platforms.
In any case, for nextflow as-is, we will need platform-specific lockfiles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I didn't really want to have 4+ lock files floating around. I didn't know this was a possibility, great find!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid we're stuck with those 4 lock files, unless we do that rendering dynamically somehow.