Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
91241b6
Bump minimum Python version to 3.11 & clarify/test 3.14 support
sadielbartholomew Sep 7, 2026
c879530
Update Actions workflows: remove superfluous step & bump old version
sadielbartholomew Sep 7, 2026
74caab3
Upgrade to use latest versions of external actions
sadielbartholomew Sep 7, 2026
cf44127
Update Actions workflows: improve directory navigation
sadielbartholomew Sep 7, 2026
aa34a68
Update Actions workflows: duplicate updates for test-source-dist
sadielbartholomew Sep 7, 2026
6eaf2c1
Update source dist build command from deprecated
sadielbartholomew Sep 8, 2026
aed903c
Temporarily remove Mac OS from CI matrix to see Ubuntu results
sadielbartholomew Sep 8, 2026
4894b4e
Remove pin on UDUNITS2 set version in Actions test workflows
sadielbartholomew Sep 8, 2026
7cef51c
Allow expected non-zero (5) exit code in test workflows
sadielbartholomew Sep 8, 2026
62532e7
Merge remote-tracking 'upstream/main' into ci-and-python-support
sadielbartholomew Sep 8, 2026
59cf44b
Fix to PR #965 to handle lack of healpix installation
sadielbartholomew Sep 8, 2026
8df753d
Workflows: add step to install packages required for building
sadielbartholomew Sep 8, 2026
a1e9cec
Update test_regrid_healpix to skip on lack of modules
sadielbartholomew Sep 8, 2026
0304b2d
Update test_functions to use approach of cfdm.environment()
sadielbartholomew Sep 8, 2026
0a8d616
Update test_Data_concatenate: make log output test deterministic
sadielbartholomew Sep 8, 2026
0229d36
Replace pre Python v3.10 workaround test logic with assertNoLogs
sadielbartholomew Sep 8, 2026
7727506
Update cf/test/test_regrid_healpix.py to consolidate logic
sadielbartholomew Sep 9, 2026
0da6d2d
Update Changelog.rst to add divider line
sadielbartholomew Sep 9, 2026
8c6ecd0
Updates towards passing test suite in CI jobs + tidy
sadielbartholomew Sep 9, 2026
2054e03
test_Data: fix log output assertion test issue picked up by CI job
sadielbartholomew Sep 9, 2026
6039496
Update test-source-dist workflow to prevent empty version var
sadielbartholomew Sep 9, 2026
c5ce6c3
Update setup.py & MANIFEST.in for warnings raised by CI job
sadielbartholomew Sep 9, 2026
b18be36
test_Data: fix for further log assertion test issue
sadielbartholomew Sep 9, 2026
a8892ea
Add missing umfile.pp to manifest, revert Mac OS testing
sadielbartholomew Sep 9, 2026
7c42610
Replace Mac OS architecture spec. in CI jobs MacOS matrix
sadielbartholomew Sep 9, 2026
07cd4bb
Separate run-test-suite.yml into job per OS for fail-fast control
sadielbartholomew Sep 9, 2026
80e67b9
Workflows: install all optional dependencies to minimise skips
sadielbartholomew Sep 10, 2026
199f22e
Remove old cf/etc/ dir. and tidy
sadielbartholomew Sep 10, 2026
dd0b4ce
Remove redundant lines in test-source-dist.yml workflow
sadielbartholomew Sep 10, 2026
0d7c4b7
Fix UnboundLocalError reachable with log_level<2
sadielbartholomew Sep 10, 2026
192fa24
Update all references of build command to new command
sadielbartholomew Sep 10, 2026
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
390 changes: 249 additions & 141 deletions .github/workflows/run-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,145 +14,253 @@ on:
branches:
- main

# Note a workflow can have 1+ jobs that can run sequentially or in parallel.
jobs:
# TODO: setup parallel runs (-job-2 etc.) of sub-tests for speed-up
test-suite-job-0:

# Set-up the build matrix. We run on different distros and Python versions.
strategy:
matrix:
# Skip older ubuntu-16.04 & macos-10.15 to save usage resource
os: [ubuntu-latest, macos-latest]
# Note: keep versions quoted as strings else 3.10 taken as 3.1, etc.
python-version: ["3.10", "3.11", "3.12", "3.13"]

# Run on new and old(er) versions of the distros we support (Linux, Mac OS)
runs-on: ${{ matrix.os }}

# The sequence of tasks that will be executed as part of this job:
steps:

- name: Checkout cf-python
uses: actions/checkout@v3
with:
path: main

# Provide a notification message
- name: Notify about setup
run: echo Now setting up the environment for the cf-python test suite...

- name: Checkout the current cfdm main to use as the dependency
uses: actions/checkout@v3
with:
repository: NCAS-CMS/cfdm
path: cfdm

# Prepare to run the test-suite on different versions of Python 3:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

# Setup conda, which is the simplest way to access all dependencies,
# especially as some are C-based so otherwise difficult to setup.
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniconda-version: "latest"
activate-environment: cf-latest
python-version: ${{ matrix.python-version }}
channels: ncas, conda-forge

# Ensure shell is configured with conda and pip correctly activated.
- name: Check conda and pip config
shell: bash -l {0}
run: |
echo "*Conda report:*"
conda info
conda list
conda config --show-sources
conda config --show
echo "*Pip report:*"
pip --version
pip list

# Install cf-python dependencies, excluding cfunits and cfdm, pre-testing
# We do so with conda (and pip) which was setup in a previous step.
- name: Install dependencies excluding the NCAS CF Data Tools libraries
shell: bash -l {0}
run: |
conda install -c ncas -c conda-forge cf-plot udunits2=2.2.25
conda install -c conda-forge mpich esmpy
conda install scipy matplotlib dask
pip install pycodestyle

# Install cfunits and cfdm (from development main branch) separately,
# since it is most robust to test a no-dependency installation of cf,
# then finally install the cf-python development version.
- name: Install cfunits then development versions of cfdm and cf-python
shell: bash -l {0}
run: |
pip install cfunits
cd ${{ github.workspace }}/cfdm
pip install -e .
cd ${{ github.workspace }}/main
pip install --no-deps -e .

# Install the coverage library
# We do so with conda which was setup in a previous step.
- name: Install coverage
shell: bash -l {0}
run: |
conda install coverage

# Provide another notification message
- name: Notify about starting testing
run: echo Setup complete. Now starting to run the cf-python test suite...

# Create netCDF files needed for testing. A separate step is required
# for this so the files can be registered and recognised first; locally
# they are created and used on-the-fly by 'run_tests_and_coverage'.
- name: Create netCDF test files, e.g. test_file.nc
shell: bash -l {0}
run: |
cd ${{ github.workspace }}/main/cf/test
python create_test_files.py
python setup_create_field.py
ls -la

# Finally run the test suite and generate a coverage report!
- name: Run test suite and generate a coverage report
shell: bash -l {0}
run: |
cd ${{ github.workspace }}/main/cf/test
./run_tests_and_coverage --nohtml

# For one job only, generate a coverage report:
- name: Upload coverage report to Codecov
# Get coverage from only one job (choose with Ubuntu Python 3.10 as
# representative). Note that we could use a separate workflow
# to setup Codecov reports, but given the amount of steps required to
# install including dependencies via conda, that a separate workflow
# would have to run anyway, it is simplest to add it in this flow.
# Also, it means code coverage is only generated if the test suite is
# passing at least for that job, avoiding useless coverage reports.
uses: codecov/codecov-action@v3
# Warning: GitHub Actions expressions require single-quoted strings.
# Double quotes will break workflow validation (even though YAML allows
# them). So don't change the quoting below.
if: |
matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
with:
file: |
${{ github.workspace }}/main/cf/test/cf_coverage_reports/coverage.xml
fail_ci_if_error: true
flags: unittests
name: codecov-umbrella

# End with a message indicating the suite has completed its run
- name: Notify about a completed run
run: |
echo The cf-python test suite has completed and you may now
echo inspect the results.
# Use different jobs for a Linux OS and for a Mac OS, so we can fail all on
# a given OS if one of those (per Python version) jobs fails, instead of
# either having to choose between all other jobs cancelling or none of
# them with one failure.

# Test the test suite on Linux (with Ubuntu as representative dist.)
test-on-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]

steps:

- name: Checkout cf-python
uses: actions/checkout@v7
with:
path: main

# Provide a notification message
- name: Notify about setup
run: echo Now setting up the environment for the cf-python test suite...

- name: Checkout the current cfdm main to use as the dependency
uses: actions/checkout@v7
with:
repository: NCAS-CMS/cfdm
path: cfdm

# Setup conda, which is the simplest way to access all dependencies,
# especially as some are C-based so otherwise difficult to setup.
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v4
with:
auto-update-conda: true
miniconda-version: "latest"
activate-environment: cf-latest
python-version: ${{ matrix.python-version }}
channels: ncas, conda-forge

# Ensure shell is configured with conda and pip correctly activated.
- name: Check conda and pip config
shell: bash -l {0}
run: |
echo "*Conda report:*"
conda info
conda list
conda config --show-sources
conda config --show
echo "*Pip report:*"
pip --version
pip list

# Install cf-python dependencies, excluding cfunits and cfdm, pre-testing
# We do so with conda (and pip) which was setup in a previous step.
- name: Install dependencies excluding the NCAS CF Data Tools libraries
shell: bash -l {0}
run: |
conda install -c ncas -c conda-forge cf-plot udunits2
conda install -c conda-forge mpich esmpy
conda install scipy matplotlib dask
# Avoid pip unless cannot get from conda
pip install PyActiveStorage healpix pytest pycodestyle coverage

# Install cfunits and cfdm (from development main branch) separately,
# since it is most robust to test a no-dependency installation of cf,
# then finally install the cf-python development version.
- name: Install cfunits then development versions of cfdm and cf-python
shell: bash -l {0}
run: |
pip install cfunits
cd cfdm
pip install -e .
cd ../main
pip install --no-deps -e .

# Install the coverage library
# We do so with conda which was setup in a previous step.
- name: Install coverage
shell: bash -l {0}
run: |
conda install coverage

# Provide another notification message
- name: Notify about starting testing
run: echo Setup complete. Now starting to run the cf-python test suite...

# Create netCDF files needed for testing. A separate step is required
# for this so the files can be registered and recognised first; locally
# they are created and used on-the-fly by 'run_tests_and_coverage'.
- name: Create netCDF test files, e.g. test_file.nc
shell: bash -l {0}
working-directory: ${{ github.workspace }}/main/cf/test
run: |
# Exit code 5 means no tests were found, which is expected for
# create_test_files.py. Allow that code but fail the workflow
# for any other non-zero exit code, to avoid hiding other failures.
python create_test_files.py || test $? -eq 5
python setup_create_field.py
ls -la

# Finally run the test suite and generate a coverage report!
- name: Run test suite and generate a coverage report
shell: bash -l {0}
working-directory: ${{ github.workspace }}/main/cf/test
run: |
./run_tests_and_coverage --nohtml

# For one job only, generate a coverage report:
- name: Upload coverage report to Codecov
# Get coverage from only one job (choose with Ubuntu Python 3.14 as
# representative). Note that we could use a separate workflow
# to setup Codecov reports, but given the amount of steps required to
# install including dependencies via conda, that a separate workflow
# would have to run anyway, it is simplest to add it in this flow.
# Also, it means code coverage is only generated if the test suite is
# passing at least for that job, avoiding useless coverage reports.
uses: codecov/codecov-action@v7
# Warning: GitHub Actions expression string literals require
# single (not double) quoted strings.
if: |
matrix.python-version == '3.14'
with:
file: |
${{ github.workspace }}/main/cf/test/cf_coverage_reports/coverage.xml
fail_ci_if_error: true
flags: unittests
name: codecov-umbrella

# End with a message indicating the suite has completed its run
- name: Notify about a completed run
run: |
echo The cf-python test suite has completed and you may now
echo inspect the results.


# Test the test suite on Mac OS: use on 'macos-*-intel' rather than
# 'macos-*' (which specifies ARM64 architecture)
test-on-mac:
# Mac OS ARM64 via 'macos-latest' is also available but not compatible
# with our conda installation support
runs-on: macos-15-intel
strategy:
fail-fast: true
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14"]

steps:

- name: Checkout cf-python
uses: actions/checkout@v7
with:
path: main

# Provide a notification message
- name: Notify about setup
run: echo Now setting up the environment for the cf-python test suite...

- name: Checkout the current cfdm main to use as the dependency
uses: actions/checkout@v7
with:
repository: NCAS-CMS/cfdm
path: cfdm

# Setup conda, which is the simplest way to access all dependencies,
# especially as some are C-based so otherwise difficult to setup.
- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v4
with:
auto-update-conda: true
miniconda-version: "latest"
activate-environment: cf-latest
python-version: ${{ matrix.python-version }}
channels: ncas, conda-forge

# Ensure shell is configured with conda and pip correctly activated.
- name: Check conda and pip config
shell: bash -l {0}
run: |
echo "*Conda report:*"
conda info
conda list
conda config --show-sources
conda config --show
echo "*Pip report:*"
pip --version
pip list

# Install cf-python dependencies, excluding cfunits and cfdm, pre-testing
# We do so with conda (and pip) which was setup in a previous step.
- name: Install dependencies excluding the NCAS CF Data Tools libraries
shell: bash -l {0}
run: |
conda install -c ncas -c conda-forge cf-plot udunits2
conda install -c conda-forge mpich esmpy
conda install scipy matplotlib dask
# Avoid pip unless cannot get from conda
pip install PyActiveStorage healpix pytest pycodestyle coverage

# Install cfunits and cfdm (from development main branch) separately,
# since it is most robust to test a no-dependency installation of cf,
# then finally install the cf-python development version.
- name: Install cfunits then development versions of cfdm and cf-python
shell: bash -l {0}
run: |
pip install cfunits
cd cfdm
pip install -e .
cd ../main
pip install --no-deps -e .

# Install the coverage library
# We do so with conda which was setup in a previous step.
- name: Install coverage
shell: bash -l {0}
run: |
conda install coverage

# Provide another notification message
- name: Notify about starting testing
run: echo Setup complete. Now starting to run the cf-python test suite...

# Create netCDF files needed for testing. A separate step is required
# for this so the files can be registered and recognised first; locally
# they are created and used on-the-fly by 'run_tests_and_coverage'.
- name: Create netCDF test files, e.g. test_file.nc
shell: bash -l {0}
working-directory: ${{ github.workspace }}/main/cf/test
run: |
# Exit code 5 means no tests were found, which is expected for
# create_test_files.py. Allow that code but fail the workflow
# for any other non-zero exit code, to avoid hiding other failures.
python create_test_files.py || test $? -eq 5
python setup_create_field.py
ls -la

# Finally run the test suite and generate a coverage report!
- name: Run test suite and generate a coverage report
shell: bash -l {0}
working-directory: ${{ github.workspace }}/main/cf/test
run: |
./run_tests_and_coverage --nohtml

# End with a message indicating the suite has completed its run
- name: Notify about a completed run
run: |
echo The cf-python test suite on Mac has completed and you may now
echo inspect the results.
Loading
Loading