Skip to content

Commit ac29277

Browse files
committed
move --remote-data tests to other workflow
1 parent e40f721 commit ac29277

File tree

2 files changed

+68
-3
lines changed

2 files changed

+68
-3
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: pytest-remote-data
2+
3+
on:
4+
pull_request_target:
5+
types: [labeled]
6+
7+
jobs:
8+
test:
9+
env:
10+
# we need to turn "3.6" into 36 to build the conda requirement filename,
11+
# but there's no good way to do that via string manipulation. So set up
12+
# a map that will be parsed as JSON later:
13+
VERSIONMAP: '{"3.6": "36", "3.7": "37", "3.8": "38", "3.9": "39"}'
14+
15+
strategy:
16+
fail-fast: false # don't cancel other matrix jobs when one fails
17+
matrix:
18+
python-version: [3.6, 3.7, 3.8, 3.9]
19+
suffix: [''] # placeholder as an alternative to "-min"
20+
include:
21+
- python-version: 3.6
22+
suffix: -min
23+
24+
runs-on: ubuntu-latest
25+
if: contains(github.event.pull_request.labels.*.name, 'remote-data')
26+
27+
steps:
28+
- uses: actions/checkout@v2
29+
# pull_request_target runs in the context of the target branch (pvlib/master), not the
30+
# PR head, so specify the PR head explicitly:
31+
with:
32+
ref: ${{ github.event.pull_request.head.sha }}
33+
34+
- name: Set up Python ${{ matrix.python-version }}${{ matrix.suffix }}
35+
uses: actions/setup-python@v1
36+
with:
37+
python-version: ${{ matrix.python-version }}
38+
39+
- name: Set up conda environment
40+
uses: conda-incubator/setup-miniconda@v2
41+
with:
42+
activate-environment: test_env
43+
environment-file: ${{ env.REQUIREMENTS }}
44+
python-version: ${{ matrix.python-version }}
45+
auto-activate-base: false
46+
env:
47+
# build requirement filename. First replacement is for the python
48+
# version, mapping from "3.7" to "37", second is to add "-min" if needed
49+
REQUIREMENTS: ci/requirements-py${{ fromJSON(env.VERSIONMAP)[matrix.python-version] }}${{ matrix.suffix }}.yml
50+
51+
- name: Run tests
52+
shell: bash -l {0} # necessary for conda env to be active
53+
env:
54+
# copy GitHub Secrets into environment variables for the tests to access
55+
NREL_API_KEY: ${{ secrets.NRELAPIKEY }}
56+
BSRN_FTP_USERNAME: ${{ secrets.BSRN_FTP_USERNAME }}
57+
BSRN_FTP_PASSWORD: ${{ secrets.BSRN_FTP_PASSWORD }}
58+
run: pytest pvlib --cov=./ --cov-report=xml --remote-data
59+
60+
# - name: Upload coverage to Codecov
61+
# if: matrix.os == 'ubuntu-latest' && matrix.environment-type == 'conda'
62+
# uses: codecov/codecov-action@v2
63+
# with:
64+
# directory: ./coverage/reports/
65+
# fail_ci_if_error: true
66+
# verbose: true

.github/workflows/pytest.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,11 @@ jobs:
6262
- name: Run tests
6363
shell: bash -l {0} # necessary for conda env to be active
6464
env:
65-
# we want --remote-data only on conda+linux, so use this short-circuiting logic:
66-
ARGS: "${{ (matrix.os == 'ubuntu-latest' && matrix.environment-type == 'conda') && '--remote-data' || '' }}"
65+
# copy GitHub Secrets into environment variables for the tests to access
6766
NREL_API_KEY: ${{ secrets.NRELAPIKEY }}
6867
BSRN_FTP_USERNAME: ${{ secrets.BSRN_FTP_USERNAME }}
6968
BSRN_FTP_PASSWORD: ${{ secrets.BSRN_FTP_PASSWORD }}
70-
run: pytest pvlib --cov=./ --cov-report=xml $ARGS
69+
run: pytest pvlib --cov=./ --cov-report=xml
7170

7271
# - name: Upload coverage to Codecov
7372
# if: matrix.os == 'ubuntu-latest' && matrix.environment-type == 'conda'

0 commit comments

Comments
 (0)