-
Notifications
You must be signed in to change notification settings - Fork 75
104 lines (90 loc) · 2.94 KB
/
tests-conda.yml
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
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Tests (Conda)
on:
push:
branches: [main]
pull_request:
branches: [main]
# Allow job to be triggered manually.
workflow_dispatch:
# Cancel in-progress jobs when pushing to the same branch.
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ["windows-latest"]
python-version: ["3.11"]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
defaults:
run:
shell: bash -el {0}
name: Python ${{ matrix.python-version }} on OS ${{ matrix.os }}
steps:
- name: Acquire sources
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: CACHING - Anaconda packages
uses: actions/cache@v3
id: cache-pkg
with:
path: ~/conda_pkgs_dir
key:
conda-pkg-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{
env.CACHE_NUMBER }}-${{ hashFiles('environment-test.yml') }}
env:
# Increase this value if `environment-test.yml` has not changed,
# but you still want to reset the cache.
CACHE_NUMBER: 0
- name: INSTALL - Anaconda setup (Mambaforge)
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
miniforge-variant: Mambaforge
miniforge-version: latest
mamba-version: "*"
use-mamba: true
channels: conda-forge,defaults
channel-priority: true
activate-environment: herbie-test
auto-activate-base: false
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- name: CACHING - Anaconda environment
uses: actions/cache@v3
id: cache-env
with:
path: ${{ env.CONDA }}/envs
key:
conda-env-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{
env.CACHE_NUMBER }}-${{ hashFiles('environment-test.yml') }}
env:
# Increase this value if `environment-test.yml` has not changed,
# but you still want to reset the cache.
CACHE_NUMBER: 0
- name: DEBUG - Anaconda info
run: conda info
- name: DEBUG - Anaconda configuration
run: conda config --show
- name: DEBUG - Environment variables
run: printenv | sort
- name: DEBUG - Program paths
run: |
command -v conda
command -v mamba
- name: INSTALL - Update Anaconda environment
run: mamba env update --name herbie-test --file environment-test.yml
if: steps.cache-env.outputs.cache-hit != 'true'
- name: INSTALL - Project
run: |
pip install --editable=.
- name: Run tests
env:
TMPDIR: ${{ runner.temp }}
run: |
pytest