Skip to content

Commit

Permalink
Merge pull request #228 from jtsiddons/uvnit_testing
Browse files Browse the repository at this point in the history
Update unit testing to use UV over micromamba for environment management
  • Loading branch information
ludwiglierhammer authored Feb 18, 2025
2 parents f870d81 + 286f27d commit e444bbe
Show file tree
Hide file tree
Showing 3 changed files with 306 additions and 260 deletions.
37 changes: 24 additions & 13 deletions .github/workflows/testing-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,41 +27,49 @@ jobs:
matrix:
os: ["ubuntu-latest"]
# Bookend python versions
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- name: Set environment variables
run: |
echo "CONDA_ENV_FILE=environment.yml" >> $GITHUB_ENV
echo "UV_ENV_FILE=pyproject.toml" >> $GITHUB_ENV
echo "PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
echo "UV_CACHE_DIR=/tmp/.uv-cache" >> $GITHUB_ENV
- name: Create conda environment
uses: mamba-org/setup-micromamba@0dea6379afdaffa5d528b3d1dabc45da37f443fc # v2.0.4
- name: Install uv
uses: astral-sh/setup-uv@4db96194c378173c656ce18a155ffc14a9fc4355 # v5.2.2
with:
cache-downloads: true
cache-downloads-key: "${{runner.os}}-${{runner.arch}}-py${{matrix.python-version}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
environment-file: environment.yml
create-args: >-
python=${{ matrix.python-version }}
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-local-path: ${{ env.UV_CACHE_DIR }}

- name: Restore uv cache
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ runner.os }}-${{runner.arch}}-py${{matrix.python-version}}-${{ hashFiles(env.UV_ENV_FILE) }}
restore-keys: |
uv-${{ runner.os }}-${{runner.arch}}-py${{matrix.python-version}}-${{ hashFiles(env.UV_ENV_FILE) }}
uv-${{ runner.os }}-${{runner.arch}}-py${{matrix.python-version}}
- name: Install cdm reader mapper toolbox
run: |
python -m pip install --no-deps -e .
uv sync --all-extras --dev
- name: Version info
run: |
conda info -a
conda list
uv version
uv pip list
- name: Import cdm_reader_mapper toolbox
run: |
python -c "import cdm_reader_mapper"
- name: Run tests
timeout-minutes: 10
run: python -u -m pytest
run: uv run pytest tests
--cov=cdm_reader_mapper
--cov-report=xml
--junitxml=test-results/${{ runner.os }}-${{ matrix.python-version }}.xml
Expand All @@ -74,3 +82,6 @@ jobs:
env_vars: RUNNER_OS,PYTHON_VERSION
name: codecov-umbrella
fail_ci_if_error: false

- name: Minimise uv cache
run: uv cache prune --ci
17 changes: 17 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,23 @@
Changelog
=========

2.0.1 (unreleased)
------------------
Contributors to this version: Ludwig Lierhammer (:user:`ludwiglierhammer`) and Joseph Siddons (:user:`jtsiddons`)

Announcements
^^^^^^^^^^^^^
This release drops support for Python 3.9 and adds support for Python 3.13 (:pull:`228`, :pull:`229`)

New features and enhancements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* add environment.yml file (:pull:`229`)

Internal changes
^^^^^^^^^^^^^^^^
* GitHub workflow for ``testing_suite`` now uses ``uv`` for environment management, replacing ``micromamba`` (:pull:`228`)
* rename ci/requirements to CI and tidy up requirements/dependencies (:pull:`229`)

2.0.0 (2025-02-14)
------------------
Contributors to this version: Ludwig Lierhammer (:user:`ludwiglierhammer`) and Joseph Siddons (:user:`jtsiddons`)
Expand Down
Loading

0 comments on commit e444bbe

Please sign in to comment.