Skip to content

Commit e85ede3

Browse files
add conda environment file
1 parent c9ee60d commit e85ede3

2 files changed

Lines changed: 91 additions & 0 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: conda builds
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'conda-environment.yml'
7+
- '.github/workflows/test_conda-build.yml'
8+
schedule:
9+
- cron: '17 22 * * 6' # Every Saturday at 22:17
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
defaults:
17+
run:
18+
shell: bash
19+
20+
env:
21+
FORCE_COLOR: 2
22+
23+
jobs:
24+
test_conda_install:
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 10
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
python-version: ['3.8', '3']
31+
env:
32+
ENV_FILE: conda-environment.yml
33+
steps:
34+
- name: checkout cylc-flow
35+
uses: actions/checkout@v4
36+
37+
- name: modify conda env file
38+
run: |
39+
# write environment file
40+
echo " - pip" >> "$ENV_FILE" # list pip as a dependency
41+
echo " - pip:" >> "$ENV_FILE" # add a pip section
42+
echo " - ." >> "$ENV_FILE" # install metomi-rose (pip install .)
43+
cat "$ENV_FILE"
44+
45+
- name: build conda env
46+
uses: conda-incubator/setup-miniconda@v3
47+
with:
48+
python-version: ${{ matrix.python-version }}
49+
environment-file: ${{ env.ENV_FILE }}
50+
51+
- name: check rose installation
52+
shell: bash -el {0}
53+
run: |
54+
conda run -n test rose version --long
55+
pip check
56+
57+
- name: check for activate scripts
58+
shell : bash -el {0}
59+
run: |
60+
# https://github.com/cylc/cylc-flow/issues/3704#issuecomment-897442365
61+
# locate all activate scripts
62+
find "$CONDA_PREFIX" -name "activate.d" | tee > activates.txt
63+
# ignore the conda activate script itself
64+
sed -i "\|$CONDA_PREFIX/etc/conda/activate.d|d" activates.txt
65+
# check to make sure no packages have contributed new activate scripts
66+
# (we rely on having a conda activate-less environment)
67+
if [[ $(wc -l < activates.txt) -ne 0 ]]; then
68+
echo '::error::Found activate scripts in installation.'
69+
cat activates.txt >&2
70+
exit 1
71+
fi

conda-environment.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: rose-dev
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
# outut: metomi-rose-base
6+
- __unix
7+
- python >= 3.7.0
8+
- aiofiles
9+
- jinja2 >= 2.10.1
10+
- keyring >=23,<24
11+
- ldap3
12+
- metomi-isodatetime >=1!3.0<1!4.0
13+
- psutil >=5.6.0
14+
- requests
15+
- sqlalchemy >=1,<2
16+
- importlib_metadata >=5.0 # py<3.12
17+
- importlib_resources >=2.0 # py<3.9
18+
19+
# output: metomi-rose
20+
- pygraphviz >1.0,!=1.8

0 commit comments

Comments
 (0)