From de76149115771ff18c9bd11771b771f9664ded58 Mon Sep 17 00:00:00 2001 From: Taylor Denouden Date: Wed, 15 Feb 2023 10:15:57 -0500 Subject: [PATCH] Simplify caching setup --- .github/workflows/unit-test.yml | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index a613cf7..213e978 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -20,18 +20,6 @@ jobs: matrix: os: [ "ubuntu-latest", "windows-latest", "macos-latest" ] python-version: [ "3.7", "3.8", "3.9", "3.10" ] - include: - - os: ubuntu-latest - label: linux-64 - prefix: /usr/share/miniconda3/envs/my-env - - - os: windows-latest - label: win-64 - prefix: C:\Miniconda3\envs\my-env - - - os: macos-latest - label: macos-64 - prefix: /usr/local/miniconda3/envs/my-env runs-on: ${{ matrix.os }} defaults: @@ -49,13 +37,21 @@ jobs: activate-environment: my-env use-mamba: true - - name: Set cache date - run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV + - name: Get Date + id: get-date + run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT + shell: bash - - uses: actions/cache@v3 + - name: Cache Conda env + uses: actions/cache@v3 with: - path: ${{ matrix.prefix }} - key: ${{ matrix.label }}-py${{ matrix.python-version }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} + path: ${{ env.CONDA }}/envs + key: + conda-${{ runner.os }}--${{ runner.arch }}--py${{ matrix.python-version }}--${{ + steps.get-date.outputs.today }}-${{hashFiles('environment.yml') }}-${{ env.CACHE_NUMBER}} + env: + # Increase this value to reset cache if environment.yml has not changed + CACHE_NUMBER: 0 id: cache - name: Update environment