-
Notifications
You must be signed in to change notification settings - Fork 130
183 lines (155 loc) · 5.36 KB
/
Copy pathcontinuous-integration.yml
File metadata and controls
183 lines (155 loc) · 5.36 KB
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: CI
on:
push:
branches:
- main
- "0.3"
- "0.4"
- "0.5"
- "1.0"
pull_request:
jobs:
test:
name: test
runs-on: ${{ matrix.os }}
continue-on-error: ${{ startsWith(matrix.python-version, '3.10')}}
strategy:
# Allow other matrix jobs to complete if 1 fails
fail-fast: false
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10.0-beta.3"
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions-rs/toolchain@v1
# No wheels exist for orjson on Python 3.10 on MacOS or Windows, and the Linux
# wheels are sometimes not uploaded until after the package is initially
# published. This sets up the Rust nightly toolchain so we can build the orjson
# wheel.
if: ${{ startsWith(matrix.python-version, '3.10')}}
with:
toolchain: nightly-2021-04-27
override: true
default: true
profile: minimal
- name: Cache dependencies (Linux)
if: startsWith(runner.os, 'Linux')
uses: actions/cache@v2
with:
path: ~/.cache/pip
# Cache based on OS, Python version, and dependency hash
key: pip-test-${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('requirements-test.txt') }}
- name: Cache dependencies (macOS)
if: startsWith(runner.os, 'macOS')
uses: actions/cache@v2
with:
path: ~/Library/Caches/pip
# Cache based on OS, Python version, and dependency hash
key: pip-test-${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('requirements-test.txt') }}
- name: Cache dependencies (Windows)
if: startsWith(runner.os, 'Windows')
uses: actions/cache@v2
with:
path: ~\AppData\Local\pip\Cache
# Cache based on OS, Python version, and dependency hash
key: pip-test-${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('requirements-test.txt') }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements-test.txt
pip install -e ".[validation]"
- name: Execute test suite
run: ./scripts/test
shell: bash
env:
TMPDIR: "${{ matrix.os == 'windows-latest' && 'D:\\a\\_temp' || '' }}"
coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
# Cache based on OS, Python version, and dependency hash
key: pip-test-${{ runner.os }}-python3.8-${{ hashFiles('requirements-test.txt') }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements-test.txt
pip install -e ".[validation]"
- name: Execute test suite
run: ./scripts/test
env:
CHECK_COVERAGE: true
- name: Prepare ./coverage.xml
# Ignore the configured fail-under to ensure we upload the coverage report. We
# will trigger a failure for coverage drops in a later job
run: coverage xml --fail-under 0
- name: Upload All coverage to Codecov
uses: codecov/codecov-action@v2.0.3
if: ${{ env.GITHUB_REPOSITORY }} == 'stac-utils/pystac'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: false
- name: Check for coverage drop
# This will use the configured fail-under, causing this job to fail if the
# coverage drops.
run: coverage report
lint:
runs-on: ubuntu-latest
strategy:
# Allow other matrix jobs to complete if 1 fails
fail-fast: false
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10.0-beta.3"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.cache/pip
# Cache based on OS, Python version, and dependency hash
key: lint-${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('requirements-test.txt') }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements-test.txt
- name: Execute linters & type checkers
run: pre-commit run --all-files
vanilla:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install without orjson
run: pip install '.[validation]'
- name: Run unittests
run: python -m unittest discover tests