-
Notifications
You must be signed in to change notification settings - Fork 1
175 lines (170 loc) · 5.54 KB
/
test_python.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: test-python
on:
workflow_call:
inputs:
build_only:
description: "only run wheel builds job"
required: false
default: "false"
type: string
jobs:
python-wheels-build:
# This strategy is taken straight from the numpy wheels.yaml CI job
#
# Since we depend on numpy, there's no reason to try and build a binary cocoex wheel
# on platform that don't have a compiled numpy available.
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
buildplat:
- [ubuntu-20.04, manylinux_x86_64]
- [ubuntu-20.04, musllinux_x86_64]
- [macos-14, macosx_arm64]
- [windows-2019, win_amd64]
python:
- ["cp39", "3.9"]
- ["cp310", "3.10"]
- ["cp311", "3.11"]
- ["cp312", "3.12"]
#- ["cp313", "3.13"]
- ["pp39", "pp"]
exclude:
- buildplat: [ubuntu-20.04, musllinux_x86_64]
python: ["pp39", "pp"]
runs-on: ${{ matrix.buildplat[0] }}
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Download Python source package
uses: actions/download-artifact@v4
with:
name: dist-python-sdist
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2
- name: Build cocoex wheel
shell: bash
run: python -m cibuildwheel --output-dir dist/ coco_experiment-*.tar.gz
env:
CIBW_PRERELEASE_PYTHONS: True
# Required for MSVC builds on Windows, otherwise meson picks up mingw64.
CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv"
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
CIBW_BUILD_VERBOSITY: 1
- name: Archive Python wheels
uses: actions/upload-artifact@v4
with:
name: dist-python-wheels-${{ matrix.python[1] }}-${{ matrix.buildplat[1] }}
path: dist/coco_experiment*.whl
python-wheels-test:
needs: python-wheels-build
if: ${{ inputs.build_only == 'false' }}
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-20.04, manylinux_x86_64]
- [macos-14, macosx_arm64]
- [windows-2019, win_amd64]
python: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.buildplat[0] }}
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- uses: actions/download-artifact@v4
with:
name: dist-python-sdist
path: dist
- uses: actions/download-artifact@v4
with:
name: dist-python-wheels-${{ matrix.python }}-${{ matrix.buildplat[1] }}
path: wheels
- name: List available wheels
run: ls -l wheels/
- uses: actions/setup-python@v5
with:
python-version: ${{matrix.python}}
- name: Setup Python
run: python -m pip install --upgrade pip wheel
- name: Install cocoex
shell: bash
run: python -m pip install wheels/coco_experiment*.whl
- name: Run cocoex test
shell: bash
run: |
tar xf dist/coco_experiment-*.tar.gz --strip-components=1
python -m pip install pytest pytest-cov
pytest --cov=cocoex tests/
python scripts/run-doctest.py
python-wheels-example:
needs: python-wheels-build
if: ${{ inputs.build_only == 'false' }}
strategy:
fail-fast: false
matrix:
buildplat:
- [ubuntu-20.04, manylinux_x86_64]
- [macos-14, macosx_arm64]
- [windows-2019, win_amd64]
python: ["3.9", "3.10", "3.11", "3.12"]
runs-on: ${{ matrix.buildplat[0] }}
defaults:
run:
working-directory: ${{github.workspace}}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: dist-python-wheels-${{ matrix.python }}-${{ matrix.buildplat[1] }}
path: wheels
- uses: actions/setup-python@v5
with:
python-version: ${{matrix.python}}
- name: Setup Python
run: python -m pip install --upgrade pip wheel
- name: Install cocoex and cocopp
shell: bash
run: |
python -m pip install wheels/coco_experiment*.whl
python -m pip install cocopp
- name: Install scipy for example experiment
run: python -m pip install scipy
- name: Run example experiment
run: python build/python/example/example_experiment2.py
merge-python-wheels:
runs-on: ubuntu-latest
needs: [python-wheels-test, python-wheels-example]
if: always()
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: dist-python-wheels
pattern: dist-python-wheels-*
delete-merged: true
python-lint:
runs-on: "ubuntu-latest"
if: ${{ inputs.build_only == 'false' }}
steps:
- uses: actions/download-artifact@v4
with:
name: dist-python-sdist
path: dist
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Setup Python
run: python -m pip install --upgrade pip wheel
- name: Lint with Ruff
shell: bash
continue-on-error: true
run: |
pip install ruff
tar xf dist/coco_experiment*.tar.gz --strip-components=1
ruff check --output-format=github .