Skip to content

Commit 3b41dc2

Browse files
authored
Add a CircleCI Windows build (#246)
* Add a Windows build to CircleCI with py3.6-py3.12 and remove references to TravisCI. * Not adding windows-python-3.13 since it is not available on choco as a non-rc build. * Fix win32 bugs in pytest-virtualenv. * Release jobs now depend on both Ubuntu and Windows success.
1 parent 327987a commit 3b41dc2

File tree

7 files changed

+127
-167
lines changed

7 files changed

+127
-167
lines changed

.circleci/config.yml

Lines changed: 76 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
orbs:
2+
win: circleci/[email protected]
3+
4+
windows-tmpl: &windows-tmpl
5+
parameters:
6+
python-version:
7+
type: string
8+
executor:
9+
name: win/default
10+
shell: bash.exe
11+
steps:
12+
- checkout
13+
- run:
14+
name: Set up Python
15+
command: |
16+
set -e
17+
. install.sh
18+
install_windows_make
19+
install_windows_python << parameters.python_version >>
20+
init_venv python
21+
- run:
22+
name: Install dependencies
23+
command: |
24+
python --version
25+
make develop
26+
- run:
27+
name: Run tests
28+
command: |
29+
export DEBUG=1
30+
export SERVER_FIXTURES_JENKINS_WAR=
31+
export PACKAGES=$(./foreach.sh --quiet 'grep -q Windows setup.py && echo $PKG || true')
32+
make test-ci
33+
- store_test_results:
34+
path: junit
35+
- run:
36+
name: Check for failures
37+
command: make list-test-failures
138

239
test-tmpl: &test-tmpl
340
command: |
@@ -152,47 +189,22 @@ job-tmpl: &job-tmpl
152189
- ./*
153190
- ./dist/*
154191

155-
version: 2
192+
version: 2.1
156193
jobs:
157-
py36:
194+
python-ubuntu:
158195
<<: *job-tmpl
196+
parameters:
197+
python_version:
198+
type: string
159199
environment:
160-
PYTHON: "python3.6"
161-
162-
py37:
163-
<<: *job-tmpl
164-
environment:
165-
PYTHON: "python3.7"
166-
167-
py38:
168-
<<: *job-tmpl
169-
environment:
170-
PYTHON: "python3.8"
171-
172-
py39:
173-
<<: *job-tmpl
174-
environment:
175-
PYTHON: "python3.9"
176-
177-
py310:
178-
<<: *job-tmpl
179-
environment:
180-
PYTHON: "python3.10"
181-
182-
py311:
183-
<<: *job-tmpl
184-
environment:
185-
PYTHON: "python3.11"
186-
187-
py312:
188-
<<: *job-tmpl
189-
environment:
190-
PYTHON: "python3.12"
191-
192-
py313:
193-
<<: *job-tmpl
200+
PYTHON: << parameters.python_version >>
201+
python-windows:
202+
<<: *windows-tmpl
203+
parameters:
204+
python_version:
205+
type: string
194206
environment:
195-
PYTHON: "python3.13"
207+
PYTHON: << parameters.python_version >>
196208

197209
pypi-release:
198210
docker:
@@ -253,38 +265,41 @@ workflows:
253265
version: 2
254266
pytest-plugins:
255267
jobs:
256-
- py36
257-
- py37
258-
- py38
259-
- py39
260-
- py310
261-
- py311
262-
- py312
263-
- py313
268+
- python-windows:
269+
matrix:
270+
parameters:
271+
python_version:
272+
- "python3.6"
273+
- "python3.7"
274+
- "python3.8"
275+
- "python3.9"
276+
- "python3.10"
277+
- "python3.11"
278+
- "python3.12"
279+
- python-ubuntu:
280+
matrix:
281+
parameters:
282+
python_version:
283+
- "python3.6"
284+
- "python3.7"
285+
- "python3.8"
286+
- "python3.9"
287+
- "python3.10"
288+
- "python3.11"
289+
- "python3.12"
290+
- "python3.13"
264291
- pypi-release:
265292
requires:
266-
- py36
267-
- py37
268-
- py38
269-
- py39
270-
- py310
271-
- py311
272-
- py312
273-
- py313
293+
- python-ubuntu
294+
- python-windows
274295
filters:
275296
branches:
276297
only:
277298
- master
278299
- publish-github-release:
279300
requires:
280-
- py36
281-
- py37
282-
- py38
283-
- py39
284-
- py310
285-
- py311
286-
- py312
287-
- py313
301+
- python-ubuntu
302+
- python-windows
288303
filters:
289304
branches:
290305
only:

.travis.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

CHANGES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Changelog
2-
### 1.8.0 (2024-10-??)
2+
### 1.8.1 (2024-10-??)
3+
* All: Windows builds added to CircleCI
4+
* All: Started building py3.6-py3.13 in CircleCI
5+
6+
### 1.8.0 (2024-10-17)
37
* All: Drop support for Python 2 and <3.6, removing compatibility code.
48
* All: Use stdlib unittest.mock instead of mock package.
59
* All: Removed usage of path.py and path in favour of pathlib. #174 #224

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,18 @@ test:
5454

5555
test-ci:
5656
rm -f FAILED-*
57-
./foreach.sh 'cat *.egg-info/top_level.txt | xargs -Ipysrc coverage run -p --source=pysrc setup.py test -sv -ra --timeout 120 || touch ../FAILED-$$PKG'
57+
mkdir junit
58+
./foreach.sh 'cat *.egg-info/top_level.txt | xargs -Ipysrc coverage run -p --source=pysrc -m pytest --junitxml junit.xml -svvvv -ra || touch ../FAILED-$$PKG'
59+
./foreach.sh 'cp junit.xml ../junit/junit-$PKG.xml || true'
60+
61+
list-test-failures:
62+
@if compgen -G 'FAILED-*' > /dev/null; then \
63+
echo "Error: Found failure artifacts:"; \
64+
compgen -G 'FAILED-*'; \
65+
exit 1; \
66+
else \
67+
echo "No failure artifacts found."; \
68+
fi
5869

5970
upload:
6071
pip install twine

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# A goody-bag of nifty plugins for [pytest](https://pytest.org)
22

3-
OS | Build | Coverage |
4-
------ | ----- | -------- |
5-
![Linux](img/linux.png) | [![CircleCI (Linux)](https://circleci.com/gh/man-group/pytest-plugins/tree/master.svg?style=svg)](https://circleci.com/gh/man-group/pytest-plugins/tree/master) | [![Coverage Status](https://coveralls.io/repos/github/manahl/pytest-plugins/badge.svg?branch=master)](https://coveralls.io/github/manahl/pytest-plugins?branch=master)
6-
![Windows](img/windows.png) | [![Travic CI (Windows)](https://travis-ci.org/man-group/pytest-plugins.svg?branch=master)](https://travis-ci.org/man-group/pytest-plugins) |
3+
OS | Build | Coverage |
4+
------ |------------------------------------------------------------------------------------------------------------------------------------------------------------------| -------- |
5+
![Linux](img/linux.png) | [![CircleCI (Linux)](https://circleci.com/gh/man-group/pytest-plugins/tree/master.svg?style=svg)](https://circleci.com/gh/man-group/pytest-plugins/tree/master) | [![Coverage Status](https://coveralls.io/repos/github/manahl/pytest-plugins/badge.svg?branch=master)](https://coveralls.io/github/manahl/pytest-plugins?branch=master)
6+
![Windows](img/windows.png) | [![CircleCI (Linux)](https://circleci.com/gh/man-group/pytest-plugins/tree/master.svg?style=svg)](https://circleci.com/gh/man-group/pytest-plugins/tree/master) |
77

88
Plugin | Description | Supported OS |
99
------ | ----------- | ------------ |

install.sh

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ function install_python {
5555

5656
function choco_install {
5757
local args=$*
58-
# choco fails randomly with network errors on travis, have a few goes
5958
for i in {1..5}; do
6059
choco install $args && return 0
6160
echo 'choco install failed, log tail follows:'
@@ -71,35 +70,26 @@ function install_windows_make {
7170
choco_install make --params "/InstallDir:C:\\tools\\make"
7271
}
7372

74-
75-
function install_windows_py27 {
76-
choco_install python2 --params "/InstallDir:C:\\Python"
77-
export PATH="/c/Python:/c/Python/Scripts:$PATH"
78-
install_python_packaging python
79-
}
80-
81-
82-
function install_windows_py35 {
83-
choco_install python --version 3.5.4 --params "/InstallDir:C:\\Python"
84-
export PATH="/c/Python35:/c/Python35/Scripts:$PATH"
85-
install_python_packaging python
73+
function install_windows_python() {
74+
if [ -z "$1" ]; then
75+
echo "Please provide a Python version argument, e.g., 'python3.11'"
76+
return 1
77+
fi
78+
python_arg="$1"
79+
python_version="${python_arg#python}"
80+
major_version="${python_version%%.*}"
81+
minor_version="${python_version#*.}"
82+
choco_package="python${major_version}${minor_version}"
83+
install_dir="/c/Python${major_version}${minor_version}"
84+
choco_install "$choco_package" --params "/InstallDir:C:\\Python" -y
85+
if [ $? -ne 0 ]; then
86+
echo "Failed to install Python $python_version"
87+
return 1
88+
fi
89+
export PATH="$install_dir:$install_dir/Scripts:$PATH"
90+
install_python_packaging python
8691
}
8792

88-
89-
function install_windows_py36 {
90-
choco_install python --version 3.6.8 --params "/InstallDir:C:\\Python"
91-
export PATH="/c/Python36:/c/Python36/Scripts:$PATH"
92-
install_python_packaging python
93-
}
94-
95-
96-
function install_windows_py37 {
97-
choco_install python --version 3.7.5 --params "/InstallDir:C:\\Python"
98-
export PATH="/c/Python37:/c/Python37/Scripts:$PATH"
99-
install_python_packaging python
100-
}
101-
102-
10393
function init_venv {
10494
local py=$1
10595
virtualenv venv --python=$py

0 commit comments

Comments
 (0)