Skip to content

Commit

Permalink
CI: Update conda tests workflow
Browse files Browse the repository at this point in the history
Pulled in from MetPy.
  • Loading branch information
dopplershift committed Oct 31, 2024
1 parent eb94556 commit a1c3c2e
Showing 1 changed file with 44 additions and 49 deletions.
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: ./.github/actions/install-conda
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: ./.github/actions/run-tests
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 }}

0 comments on commit a1c3c2e

Please sign in to comment.