Skip to content

Commit

Permalink
cache by date
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Sep 12, 2023
1 parent 38a02a4 commit 40f6ff9
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,18 @@ env:
PYSYN_CDBS: /tmp/trds

jobs:
date:
name: get current date
runs-on: ubuntu-latest
steps:
- run: echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT
id: date
shell: bash
outputs:
date: ${{ steps.date.outputs.date }}
build:
name: build (py${{ matrix.python-version }}, ${{ matrix.runs-on }})
needs: [ date ]
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
Expand All @@ -48,13 +58,17 @@ jobs:
create-args: >-
python=${{ matrix.python-version }}
conda
cache-downloads: true
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.date.outputs.date }}
init-shell: none
generate-run-shell: true
- run: conda env export --no-build | grep -v "name:" | grep -v "prefix:"
- run: pytest -n auto tests/test_import.py
unit_tests:
name: ${{ matrix.package }} (py${{ matrix.python-version }}, ${{ matrix.runs-on }})
needs: [ build ]
needs: [ build, date ]
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -91,8 +105,10 @@ jobs:
create-args: >-
python=${{ matrix.python-version }}
conda
cache-environment: true
cache-downloads: true
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.date.outputs.date }}
init-shell: none
generate-run-shell: true
- if: matrix.extras != ''
Expand All @@ -113,7 +129,7 @@ jobs:
CRDS_SERVER_URL: ${{ matrix.env.CRDS_SERVER_URL }}
unit_tests_from_source:
name: ${{ matrix.package }} (py${{ matrix.python-version }}, ${{ matrix.runs-on }})
needs: [ build ]
needs: [ build, date ]
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -166,6 +182,10 @@ jobs:
create-args: >-
python=${{ matrix.python-version }}
conda
cache-downloads: true
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.date.outputs.date }}
init-shell: none
generate-run-shell: true
- run: echo "version=$(conda list | awk '$1 == "${{ matrix.package }}" {print $2}')" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -199,7 +219,7 @@ jobs:
working-directory: ${{ matrix.package }}
smoke_tests:
name: ${{ matrix.package }} (py${{ matrix.python-version }}, ${{ matrix.runs-on }})
needs: [ build ]
needs: [ build, date ]
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -234,8 +254,10 @@ jobs:
create-args: >-
python=${{ matrix.python-version }}
conda
cache-environment: true
cache-downloads: true
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.date.outputs.date }}
init-shell: none
generate-run-shell: true
- if: matrix.extras != ''
Expand Down Expand Up @@ -277,7 +299,7 @@ jobs:
args: --pattern "(?P<base>\d+\.\d+\.\d+)"
export:
name: export (py${{ matrix.python-version }}, ${{ matrix.runs-on }})
needs: [ build, version ]
needs: [ build, version, date ]
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
Expand All @@ -293,8 +315,10 @@ jobs:
create-args: >-
python=${{ matrix.python-version }}
conda
cache-environment: true
cache-downloads: true
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.date.outputs.date }}
init-shell: none
generate-run-shell: true
- run: echo "filename=stenv-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ needs.version.outputs.version }}.yaml" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 40f6ff9

Please sign in to comment.