Skip to content

Commit dd24cab

Browse files
committed
add pytest workflow
1 parent 5cb695d commit dd24cab

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/pytest.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: pytest
2+
3+
on: [pull_request, push]
4+
5+
jobs:
6+
test:
7+
env:
8+
VERSIONMAP: '{"3.6": "36", "3.7": "37", "3.8": "38", "3.9": "39"}'
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest, macos-latest, windows-latest]
12+
python-version: [3.6, 3.7, 3.8, 3.9]
13+
environment-type: [conda, bare]
14+
suffix: ['']
15+
include:
16+
- os: ubuntu-latest
17+
python-version: 3.6
18+
environment-type: conda
19+
suffix: -min
20+
exclude:
21+
- os: macos-latest
22+
environment-type: conda
23+
- os: windows-latest
24+
environment-type: bare
25+
26+
runs-on: ${{ matrix.os }}
27+
28+
steps:
29+
- uses: actions/checkout@v2
30+
31+
- name: Set up Python ${{ matrix.python-version }}${{ matrix.suffix }}
32+
uses: actions/setup-python@v1
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
36+
- name: Set up conda environment
37+
if: matrix.environment-type == 'conda'
38+
uses: conda-incubator/setup-miniconda@v2
39+
with:
40+
activate-environment: test_env
41+
environment-file: ${{ env.REQUIREMENTS }}
42+
python-version: ${{ matrix.python-version }}
43+
auto-activate-base: false
44+
env:
45+
REQUIREMENTS: ci/requirements-py${{ fromJSON(env.VERSIONMAP)[matrix.python-version] }}${{ matrix.suffix }}.yml
46+
47+
- name: Create bare environment
48+
if: matrix.environment-type == 'bare'
49+
env:
50+
REQUIREMENTS: pip install pytest pytest-cov pytest-mock requests-mock pytest-timeout pytest-rerunfailures pytest-remotedata
51+
run: |
52+
pip install $REQUIREMENTS
53+
pip install .
54+
55+
- name: Run tests
56+
shell: bash -l {0} # necessary for conda env to be active
57+
env:
58+
ARGS: "${{ (matrix.os == 'ubuntu-latest' && matrix.environment-type == 'conda') && '--remote-data' || '' }}"
59+
NREL_API_KEY: ${{ secrets.NREL_API_KEY }}
60+
BSRN_FTP_USERNAME: ${{ secrets.BSRN_FTP_USERNAME }}
61+
BSRN_FTP_PASSWORD: ${{ secrets.BSRN_FTP_PASSWORD }}
62+
run: pytest pvlib --cov=./ --cov-report=xml $ARGS
63+
64+
# - name: Upload coverage to Codecov
65+
# if: matrix.os == 'ubuntu-latest' && matrix.environment-type == 'conda'
66+
# uses: codecov/codecov-action@v2
67+
# with:
68+
# directory: ./coverage/reports/
69+
# fail_ci_if_error: true
70+
# verbose: true

0 commit comments

Comments
 (0)