1
1
2
2
test-tmpl : &test-tmpl
3
3
command : |
4
+ pwd
4
5
. ../venv/bin/activate
5
6
export DEBUG=1
6
7
export SERVER_FIXTURES_HOSTNAME=127.0.0.1
@@ -11,7 +12,7 @@ job-tmpl: &job-tmpl
11
12
machine :
12
13
image : ubuntu-2004:edge
13
14
14
- working_directory : ~ /src
15
+ working_directory : /home/circleci /src
15
16
16
17
steps :
17
18
- run : env
@@ -59,51 +60,51 @@ job-tmpl: &job-tmpl
59
60
make develop
60
61
- run :
61
62
name : Run Tests - pytest-fixture-config
62
- working_directory : ~ /src/pytest-fixture-config
63
+ working_directory : /home/circleci /src/pytest-fixture-config
63
64
<< : *test-tmpl
64
65
- run :
65
66
name : Run Tests - pytest-shutil
66
- working_directory : ~ /src/pytest-shutil
67
+ working_directory : /home/circleci /src/pytest-shutil
67
68
<< : *test-tmpl
68
69
- run :
69
70
name : Run Tests - pytest-server-fixtures
70
- working_directory : ~ /src/pytest-server-fixtures
71
+ working_directory : /home/circleci /src/pytest-server-fixtures
71
72
<< : *test-tmpl
72
73
- run :
73
74
name : Run Tests - pytest-pyramid-server
74
- working_directory : ~ /src/pytest-pyramid-server
75
+ working_directory : /home/circleci /src/pytest-pyramid-server
75
76
<< : *test-tmpl
76
77
- run :
77
78
name : Run Tests - pytest-devpi-server
78
- working_directory : ~ /src/pytest-devpi-server
79
+ working_directory : /home/circleci /src/pytest-devpi-server
79
80
<< : *test-tmpl
80
81
- run :
81
82
name : Run Tests - pytest-listener
82
- working_directory : ~ /src/pytest-listener
83
+ working_directory : /home/circleci /src/pytest-listener
83
84
<< : *test-tmpl
84
85
- run :
85
86
name : Run Tests - pytest-svn
86
- working_directory : ~ /src/pytest-svn
87
+ working_directory : /home/circleci /src/pytest-svn
87
88
<< : *test-tmpl
88
89
- run :
89
90
name : Run Tests - pytest-git
90
- working_directory : ~ /src/pytest-git
91
+ working_directory : /home/circleci /src/pytest-git
91
92
<< : *test-tmpl
92
93
- run :
93
94
name : Run Tests - pytest-virtualenv
94
- working_directory : ~ /src/pytest-virtualenv
95
+ working_directory : /home/circleci /src/pytest-virtualenv
95
96
<< : *test-tmpl
96
97
- run :
97
98
name : Run Tests - pytest-webdriver
98
- working_directory : ~ /src/pytest-webdriver
99
+ working_directory : /home/circleci /src/pytest-webdriver
99
100
<< : *test-tmpl
100
101
- run :
101
102
name : Run Tests - pytest-profiling
102
- working_directory : ~ /src/pytest-profiling
103
+ working_directory : /home/circleci /src/pytest-profiling
103
104
<< : *test-tmpl
104
105
- run :
105
106
name : Run Tests - pytest-verbose-parametrize
106
- working_directory : ~ /src/pytest-verbose-parametrize
107
+ working_directory : /home/circleci /src/pytest-verbose-parametrize
107
108
<< : *test-tmpl
108
109
- run :
109
110
name : Archive Junit and Coverage
@@ -121,6 +122,31 @@ job-tmpl: &job-tmpl
121
122
- run :
122
123
name : Explode if tests have failed
123
124
command : compgen -G FAILED-* && exit 1 || true
125
+ - run :
126
+ name : Build artifacts
127
+ command : |
128
+ . venv/bin/activate
129
+ make wheels
130
+ make sdists
131
+ mkdir dist
132
+ mv */dist/* dist
133
+ - run :
134
+ name : Move artifacts to workspace
135
+ command : |
136
+ mkdir -p /tmp/to-release/dist
137
+ if [ "$PYTHON" = "python3.6" ]; then
138
+ cp -r /home/circleci/src/dist /tmp/to-release/
139
+ cp /home/circleci/src/VERSION /tmp/to-release/VERSION
140
+ cp /home/circleci/src/CHANGES.md /tmp/to-release/CHANGES.md
141
+ fi
142
+ # Save artifacts. This is silly but wildcards aren't supported.
143
+ - store_artifacts :
144
+ path : /home/circleci/src/dist/
145
+ - persist_to_workspace :
146
+ root : /tmp/to-release/
147
+ paths :
148
+ - ./*
149
+ - ./dist/*
124
150
125
151
version : 2
126
152
jobs :
@@ -134,9 +160,81 @@ jobs:
134
160
environment :
135
161
PYTHON : " python3.7"
136
162
163
+ pypi-release :
164
+ docker :
165
+ - image : cimg/python:3.11.0
166
+ steps :
167
+ - attach_workspace :
168
+ at : /tmp/to-release
169
+ - run :
170
+ name : Upload to TestPyPI
171
+ command : | # install twine and publish to Test PyPI
172
+ cd /tmp/to-release
173
+ sudo add-apt-repository universe -y
174
+ sudo apt-get update
175
+ sudo apt install -y python3-pip
176
+ sudo pip install pipenv
177
+ pipenv install twine
178
+ pipenv run twine upload --skip-existing --verbose dist/*
179
+
180
+
181
+ publish-github-release :
182
+ docker :
183
+ - image : cibuilds/github:0.13
184
+ steps :
185
+ - attach_workspace :
186
+ at : /tmp/to-release
187
+ - run :
188
+ name : Output useful stuff
189
+ command : |
190
+ cd /tmp/to-release/
191
+ VERSION_FILE="/tmp/to-release/VERSION"
192
+ if [ ! -f "$VERSION_FILE" ]; then
193
+ echo "Error: Version file not found at $VERSION_FILE"
194
+ exit 1
195
+ fi
196
+ VERSION=$(cat "$VERSION_FILE" | tr -d '[:space:]')
197
+ if [ -z "$VERSION" ]; then
198
+ echo "Error: Version file is empty"
199
+ exit 1
200
+ fi
201
+ # Find the lines of the changelog between releases, escape double quotes, delete empty lines
202
+ awk '/### '"$VERSION"'/,/^$/{print}' CHANGES.md | sed '1d;$d' > latest_changes.md
203
+ - run :
204
+ name : " Publish release on GitHub"
205
+ command : |
206
+ VERSION=$(cat /tmp/to-release/VERSION)
207
+ CHANGES=$(cat /tmp/to-release/latest_changes.md)
208
+ ghr -t ${GITHUB_TOKEN} \
209
+ -u ${CIRCLE_PROJECT_USERNAME} \
210
+ -r ${CIRCLE_PROJECT_REPONAME} \
211
+ -c ${CIRCLE_SHA1} \
212
+ -n ${VERSION} \
213
+ -b "${CHANGES}" \
214
+ -soft \
215
+ ${VERSION} /tmp/to-release/dist
216
+
217
+
137
218
workflows :
138
219
version : 2
139
220
pytest-plugins :
140
221
jobs :
141
222
- py36
142
223
- py37
224
+ - pypi-release :
225
+ requires :
226
+ - py36
227
+ - py37
228
+ filters :
229
+ branches :
230
+ only :
231
+ - master
232
+ - publish-github-release :
233
+ requires :
234
+ - py36
235
+ - py37
236
+ filters :
237
+ branches :
238
+ only :
239
+ - master
240
+
0 commit comments