Skip to content

netcdfread: safer version handling for Conventions property #739

netcdfread: safer version handling for Conventions property

netcdfread: safer version handling for Conventions property #739

Workflow file for this run

# A GitHub Action to run the cfdm test suite after events on main.
name: Run test suite
# Triggers the workflow on push or PR events for the main branch (only)
on:
push:
branches:
- main
pull_request:
# default (from docs) is just on [opened, synchronize, reopened]
types: [opened, reopened, ready_for_review, edited]
branches:
- main
# Note a workflow can have 1+ jobs that can run sequentially or in parallel.
jobs:
run-test-suite-job:
# Set-up the build matrix. We run on different distros and Python versions.
strategy:
matrix:
os: [ubuntu-latest, ubuntu-18.04, macos-latest, macos-10.15]
# Note: keep versions quoted as strings else 3.10 taken as 3.1, etc.
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
# 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
uses: actions/checkout@v2
# Provide a notification message
- name: Notify about setup
run: echo Now setting up the environment for the cfdm test suite...
# Prepare to run the test-suite on different versions of Python 3:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
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:
miniconda-version: "latest"
activate-environment: cfdm-latest
python-version: ${{ matrix.python-version }}
channels: anaconda
# Ensure shell is configured with conda activated and pip up-to-date:
- name: Check conda config
shell: bash -l {0}
run: |
conda info
conda list
conda config --show-sources
conda config --show
pip install --upgrade pip
# Install cfdm dependencies pre-testing
# We do so with conda which was setup in a previous step.
- name: Install cfdm with its dependencies
shell: bash -l {0}
run: |
# Install dependencies required for the tests:
conda install -c anaconda libnetcdf
pip install pycodestyle
# Install Python-based deps and our dev version of cfdm to test:
pip install netCDF4
pip install -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 cfdm test suite...
# 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 cfdm/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.9 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@v1
if: |

Check failure on line 106 in .github/workflows/run-test-suite.yml

View workflow run for this annotation

GitHub Actions / Run test suite

Invalid workflow file

The workflow is not valid. .github/workflows/run-test-suite.yml (Line: 106, Col: 11): Unexpected symbol: '"ubuntu-latest"'. Located at position 14 within expression: matrix.os == "ubuntu-latest" && matrix.python-version == "3.9"
matrix.os == "ubuntu-latest" && matrix.python-version == "3.9"
with:
file: ./cfdm/test/cfdm_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 cfdm test suite run has completed.