Skip to content

condalock-command

condalock-command #626

Workflow file for this run

# Runs conda-lock against environment.yml for reproducible environments
# Runs on any opened PR
name: CondaLock
on:
repository_dispatch:
types: [condalock-command]
jobs:
condalock:
strategy:
fail-fast: false
matrix:
IMAGE: [base-notebook, pangeo-notebook, ml-notebook, pytorch-notebook]
name: ${{ matrix.IMAGE }}
runs-on: ubuntu-latest
timeout-minutes: 180
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PANGEOBOT_TOKEN }}
# These lines are critical, otherwise Pangeo-bot pushes changes directly to master from PRs!
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
cache-environment: true
environment-file: environment-condalock.yml
- name: Run conda-lock ${{ matrix.IMAGE }}
timeout-minutes: 20
run: |
cd ${{ matrix.IMAGE }}
if [ ${{ matrix.IMAGE }} = "base-notebook" ]; then
conda-lock lock -p linux-64 -p linux-aarch64 -p osx-64 -p osx-arm64
elif [ ${{ matrix.IMAGE }} = "pangeo-notebook" ]; then
conda-lock lock -f environment.yml -f ../base-notebook/environment.yml -p linux-64 -p linux-aarch64 -p osx-64 -p osx-arm64
else
# Linux-64 ONLY
conda-lock lock -f environment.yml -f ../pangeo-notebook/environment.yml -f ../base-notebook/environment.yml -p linux-64
fi
# Keep this format around for easy `conda install` w/o conda-lock or micromamba
conda-lock render -k explicit -p linux-64
../generate-packages-list.py conda-linux-64.lock > packages.txt
- name: Upload lockfiles
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.image }}
path: ${{ matrix.image }}
# Each job will commit files, so we know it succeeds based on commits
commit-lockfiles:
needs: condalock
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PANGEOBOT_TOKEN }}
# These lines are critical, otherwise Pangeo-bot pushes changes directly to master from PRs!
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}
# Download all artifacts from previous matrix job
- uses: actions/download-artifact@v4
- name: Commit condalock files to PR
run: |
git config --global user.name 'pangeo-bot'
git config --global user.email '[email protected]'
git status
git add */conda*.lock */conda-lock.yml */packages.txt
git commit -m "[condalock-command] autogenerated conda-lock files"
git push
- name: Add reaction
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reactions: hooray