Skip to content

Commit

Permalink
Merge pull request #804 from dopplershift/update-test-ci
Browse files Browse the repository at this point in the history
Update CI testing
  • Loading branch information
dcamron authored Nov 1, 2024
2 parents be4124f + 1e9516e commit dc292fb
Show file tree
Hide file tree
Showing 13 changed files with 289 additions and 2,722 deletions.
16 changes: 4 additions & 12 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
codecov:
notify:
require_ci_to_pass: no

coverage:
status:
patch:
default:
target: '80'
if_no_uploads: error
if_not_found: success
if_ci_failed: failure
project:
default: false
library:
target: auto
if_no_uploads: error
if_not_found: success
if_ci_failed: failure
paths:
- "siphon/(\w+/)?[^/]+\.py$"
- "src/siphon/.*"

tests:
target: 100%
Expand All @@ -31,4 +20,7 @@ coverage:
default:
url: "https://webhooks.gitter.im/e/0eb95be6d20af5b9a4f0"

ignore:
- "**/*_pb2.py"

comment: off
93 changes: 44 additions & 49 deletions .github/workflows/tests-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ name: Conda Tests
# We don't want pushes (or PRs) to gh-pages to kick anything off
on:
push:
branches: [ main ]
branches:
- main
- '[0-9]+.[0-9]+.x'
pull_request:
branches: [ main ]
branches:
- main
- '[0-9]+.[0-9]+.x'

concurrency:
group: ${{ github.workflow}}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
#
Expand All @@ -20,62 +28,49 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ['3.10', 3.12]
os: [macOS, Windows]
include:
- python-version: 3.11
os: Windows

steps:
# We check out only a limited depth and then pull tags to save time
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 100

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
fetch-depth: 150
fetch-tags: true

- name: Setup conda caching
uses: actions/cache@v3
- name: Install from Conda
uses: Unidata/MetPy/.github/actions/install-conda@main
with:
path: ~/conda_pkgs_dir
key: conda-tests-${{ runner.os }}-${{ matrix.python-version}}-${{ hashFiles('ci/*') }}
restore-keys: |
conda-tests-${{ runner.os }}-${{ matrix.python-version}}
conda-tests-${{ runner.os }}
conda-tests-
- name: Set up Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
type: 'test'
python-version: ${{ matrix.python-version }}
channel-priority: strict
channels: conda-forge
show-channel-urls: true
# Needed for caching
use-only-tar-bz2: true

- name: Install dependencies
run: conda install --quiet --yes --file ci/test_requirements.txt --file ci/extra_requirements.txt --file ci/requirements.txt
- name: Run tests
uses: Unidata/MetPy/.github/actions/run-tests@main
with:
run-doctests: 'false'
key: conda-${{ matrix.python-version }}-${{ runner.os }}
pytest-args: ''

- name: Install
# For some reason on Windows 3.7 building the wheel fails to properly include our extra
# stuff. Executing the egg_info beforehand for some reason fixes it. No idea why. We're
# deep in territory where googling for answers helps not at all.
run: |
python setup.py egg_info
python -m pip install --no-deps .
codecov:
name: CodeCov Upload
needs: CondaTests
runs-on: ubuntu-latest
environment:
name: CodeCov
timeout-minutes: 2
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Run tests
# By running coverage in "parallel" mode and "combining", we can clean up the path names
run: |
export TEST_DATA_DIR=$GITHUB_WORKSPACE/staticdata
python -m coverage run -p -m pytest tests
python -m coverage combine
python -m coverage report
python -m coverage xml
- name: Download coverage artifacts
uses: actions/download-artifact@v4

- name: Upload coverage
if: ${{ always() }}
uses: codecov/codecov-action@v3
with:
name: conda-${{ matrix.python-version }}-${{ runner.os }}
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
name: ${{ github.workflow }}
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
124 changes: 71 additions & 53 deletions .github/workflows/tests-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,84 +3,102 @@ name: PyPI Tests
# We don't want pushes (or PRs) to gh-pages to kick anything off
on:
push:
branches: [ main ]
branches:
- main
- '[0-9]+.[0-9]+.x'
pull_request:
branches: [ main ]
branches:
- main
- '[0-9]+.[0-9]+.x'

concurrency:
group: ${{ github.workflow}}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
#
# Run all tests on Linux using standard PyPI packages, including min and pre-releases
# Run all tests on Linux using standard PyPI packages, including minimum requirements
#
PyPITests:
name: ${{ matrix.python-version }} ${{ matrix.dep-versions }} ${{ matrix.no-extras }}
runs-on: ubuntu-20.04
continue-on-error: ${{ matrix.dep-versions == 'Prerelease' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
dep-versions: [requirements.txt]
python-version: ['3.10', 3.11, 3.12]
dep-versions: [Latest]
no-extras: ['']
include:
- python-version: 3.7
- python-version: '3.10'
dep-versions: Minimum
- python-version: '3.10'
dep-versions: Minimum
no-extras: 'No Extras'
- python-version: 3.9
dep-versions: requirements.txt
- python-version: 3.12
dep-versions: Latest
no-extras: 'No Extras'

steps:
# We check out only a limited depth and then pull tags to save time
- name: Checkout source
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 100
fetch-depth: 150
fetch-tags: true

- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Generate minimum dependencies
if: ${{ matrix.dep-versions == 'Minimum' }}
run: |
pip install tomli
python << EOF
import tomli as tomllib
from pathlib import Path
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Read our pyproject.toml
config = tomllib.load(open('pyproject.toml', 'rb'))['project']
opt_deps = config['optional-dependencies']
# This uses pip to find the right cache dir and then sets up caching for it
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
# Generate a Minimum dependency file
for src, fname in [(config['dependencies'], 'requirements.txt'),
(opt_deps['test'], 'test_requirements.txt'), (opt_deps['extras'], 'extra_requirements.txt')]:
with (Path('ci') / fname).open('wt') as out:
for dep in src:
dep = dep.split(';')[0]
if 'siphon' not in dep:
out.write(dep.replace('>=', '==') + '\n')
EOF
- name: Setup caching
uses: actions/cache@v3
- name: Install from PyPI
uses: Unidata/MetPy/.github/actions/install-pypi@main
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-tests-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('ci/*') }}
restore-keys: |
pip-tests-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('ci/*') }}
pip-tests-${{ runner.os }}-${{ matrix.python-version }}-
pip-tests-${{ runner.os }}-
pip-tests-
- name: Add extras to requirements
if: ${{ matrix.no-extras != 'No Extras' }}
run: cat ci/extra_requirements.txt >> ci/test_requirements.txt
need-extras: ${{ matrix.no-extras != 'No Extras' }}
type: 'test'
python-version: ${{ matrix.python-version }}
need-cartopy: 'false'

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -r ci/test_requirements.txt -c ci/${{ matrix.dep-versions }}
- name: Run tests
uses: Unidata/MetPy/.github/actions/run-tests@main
with:
run-doctests: 'false'
key: pypi-${{ matrix.python-version }}-${{ matrix.dep-versions }}-${{ matrix.no-extras }}-${{ runner.os }}
pytest-args: ''

- name: Install
run: python -m pip install -c ci/${{ matrix.dep-versions }} .
codecov:
needs: PyPITests
name: CodeCov Upload
runs-on: ubuntu-latest
environment:
name: CodeCov
timeout-minutes: 2
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Run tests
run: |
python -m coverage run -p -m pytest tests
python -m coverage combine
python -m coverage report
python -m coverage xml
- name: Download coverage artifacts
uses: actions/download-artifact@v4

- name: Upload coverage
if: ${{ always() }}
uses: codecov/codecov-action@v3
with:
name: pypi-${{ matrix.python-version }}-${{ matrix.dep-versions }}-${{ matrix.no-extras }}-${{ runner.os }}
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
name: ${{ github.workflow }}
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
5 changes: 0 additions & 5 deletions ci/Minimum

This file was deleted.

2 changes: 1 addition & 1 deletion ci/doc_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ sphinx==5.2.3
sphinx_rtd_theme==1.0.0
sphinx-gallery==0.11.1
myst-parser==0.18.1
netCDF4==1.6.1
netCDF4==1.6.5
2 changes: 1 addition & 1 deletion ci/extra_requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
xarray==0.20.2
xarray==2023.8.0
9 changes: 4 additions & 5 deletions ci/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
beautifulsoup4>=4.6
numpy==1.21.5
pandas==1.3.5
protobuf==3.20.1
beautifulsoup4==4.9.1
numpy==1.26.0
pandas==2.1.2
protobuf==4.24.3
requests==2.28.1
importlib_metadata<5.0
8 changes: 4 additions & 4 deletions ci/test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pytest==7.1.3
netCDF4==1.6.1
coverage==6.4.4
vcrpy==4.2.1
pytest==7.2.0
netCDF4==1.6.5
coverage==7.3.1
vcrpy==5.1.0
Loading

0 comments on commit dc292fb

Please sign in to comment.