Generate Conda Lockfiles #39
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: Generate Conda Lockfiles | |
on: | |
schedule: | |
# At minute 00:30 on Sunday | |
- cron: "30 0 * * SUN" | |
workflow_dispatch: | |
jobs: | |
condalock: | |
if: github.repository_owner == 'ibis-project' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.10" | |
- "3.11" | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.client_payload.pull_request.head.ref }} | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: conda-lock | |
python-version: "3.11" | |
condarc-file: ci/conda-lock/condarc | |
use-mamba: true | |
- name: install conda libmamba solver | |
run: mamba install --name base conda-lock | |
- name: generate lock file | |
run: ./ci/conda-lock/generate.sh "${{ matrix.python-version }}" | |
- name: create conda environment | |
run: mamba create --name ibis${{ matrix.python-version }} --file conda-lock/linux-64/${{ matrix.python-version }}.lock | |
- name: upload conda lock files | |
uses: actions/upload-artifact@v3 | |
with: | |
name: conda-lock-files-${{ github.run_attempt }} | |
path: ci/conda-lock/*/${{ matrix.python-version }}.lock | |
condalock_pr: | |
if: (github.repository_owner == 'ibis-project') && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') | |
runs-on: ubuntu-latest | |
needs: | |
- condalock | |
steps: | |
- uses: tibdex/github-app-token@v2 | |
id: generate_pr_token | |
with: | |
app_id: ${{ secrets.SQUAWK_BOT_APP_ID }} | |
private_key: ${{ secrets.SQUAWK_BOT_APP_PRIVATE_KEY }} | |
- uses: tibdex/github-app-token@v2 | |
id: generate_pr_approval_token | |
with: | |
app_id: ${{ secrets.PR_APPROVAL_BOT_APP_ID }} | |
private_key: ${{ secrets.PR_APPROVAL_BOT_APP_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.generate_pr_token.outputs.token }} | |
- name: download conda lock files | |
uses: actions/download-artifact@v3 | |
with: | |
name: conda-lock-files-${{ github.run_attempt }} | |
path: ci/conda-lock | |
- uses: peter-evans/create-pull-request@v5 | |
id: create_pr | |
with: | |
token: ${{ steps.generate_pr_token.outputs.token }} | |
commit-message: "chore(conda-lock): relock" | |
branch: "create-pull-request/conda-relock" | |
delete-branch: true | |
add-paths: ci/conda-lock/*/*.lock | |
committer: "ibis-squawk-bot[bot] <ibis-squawk-bot[bot]@users.noreply.github.com>" | |
author: "ibis-squawk-bot[bot] <ibis-squawk-bot[bot]@users.noreply.github.com>" | |
title: "chore(conda-lock): relock" | |
body: "Relock conda-lock environment files" | |
labels: | | |
dependencies | |
- uses: juliangruber/[email protected] | |
if: steps.create_pr.outputs.pull-request-operation == 'created' | |
with: | |
github-token: ${{ steps.generate_pr_approval_token.outputs.token }} | |
number: ${{ steps.create_pr.outputs.pull-request-number }} | |
- uses: peter-evans/enable-pull-request-automerge@v3 | |
if: steps.create_pr.outputs.pull-request-operation == 'created' | |
with: | |
token: ${{ steps.generate_pr_token.outputs.token }} | |
pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }} | |
merge-method: rebase |