forked from pvlib/pvlib-python
-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (76 loc) · 2.88 KB
/
pytest.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
name: pytest
on:
pull_request:
push:
branches:
- main
jobs:
test:
strategy:
fail-fast: false # don't cancel other matrix jobs when one fails
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, "3.10"]
environment-type: [conda, bare]
suffix: [''] # placeholder as an alternative to "-min"
include:
- os: ubuntu-latest
python-version: 3.7
environment-type: conda
suffix: -min
exclude:
- os: macos-latest
environment-type: conda
- os: windows-latest
environment-type: bare
runs-on: ${{ matrix.os }}
steps:
# We check out only a limited depth and then pull tags to save time
- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 100
- name: Get tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Install Conda environment with Micromamba
if: matrix.environment-type == 'conda'
uses: mamba-org/provision-with-micromamba@v12
with:
environment-file: ${{ env.REQUIREMENTS }}
cache-downloads: true
extra-specs: |
python=${{ matrix.python-version }}
env:
# build requirement filename. First replacement is for the python
# version, second is to add "-min" if needed
REQUIREMENTS: ci/requirements-py${{ matrix.python-version }}${{ matrix.suffix }}.yml
- name: List installed package versions (conda)
if: matrix.environment-type == 'conda'
shell: bash -l {0} # necessary for conda env to be active
run: micromamba list
- name: Install bare Python ${{ matrix.python-version }}${{ matrix.suffix }}
if: matrix.environment-type == 'bare'
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install pvlib
if: matrix.environment-type == 'conda'
shell: bash -l {0}
run: python -m pip install --no-deps .
- name: Set up bare environment
if: matrix.environment-type == 'bare'
run: |
pip install .[test]
pip freeze
- name: Run tests
shell: bash -l {0} # necessary for conda env to be active
run: |
# ignore iotools & forecast; those tests are run in a separate workflow
pytest pvlib --cov=./ --cov-report=xml --ignore=pvlib/tests/iotools --ignore=pvlib/tests/test_forecast.py
- name: Upload coverage to Codecov
if: matrix.python-version == 3.7 && matrix.suffix == '' && matrix.os == 'ubuntu-latest' && matrix.environment-type == 'conda'
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
verbose: true
flags: core # flags are configured in codecov.yml