From f76460d02bdd0ca908fa7aef684e2c87c1821fdb Mon Sep 17 00:00:00 2001 From: jbusecke Date: Wed, 7 Jun 2023 15:26:55 -0400 Subject: [PATCH] Revamping ci to minimamba --- .github/workflows/ci.yaml | 78 +++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e22b8d8..70e5111 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,32 +24,24 @@ jobs: python-version: ["3.9", "3.10"] steps: - uses: actions/checkout@v3 - - name: Cache conda - uses: actions/cache@v3 - env: - # Increase this value to reset cache if ci/environment.yml has not changed - CACHE_NUMBER: 0 + - name: Create conda environment + uses: mamba-org/provision-with-micromamba@main with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment.yml') }} - - uses: conda-incubator/setup-miniconda@v2 - with: - mamba-version: "*" - channels: conda-forge, defaults - activate-environment: test_env_xarrayutils # Defined in ci/environment*.yml - auto-update-conda: false - python-version: ${{ matrix.python-version }} + cache-downloads: true + cache-env: true + micromamba-version: 'latest' environment-file: ci/environment.yml - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! - - name: Set up conda environment + extra-specs: | + python=${{ matrix.python-version }} + - name: Install xarrayutils run: | - python -m pip install -e . + python -m pip install -e . --no-deps conda list - name: Run Tests run: | pytest -n auto --cov=./ --cov-report=xml - name: Upload code coverage to Codecov - uses: codecov/codecov-action@v3.1.1 + uses: codecov/codecov-action@v3.1.3 with: file: ./coverage.xml flags: unittests @@ -63,25 +55,31 @@ jobs: run: shell: bash -l {0} steps: - - uses: actions/checkout@v3 - - name: Cache conda - uses: actions/cache@v3 - env: - # Increase this value to reset cache if ci/environment-upstream-dev.yml has not changed - CACHE_NUMBER: 0 - with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ hashFiles('ci/environment-upstream-dev.yml') }} - - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: test_env_xarrayutils # Defined in ci/environment-upstream-dev.yml - auto-update-conda: false - environment-file: ci/environment-upstream-dev.yml - use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! - - name: Set up conda environment - run: | - python -m pip install -e . - conda list - - name: Run Tests - run: | - pytest -n auto + - uses: actions/checkout@v3 + - name: Create conda environment + uses: mamba-org/provision-with-micromamba@main + with: + cache-downloads: true + cache-env: true + micromamba-version: 'latest' + environment-file: ci/environment-upstream-dev.yml + extra-specs: | + python=3.10 + - name: Install xarrayutils + run: | + python -m pip install -e . --no-deps + conda list + - name: Run Tests + run: | + pytest -n auto --cov=./ --cov-report=xml + - name: Upload code coverage to Codecov + uses: codecov/codecov-action@v3.1.3 + with: + file: ./coverage.xml + flags: unittests + env_vars: OS,PYTHON + name: codecov-umbrella + fail_ci_if_error: false + - name: Run Tests + run: | + pytest -n auto