Skip to content

condalock-command

condalock-command #496

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, forge]
name: ${{ matrix.IMAGE }}
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
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/provision-with-micromamba@v15
with:
cache-env: true
environment-file: environment-condalock.yml
# Could run as single step in parallel, but would complicate logs...
- name: Run conda-lock ${{ matrix.IMAGE }}
run: |
cd ${{ matrix.IMAGE }}
rm conda-lock.yml
if [ ${{ matrix.IMAGE }} = "base-notebook" ]; then
conda-lock lock -f environment.yml -p linux-64
elif [ ${{ matrix.IMAGE }} = "pangeo-notebook" ]; then
conda-lock lock -f environment.yml -f ../base-notebook/environment.yml -p linux-64
else
conda-lock lock -f environment.yml -f ../pangeo-notebook/environment.yml -f ../base-notebook/environment.yml -p linux-64
fi
conda-lock render -k explicit
../generate-packages-list.py conda-linux-64.lock > packages.txt
- name: Upload lockfiles
uses: actions/upload-artifact@v3
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@v3
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@v3
- name: Commit condalock files to PR
run: |
git config --global user.name 'pangeo-bot'
git config --global user.email '[email protected]'
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@v2
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 }}
reaction-type: hooray
# repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
# comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
# reaction-type: hooray