-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.yml
139 lines (122 loc) · 3.81 KB
/
main.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
version: 2.1
orbs:
python: circleci/python@1.4.0
codecov: codecov/codecov@3.2.4
executors:
# Basically extending what the python orb's executor does:
# - s/tag/version/
# - default to 3.6, not 3.8 or w/e
# - set common environment vars
default:
parameters:
version:
type: string
default: "3.6"
docker:
- image: cimg/python:<< parameters.version >>
# TODO: explicitly select 'resource_class: small' if credits ever become
# too tight; seems like small uses 5 credits/min and medium, the default,
# uses 10
environment:
TERM: screen-256color
commands:
setup:
steps:
- checkout
# This is worth using over a vanilla invocations task for 2 reasons:
# - kinda hard to use invocations if it's not installed yet...
# - the python orb is fully integrated with Circle's caching stuff
- python/install-packages:
# For now, we expect most Pythons 3.6-3.9+ to be happy with the
# same pile of dependencies, so this lets us reuse the cache
# across matrix cells.
include-python-in-cache-key: false
pre-install-steps:
# This must occur here and not as a regular step; otherwise
# cache loading stomps all over it and you get broken pip.
- run: pip install pip==21.3.1
pkg-manager: pip
pip-dependency-file: dev-requirements.txt
# "Wait around on errors" helper for circleci-cli local use
debug:
steps:
- run:
name: Debug hold...
# Sleep for a very long time on failure, if opt-in env var set.
# Necessary to keep circleci cli from nuking its containers :weary:
# TODO: some non super nested way to get actual python version in use
command: "test -z \"$DEBUG\" || (\n\n###### RUN vvvv LOCALLY LMAO\n# docker exec -it $(docker container ls --filter ancestor=cimg/python:3.6 --format \"{{.ID}}\") bash\n######\n\nsleep 18000)"
when: on_fail
no_output_timeout: 5h
# Test+coverage+codecov, for test suites that need sudo
# (allows running tests under sudo-capable user but performing final
# report+upload as default user)
sudo-coverage:
steps:
- run: inv ci.sudo-run 'inv coverage'
- run: coverage xml
- codecov/upload
jobs:
test:
parameters:
# Python interpreter version
version:
type: string
# Optional 'pip install' argstr for post-setup package tweaking,
# eg 'some-dependency==some-older-version test-dep==better-for-circle'
pip-overrides:
type: string
default: "" # evaluates falsey
# For easier running eg integration tests w/ matrix-friendly setup
task:
type: string
default: "test"
executor:
name: default
version: "<< parameters.version >>"
steps:
- setup
- when:
condition: "<< parameters.pip-overrides >>"
steps:
# NOTE: eschewing python orb install-packages here, overkill/buggy
- run: "pip install << parameters.pip-overrides >>"
- run: "inv << parameters.task >>"
- debug
# Regular tests+coverage+codecov upload
coverage:
executor: default
steps:
- setup
- run: inv coverage
- run: coverage xml
- codecov/upload
- debug
lint:
executor: default
steps:
- setup
- run: flake8
- debug
format:
executor: default
steps:
- setup
- run: inv blacken --check --diff
- debug
test-release:
executor: default
steps:
- setup
- run: inv release.all --dry-run
- debug
docs:
executor: default
parameters:
task:
type: string
default: "sites" # build www+docs
steps:
- setup
- run: "inv << parameters.task >>"
- debug