-
Notifications
You must be signed in to change notification settings - Fork 5
136 lines (129 loc) · 4.28 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
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@v4
- uses: ./.github/actions/setup
with:
python-version: "3.11"
pdm-dependency-install-flags: "-G :all"
- name: mypy
run: |
MYPYPATH=stubs pdm run mypy src
docs:
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
python-version: "3.11"
pdm-dependency-install-flags: "-G docs -G :all"
- name: docs
run: |
pdm run mkdocs build --strict
- uses: ./.github/actions/setup
with:
python-version: "3.11"
pdm-dependency-install-flags: "-G docs -G :all -G dev"
- name: docs-with-changelog
run: |
# Check CHANGELOG will build too
pdm run towncrier build --yes
pdm run mkdocs build --strict
# Just in case, undo the staged changes
git restore --staged . && git restore .
tests:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.9", "3.10", "3.11" ]
runs-on: "${{ matrix.os }}"
defaults:
run:
# This might be needed for Windows
# and doesn't seem to affect unix-based systems so we include it.
# If you have better proof of whether this is needed or not,
# feel free to update.
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
# When running the tests, install with all optional dependencies
# to get maximum test coverage.
# If we find that we're getting failures
# when people try to run without installing optional dependencies,
# we should add a CI step that runs the tests without optional dependencies too.
# We don't have that right now, because we're not sure this pain point exists.
pdm-dependency-install-flags: "-G :all -G tests"
- name: Run tests
run: |
pdm run pytest -r a -v src tests --doctest-modules --cov=src --cov-report=term-missing --cov-report=xml
pdm run coverage report
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/[email protected]
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
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@v4
- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
pdm-dependency-install-flags: "--prod --without :all"
- name: Check importable without extras
run: pdm run python scripts/test-install.py
check-build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Setup PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.9"
pdm-dependency-install-flags: "not-used"
run-pdm-install: false
- name: Build package
run: |
pdm build
- name: Check build
run: |
tar -tvf dist/openscm_units-*.tar.gz --wildcards '*openscm_units/py.typed'
tar -tvf dist/openscm_units-*.tar.gz --wildcards 'openscm_units-*/LICENCE'
check-dependency-licences:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
python-version: "3.9"
pdm-dependency-install-flags: "-G dev"
- name: Check licences of dependencies
shell: bash
run: |
TEMP_FILE=$(mktemp)
pdm export --prod > $TEMP_FILE
pdm run liccheck -r $TEMP_FILE -R licence-check.txt
cat licence-check.txt