118 lines (111 loc) · 3.78 KB
/
lightkurve-tests.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
118
# GitHub Actions workflow for Lightkurve's continuous integration.
#
# This file configures seven different jobs:
# 1) pytest on Linux, Python 2.7.
# 2) pytest on Linux, Python 3.7.
# 3) pytest on Linux, Python 3.8, with --remote-data enabled (i.e. get data from MAST).
# 4) pytest on Linux, Python 3.8, without installing optional dependencies.
# 5) pytest on Windows, Python 3.8, with --remote-data enabled.
# 6) pytest on OSX, Python 3.8.
# 7) flake8 syntax check.
name: Lightkurve-tests
on: [push, pull_request]
jobs:
# Run unit tests on Linux
pytest-linux:
runs-on: ubuntu-latest
strategy:
matrix:
name: [2.7, 3.7, 3.8-remote-data, 3.8-no-optional-dependencies]
include:
- name: 2.7
python-version: 2.7
pip-command: pip install -e .[test]
pytest-command: pytest
- name: 3.7
python-version: 3.7
pip-command: pip install -e .[all,test]
pytest-command: pytest
- name: 3.8-remote-data
python-version: 3.8
pip-command: pip install -e .[all,test]
pytest-command: pytest --remote-data --doctest-modules
- name: 3.8-no-optional-dependencies
python-version: 3.8
pip-command: pip install -e .[test]
pytest-command: pytest
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install numpy # celerite needs numpy to build, so we install it first
${{ matrix.pip-command }}
- name: Test with ${{ matrix.pytest-command }}
run: |
${{ matrix.pytest-command }}
# Run unit tests on Windows
pytest-windows:
runs-on: windows-latest
strategy:
matrix:
name: [3.7-remote-data]
python-version: [3.7]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e .[test]
- name: Test with pytest --remote-data
run: |
pytest --remote-data
# Run unit tests on Mac OSX
pytest-osx:
runs-on: macos-latest
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e .[all,test]
- name: Test with pytest
run: |
pytest
# Use the `flake8` tool to check for syntax errors
flake8-linter:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install flake8
run: |
python -m pip install --upgrade pip
pip install flake8
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude="setup.py,test_*"
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude="setup.py,test_*"