From 95f092c0031cfe253b70f9d2f9a9357c8ba4a1ae Mon Sep 17 00:00:00 2001 From: Dugal Harris Date: Fri, 26 Jan 2024 17:22:12 +0200 Subject: [PATCH] cache environment --- .../workflows/run-unit-tests_conda-forge.yml | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/run-unit-tests_conda-forge.yml b/.github/workflows/run-unit-tests_conda-forge.yml index 86923a9..81ea12c 100644 --- a/.github/workflows/run-unit-tests_conda-forge.yml +++ b/.github/workflows/run-unit-tests_conda-forge.yml @@ -10,42 +10,51 @@ on: jobs: test: runs-on: ${{ matrix.os }} + defaults: run: - shell: bash -l {0} + shell: bash -el {0} + strategy: fail-fast: false matrix: os: [ macos-latest, ubuntu-latest, windows-latest ] python-version: ['3.9', '3.10', '3.11'] + steps: - - uses: actions/checkout@v4 # for the test data + - uses: actions/checkout@v4 # get the test data - name: Get Date id: get-date run: echo "week=$(/bin/date -u '+%Y%U')" >> $GITHUB_OUTPUT shell: bash - - name: Cache conda - uses: actions/cache@v4 - with: - path: ~/conda_pkgs_dir - key: ${{ runner.os }}-${{ matrix.python-version }}-${{ steps.get-date.outputs.week }}-${{ hashFiles('pyproject.toml') }} - - uses: conda-incubator/setup-miniconda@v3 with: python-version: ${{ matrix.python-version }} - channels: conda-forge - channel-priority: true + miniforge-version: latest +# channels: conda-forge +# channel-priority: true activate-environment: test auto-update-conda: true conda-solver: libmamba + - name: Cache conda + uses: actions/cache@v4 + id: cache + with: +# path: ~/conda_pkgs_dir +# key: ${{ runner.os }}-${{ matrix.python-version }}-${{ steps.get-date.outputs.week }}-${{ hashFiles('pyproject.toml') }} + path: ${{ env.CONDA }}/envs + key: ${{ runner.os }}-${{ runner.arch }}-${{ matrix.python-version }}-${{ steps.get-date.outputs.week }}-${{ hashFiles('pyproject.toml') }} + - name: Install dependencies + if: steps.cache.outputs.cache-hit != 'true' run: | conda info conda install -c conda-forge rasterio opencv click tqdm pyyaml fsspec requests aiohttp pytest pytest-cov conda list + - name: Run unit tests run: | python -m pytest --cov=orthority --cov-report=term-missing --cov-report=xml:coverage.xml ./tests