Skip to content

Conda lock file creation #273

Conda lock file creation

Conda lock file creation #273

name: Conda lock file creation
permissions: {}
on:
# Trigger on push on main or other branch for testing
# NOTE that push: main will create the file very often
# and hence lots of automated PRs
# push:
# branches:
# - main
schedule:
- cron: "0 4 */10 * *"
# Required shell entrypoint to have properly configured bash shell
defaults:
run:
shell: bash -l {0}
jobs:
create-verify-lock-file:
name: Create and verify conda lock file for latest Python
permissions:
contents: write
pull-requests: write
runs-on: "ubuntu-latest"
if: github.repository == 'ESMValGroup/ESMValCore' # avoid GAs in forks
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0
with:
auto-update-conda: true
activate-environment: esmvaltool-fromlock
python-version: "3.14"
miniforge-version: "latest"
use-mamba: true
- name: Update and show conda config
run: |
conda update -n base -c conda-forge conda
conda install -y -c conda-forge "mamba>=2.2"
conda --version
mamba --version
- name: Gather Python info
run: |
which python
python --version
- name: Install conda-lock
run: mamba install -y -c conda-forge conda-lock
- name: Check version of conda-lock
run: conda-lock --version
- name: Create conda lock file for linux-64
# --mamba flag no longer needed since conda uses mamba backend
run: conda-lock lock --platform linux-64 -f environment.yml --kind explicit
- name: Creating environment from lock file
run: conda create --name esmvaltool-fromlock --file conda-linux-64.lock
- name: Installing pip
run: mamba install -y pip
- name: Gather pip info
run: pip --version
- name: Gather Python info again
run: |
which python
python --version
- name: Show environment contents
run: conda list
- name: Install esmvalcore
run: pip install --no-deps -e .[develop]
- name: Run basic commands
run: |
pip check
esmvaltool --help
esmvaltool version
- name: Run pytests
run: pytest -n 2 -m "not installation"
# Automated PR
# see https://github.com/marketplace/actions/create-pull-request
- name: Create Automated PR if conda lock file has changed
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Updating Linux condalock file
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: condalock-update
delete-branch: true
title: "[Condalock] Update Linux condalock file"
body: |
Update condalock file
Automatic Pull Request.
labels: |
testing
condalock
automatedPR
assignees: valeriupredoi
reviewers: valeriupredoi
draft: false