-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathconfig.yml
155 lines (143 loc) · 4.05 KB
/
config.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
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
version: 2.1
commands:
setup_pip:
description: "Set Up Dependencies"
parameters:
python-version:
type: string
urllib3-version:
type: string
default: "2.0"
install-dev:
description: Install dev dependencies (not just test dependencies)
type: boolean
default: false
install-docs:
description: Install docs dependencies
type: boolean
default: false
steps:
- restore_cache:
keys:
- cache_v10-wayback-<< parameters.python-version >>-{{ arch }}-{{ checksum "pyproject.toml" }}
- cache_v10-wayback-<< parameters.python-version >>-{{ arch }}-
- run:
name: Install Dependencies
command: |
python -m venv ~/venv
. ~/venv/bin/activate
# Ensure pip is up-to-date
pip install --upgrade pip
pip install .[test]
pip install 'urllib3 ~=<< parameters.urllib3-version >>'
# Dev dependencies are only compatible on Python 3.8+, so only install
# them on demand.
- when:
condition: << parameters.install-dev >>
steps:
- run:
command: |
. ~/venv/bin/activate
pip install .[dev]
# Docs dependencies are only compatible on Python 3.10+, so only install
# them on demand.
- when:
condition: << parameters.install-docs >>
steps:
- run:
command: |
. ~/venv/bin/activate
pip install .[docs]
- save_cache:
key: cache_v10-wayback-<< parameters.python-version >>-{{ arch }}-{{ checksum "pyproject.toml" }}
paths:
- ~/venv
jobs:
test:
parameters:
python-version:
type: string
urllib3-version:
type: string
working_directory: ~/wayback
docker:
- image: cimg/python:<< parameters.python-version >>
steps:
- checkout
- setup_pip:
python-version: << parameters.python-version >>
urllib3-version: << parameters.urllib3-version >>
- run:
name: Tests
command: |
. ~/venv/bin/activate
coverage run -m pytest -vv
- run:
name: Coverage
command: |
. ~/venv/bin/activate
coverage report -m
lint:
working_directory: ~/wayback
docker:
- image: cimg/python:3.12
steps:
- checkout
- setup_pip:
python-version: "3.12"
install-dev: true
- run:
name: Code linting
command: |
. ~/venv/bin/activate
flake8 .
build:
working_directory: ~/wayback
docker:
- image: cimg/python:3.12
steps:
- checkout
- setup_pip:
python-version: "3.12"
install-dev: true
- run:
name: Build Distribution
command: |
. ~/venv/bin/activate
python -m build .
- run:
name: Check Distribution
command: |
. ~/venv/bin/activate
twine check dist/*
check-wheel-contents dist
# NOTE: The docs are mainly built and published directly by readthedocs.com.
# This job is meant to verify there are no issues with the docs and it is NOT
# responsible for building what actually gets published. (Readthedocs.com
# builds with rather loose error handling, and does not fail even when there
# may be significant issues.)
docs:
working_directory: ~/wayback
docker:
- image: cimg/python:3.12
steps:
- checkout
- setup_pip:
python-version: "3.12"
install-docs: true
- run:
name: Build docs
command: |
. ~/venv/bin/activate
make -C docs html
workflows:
ci:
jobs:
- test:
matrix:
parameters:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
urllib3-version: ["1.20", "2.0"]
- lint
- build
- docs