Install from conda-forge #1089
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
# Verify that installation from conda-forge works as intended | |
name: Install from conda-forge | |
on: | |
# 05:00 UTC = 06:00 CET = 07:00 CEST | |
schedule: | |
- cron: "0 5 * * *" | |
# Uncomment to debug | |
# pull_request: | |
# branches: [ main ] | |
jobs: | |
conda: | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest] | |
conda: | |
- {installer: anaconda, version: 2023.03-1} | |
- {installer: miniconda, version: py310_23.3.1-0} | |
extra-deps: ["", "JPype1=1.2.1"] | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.os }}-${{ matrix.conda.installer }}-${{ matrix.extra-deps }} | |
steps: | |
- name: Cache Anaconda installer, conda packages | |
uses: actions/cache@v3 | |
with: | |
path: | | |
$CONDA/pkgs | |
~/.conda/pkgs | |
~/anaconda3/pkgs | |
~/appdata/local/conda/conda/pkgs | |
${{ github.workspace }}/Anaconda*.exe | |
key: ${{ matrix.os }}-${{ matrix.conda.installer }} | |
- name: Setup Anaconda or miniconda | |
uses: iiasa/actions/setup-conda@main | |
with: | |
installer: ${{ matrix.conda.installer }} | |
version: ${{ matrix.conda.version }} | |
# TODO move the following 2 steps into the above action | |
- name: Determine shell on current OS | |
id: shell | |
run: | | |
import os | |
init, profile = { | |
"macos": ("bash", "source ~/.bash_profile"), | |
"windows": ("powershell", ""), | |
}.get("${{ matrix.os }}".split("-")[0]) | |
with open(os.environ["GITHUB_OUTPUT"], "a") as f: | |
f.write(f"init={init}\n") | |
f.write(f"profile={profile}\n") | |
shell: python | |
- name: Initialize shell for "conda activate" | |
run: conda init ${{ steps.shell.outputs.init }} | |
- name: Configure conda channels, update, create environment, and install message-ix | |
run: | | |
conda install -n base conda-libmamba-solver | |
conda config --set solver libmamba | |
conda config --prepend channels conda-forge | |
conda config --set channel_priority strict | |
conda update -n base -c defaults conda | |
# Also install pytest and packages required for testing. pip/PyPI | |
# supports this via message_ix[testing], but conda does not. | |
conda create --quiet --name testenv message-ix ${{ matrix.extra-deps }} pytest asyncssh sphinx | |
conda list --name testenv | |
- name: Check CLI commands and run test | |
run: | | |
# Source profile. On non-windows OSes, GHA invokes bash with | |
# "--noprofile", so the file written by "conda init bash" above is not | |
# read automatically | |
${{ steps.shell.outputs.profile }} | |
# Activate the test environment | |
conda activate testenv | |
conda info | |
# Check CLI tools | |
message-ix show-versions | |
ixmp --platform default list || true | |
# Run a single test from the test suite to touch JDBCBackend Java code, | |
# via JPype | |
pytest --pyargs message_ix -p ixmp.testing -p no:faulthandler -k "test_add_cat" --verbose -rA --color=yes |