forked from iiasa/message_ix
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (77 loc) · 2.93 KB
/
conda.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# 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: 2021.05}
- {installer: miniconda, version: py39_4.10.3}
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
# TODO avoid using the deprecated ::set-output:: command
- name: Determine shell on current OS
id: shell
run: |
init, profile = {
"macos": ("bash", "source ~/.bash_profile"),
"windows": ("powershell", ""),
}.get("${{ matrix.os }}".split("-")[0])
print(f"""
::set-output name=init::{init}
::set-output name=profile::{profile}
""")
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 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