From 8260e27ef3a054672ccf6533be2f8ab0c4f74067 Mon Sep 17 00:00:00 2001 From: Ricardo Vieira Date: Fri, 12 Apr 2024 09:40:12 +0200 Subject: [PATCH] Switch to setup-micromamba Co-authored-by: Ben Mares --- .github/workflows/test.yml | 80 +++++++------------------------------- 1 file changed, 14 insertions(+), 66 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index defc83ca..1379b99c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,49 +28,23 @@ jobs: PYTENSOR_FLAGS: gcc__cxxflags='-march=native' defaults: run: - shell: bash -l {0} + shell: bash -leo pipefail {0} steps: - uses: actions/checkout@v4 - - name: Cache conda - uses: actions/cache@v4 - env: - # Increase this value to reset cache if environment-test.yml has not changed - CACHE_NUMBER: 0 + - uses: mamba-org/setup-micromamba@v1 with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-py${{matrix.python-version}}-conda-${{ env.CACHE_NUMBER }}-${{ - hashFiles('conda-envs/environment-test.yml') }} - - name: Cache multiple paths - uses: actions/cache@v4 - env: - # Increase this value to reset cache if requirements.txt has not changed - CACHE_NUMBER: 0 - with: - path: | - ~/.cache/pip - $RUNNER_TOOL_CACHE/Python/* - ~\AppData\Local\pip\Cache - key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ - hashFiles('requirements.txt') }} - - uses: conda-incubator/setup-miniconda@v3 - with: - miniforge-variant: Mambaforge - miniforge-version: latest - mamba-version: "*" - activate-environment: pymc-experimental-test - channel-priority: strict environment-file: conda-envs/environment-test.yml - python-version: ${{matrix.python-version}} - use-mamba: true - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + create-args: >- + python=${{matrix.python-version}} + environment-name: pymc-experimental-test + init-shell: bash + cache-environment: true - name: Install pymc-experimental run: | - conda activate pymc-experimental-test pip install -e . python --version - name: Run tests run: | - conda activate pymc-experimental-test python -m pytest -vv --cov=pymc_experimental --cov-append --cov-report=xml --cov-report term --durations=50 $TEST_SUBSET - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 @@ -92,51 +66,25 @@ jobs: PYTENSOR_FLAGS: gcc__cxxflags='-march=core2' defaults: run: - shell: cmd + shell: cmd /C call {0} steps: - uses: actions/checkout@v4 - - name: Cache conda - uses: actions/cache@v4 - env: - # Increase this value to reset cache if conda-envs/windows-environment-test.yml has not changed - CACHE_NUMBER: 0 - with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-py${{matrix.python-version}}-conda-${{ env.CACHE_NUMBER }}-${{ - hashFiles('conda-envs/windows-environment-test.yml') }} - - name: Cache multiple paths - uses: actions/cache@v4 - env: - # Increase this value to reset cache if requirements.txt has not changed - CACHE_NUMBER: 0 - with: - path: | - ~/.cache/pip - $RUNNER_TOOL_CACHE/Python/* - ~\AppData\Local\pip\Cache - key: ${{ runner.os }}-build-${{ matrix.python-version }}-${{ - hashFiles('requirements.txt') }} - - uses: conda-incubator/setup-miniconda@v3 + - uses: mamba-org/setup-micromamba@v1 with: - miniforge-variant: Mambaforge - miniforge-version: latest - mamba-version: "*" - activate-environment: pymc-experimental-test - channel-priority: strict environment-file: conda-envs/windows-environment-test.yml - python-version: ${{matrix.python-version}} - use-mamba: true - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + create-args: >- + python=${{matrix.python-version}} + environment-name: pymc-experimental-test + init-shell: cmd.exe + cache-environment: true - name: Install pymc-experimental run: | - conda activate pymc-experimental-test pip install -e . python --version - name: Run tests # This job uses a cmd shell, therefore the environment variable syntax is different! # The ">-" in the next line replaces newlines with spaces (see https://stackoverflow.com/a/66809682). run: >- - conda activate pymc-experimental-test && python -m pytest -vv --cov=pymc_experimental --cov-append --cov-report=xml --cov-report term --durations=50 %TEST_SUBSET% - name: Upload coverage to Codecov uses: codecov/codecov-action@v2