Skip to content

Refactoring steps-nowcast #945

Refactoring steps-nowcast

Refactoring steps-nowcast #945

Workflow file for this run

name: Test pysteps
on:
# Triggers the workflow on push or pull request events to the master branch
push:
branches:
- master
- pysteps-v2
pull_request:
branches:
- master
- pysteps-v2
jobs:
unit_tests:
name: Unit Tests (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
python-version: ["3.10", "3.12"]
max-parallel: 6
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# need headless opencv on Linux, see https://github.com/conda-forge/opencv-feedstock/issues/401
- name: Install mamba and create environment for Linux
if: matrix.os == 'ubuntu-latest'
uses: mamba-org/setup-micromamba@v1
with:
# https://github.com/mamba-org/setup-micromamba/issues/225
micromamba-version: 1.5.10-0
environment-file: ci/ci_test_env.yml
environment-name: test_environment
generate-run-shell: false
create-args: >-
python=${{ matrix.python-version }}
libopencv=*=headless*
- name: Install mamba and create environment (not Linux)
if: matrix.os != 'ubuntu-latest'
uses: mamba-org/setup-micromamba@v1
with:
# https://github.com/mamba-org/setup-micromamba/issues/225
micromamba-version: 1.5.10-0
environment-file: ci/ci_test_env.yml
environment-name: test_environment
generate-run-shell: false
create-args: python=${{ matrix.python-version }}
- name: Install pygrib (not win)
if: matrix.os != 'windows-latest'
run: mamba install --quiet pygrib
- name: Install pysteps for MacOS
if: matrix.os == 'macos-latest'
working-directory: ${{github.workspace}}
env:
CC: gcc-13
CXX: g++-13
CXX1X: g++-13
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew update-reset
brew update
gcc-13 --version || brew install gcc@13
pip install .
- name: Install pysteps
if: matrix.os != 'macos-latest'
working-directory: ${{github.workspace}}
run: pip install .
- name: Download pysteps data
env:
PYSTEPS_DATA_PATH: ${{github.workspace}}/pysteps_data
working-directory: ${{github.workspace}}/ci
run: python fetch_pysteps_data.py
- name: Check imports
working-directory: ${{github.workspace}}/pysteps_data
run: |
python --version
python -c "import pysteps; print(pysteps.__file__)"
python -c "from pysteps import motion"
python -c "from pysteps.motion import vet"
python -c "from pysteps.motion import proesmans"
- name: Run tests and coverage report
working-directory: ${{github.workspace}}/pysteps_data
env:
PYSTEPSRC: ${{github.workspace}}/pysteps_data/pystepsrc
run: pytest --pyargs pysteps --cov=pysteps --cov-report=xml --cov-report=term -ra
- name: Upload coverage to Codecov (Linux only)
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{github.workspace}}/pysteps_data/coverage.xml
flags: unit_tests
env_vars: OS,PYTHON
fail_ci_if_error: true
verbose: true