Skip to content

Commit

Permalink
Add unittest cache
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed May 12, 2023
1 parent 54ce051 commit b31b669
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/variables/cache_number.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CACHE_NUMBER=0
56 changes: 44 additions & 12 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,59 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.11']
include:
- operating-system: ubuntu-latest
python-version: '3.8'
- operating-system: ubuntu-latest
python-version: '3.9'
- operating-system: ubuntu-latest
python-version: '3.10'
- operating-system: macos-latest
python-version: '3.11'
label: osx-64-py-3-11
prefix: /Users/runner/miniconda3/envs/my-env

- operating-system: windows-latest
python-version: '3.11'
label: win-64-py-3-11
prefix: C:\Miniconda3\envs\my-env

- operating-system: ubuntu-latest
python-version: '3.11'
label: linux-64-py-3-11
prefix: /usr/share/miniconda3/envs/my-env

- operating-system: ubuntu-latest
python-version: '3.10'
label: linux-64-py-3-10
prefix: /usr/share/miniconda3/envs/my-env

- operating-system: ubuntu-latest
python-version: 3.9
label: linux-64-py-3-9
prefix: /usr/share/miniconda3/envs/my-env

- operating-system: ubuntu-latest
python-version: 3.8
label: linux-64-py-3-8
prefix: /usr/share/miniconda3/envs/my-env

steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2.2.0
with:
python-version: ${{ matrix.python-version }}
mamba-version: "*"
miniforge-variant: Mambaforge
channels: conda-forge
channel-priority: strict
auto-update-conda: true
environment-file: .ci_support/environment.yml
miniforge-variant: Mambaforge
activate-environment: my-env
use-mamba: true
- name: Set cache date and number
run: |
echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
cat .github/variables/cache_number.env >> $GITHUB_ENV
- uses: actions/cache@v2
with:
path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
run: mamba env update -n my-env -f environment.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Setup
shell: bash -l {0}
run: |
Expand Down

0 comments on commit b31b669

Please sign in to comment.