Merge pull request #385 from williamhobbs/user_guide_search_link #413
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
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 |