-
Notifications
You must be signed in to change notification settings - Fork 168
117 lines (103 loc) · 3.68 KB
/
test_pysteps.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
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