Skip to content

Commit

Permalink
Merge pull request #1627 from zm711/update-ci-2
Browse files Browse the repository at this point in the history
change CI to not cache and test on two versions of numpy
  • Loading branch information
alejoe91 authored Jan 17, 2025
2 parents c034591 + fd821a9 commit 54130ce
Showing 1 changed file with 28 additions and 23 deletions.
51 changes: 28 additions & 23 deletions .github/workflows/io-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ concurrency: # Cancel previous workflows on the same pull request

jobs:
build-and-test:
name: Test on (${{ inputs.os }}) (${{ matrix.python-version}})
name: Test on (${{ inputs.os }}) (${{ matrix.python-version}}) (${{ matrix.numpy-version }})
runs-on: ${{ inputs.os }}
strategy:
fail-fast: true
matrix:
python-version: ['3.9', '3.13']
python-version: ['3.9', '3.12']
numpy-version: ['1.26', '2.0']
defaults:
# by default run in bash mode (required for conda usage)
run:
Expand Down Expand Up @@ -50,31 +51,34 @@ jobs:
with:
activate-environment: neo-test-env-${{ matrix.python-version }}
python-version: "${{ matrix.python-version }}"

- name: Get current dependencies hash
id: dependencies
run: |
echo "hash=${{hashFiles('**/pyproject.toml', '**/environment_testing.yml')}}" >> $GITHUB_OUTPUT
- uses: actions/cache/restore@v3

# TEST NOT USING CACHE
#- name: Get current dependencies hash
# id: dependencies
# run: |
# echo "hash=${{hashFiles('**/pyproject.toml', '**/environment_testing.yml')}}" >> $GITHUB_OUTPUT

#- uses: actions/cache/restore@v3
# the cache for python package is reset:
# * every month
# * when package dependencies change
id: cache-conda-env
with:
path: /usr/share/miniconda/envs/neo-test-env-${{ matrix.python-version }}
key: ${{ runner.os }}-conda-env-${{ steps.dependencies.outputs.hash }}-${{ steps.date.outputs.date }}
# id: cache-conda-env
# with:
# path: /usr/share/miniconda/envs/neo-test-env-${{ matrix.python-version }}
# key: ${{ runner.os }}-conda-env-${{ steps.dependencies.outputs.hash }}-${{ steps.date.outputs.date }}
# restore-keys match any key that starts with the restore-key
restore-keys: |
${{ runner.os }}-conda-env-${{ steps.dependencies.outputs.hash }}-
${{ runner.os }}-conda-env-
# restore-keys: |
# ${{ runner.os }}-conda-env-${{ steps.dependencies.outputs.hash }}-
# ${{ runner.os }}-conda-env-

- name: Install testing dependencies
# testing environment is only created from yml if no cache was found
# restore-key hits should result in `cache-hit` == 'false'
if: steps.cache-conda-env.outputs.cache-hit != 'true'
#if: steps.cache-conda-env.outputs.cache-hit != 'true'
run: |
conda env update --name neo-test-env-${{ matrix.python-version }} --file environment_testing.yml --prune
conda install datalad pip numpy=${{ matrix.numpy-version }} -c conda-forge
# this command is for updating cache. We are resting removal.
# conda env update --name neo-test-env-${{ matrix.python-version }} --file environment_testing.yml --prune

- name: Configure git
run: |
Expand All @@ -89,16 +93,17 @@ jobs:
- name: Install neo including dependencies
# installation with dependencies is only required if no cache was found
# restore-key hits should result in `cache-hit` == 'false'
if: steps.cache-conda-env.outputs.cache-hit != 'true'
# if: steps.cache-conda-env.outputs.cache-hit != 'true'
run: |
pip install --upgrade -e .
pip install .[test]
- name: Install neo without dependencies
# TEST NOT USING CACHE
#- name: Install neo without dependencies
# only installing neo version to test as dependencies should be in cached conda env already
if: steps.cache-conda-env.outputs.cache-hit == 'true'
run: |
pip install --no-dependencies -e .
# if: steps.cache-conda-env.outputs.cache-hit == 'true'
# run: |
# pip install --no-dependencies -e .

- name: Install wine
run: |
Expand Down

0 comments on commit 54130ce

Please sign in to comment.