Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change CI to not cache and test on two versions of numpy #1627

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading