-
Notifications
You must be signed in to change notification settings - Fork 5
157 lines (146 loc) · 4.79 KB
/
ci.yaml
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
name: CI
on:
pull_request:
push:
branches: [main]
tags: ['v*']
jobs:
mypy:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
python-version: "3.9"
venv-id: "docs"
poetry-dependency-install-flags: "--all-extras --only 'main,dev'"
# There are still a lot of mypy errors to resolve
- name: mypy
continue-on-error: true
run: MYPYPATH=stubs poetry run mypy src
docs:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
python-version: "3.9"
venv-id: "docs"
poetry-dependency-install-flags: "--all-extras --only 'main,docs,notebooks'"
- name: docs
# TODO: Enable -W option once the sphinx warnings are cleared up
run: poetry run sphinx-build --keep-going -T -b html docs/source docs/build
tests:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.9", "3.10", "3.11" ]
runs-on: "${{ matrix.os }}"
steps:
- name: Check out repository
uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
python-version: "${{ matrix.python-version }}"
venv-id: "tests-${{ runner.os }}"
poetry-dependency-install-flags: "--all-extras"
- name: Run tests
run: |
poetry run pytest -r a -v src tests --doctest-modules --cov=src --cov-report=term-missing --cov-report=xml
poetry run coverage report
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
test-xarray-versions:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.9" ]
xarray-version: [ "0.16.2", "0.17.0", "0.18.2" ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
python-version: "${{ matrix.python-version }}"
venv-id: "tests-${{ runner.os }}"
poetry-dependency-install-flags: "--all-extras"
- name: Install test dependencies
run: |
pip install xarray==${{ matrix.xarray-version }}
- name: Test with pytest
run: |
poetry run pytest -r a -v src tests
test-no-plotting:
# This test makes sure that everything works even if the plotting
# dependencies aren't installed.
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
python-version: "${{ matrix.python-version }}"
venv-id: "tests-${{ runner.os }}"
poetry-dependency-install-flags: "--extras optional --with tests"
- name: Test with pytest
run: |
poetry run pytest -r a -v src tests
imports-without-extras:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.9", "3.10", "3.11" ]
runs-on: "${{ matrix.os }}"
steps:
- name: Check out repository
uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
python-version: "${{ matrix.python-version }}"
venv-id: "imports-without-extras-${{ runner.os }}"
poetry-dependency-install-flags: "--only main"
- name: Check importable without extras
run: poetry run python scripts/test-install.py
check-build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
python-version: "3.9"
venv-id: "check-build-${{ runner.os }}"
run-poetry-install: false
poetry-dependency-install-flags: "not used"
- name: Build package
run: |
poetry build --no-interaction
- name: Check build
run: |
tar -tvf dist/scmdata-*.tar.gz --wildcards '*scmdata/py.typed'
check-dependency-licences:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
python-version: "3.9"
venv-id: "licence-check"
poetry-dependency-install-flags: "--all-extras"
- name: Check licences of dependencies
shell: bash
run: |
TEMP_FILE=$(mktemp)
poetry export --without=tests --without=docs --without=dev > $TEMP_FILE
poetry run liccheck -r $TEMP_FILE -R licence-check.txt
cat licence-check.txt