Skip to content

Conda lock file creation #126

Conda lock file creation

Conda lock file creation #126

name: Conda lock file creation
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-lock-file:
name: Create conda lock file for latest Python
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
activate-environment: esmvaltool-fromlock
python-version: "3.11"
miniforge-version: "latest"
miniforge-variant: Mambaforge
use-mamba: true
- name: Show conda config
run: |
conda update -n base -c conda-forge conda
conda --version
# setup-miniconda@v3 installs an old conda and mamba
# forcing a modern mamba updates both mamba and conda
conda install -c conda-forge "mamba>=1.4.8"
conda config --show-sources
conda config --show
conda --version
mamba --version
- name: 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
run: conda-lock lock --platform linux-64 -f environment.yml --mamba --kind explicit
- name: Show conda version again
run: conda --version
- name: Show Python exec and version again
run: |
which python
python -V
- name: Create conda-lock environment
run: conda create --name esmvaltool-fromlock --file conda-linux-64.lock
- name: Install pip
run: mamba install -y pip
- name: Check Python and pip versions post pip-install
run: |
which python
pip --version
- name: Install ESMValTool
run: pip install -e .[develop]
- name: Check ESMValTool version
run: esmvaltool --help
- name: Check ESMValTool help
run: esmvaltool version
- name: Run flake8
run: flake8
- name: Run tests
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@v3
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