-
Notifications
You must be signed in to change notification settings - Fork 12
287 lines (248 loc) · 7.82 KB
/
full-ci.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
name: Full CI
on:
push:
branches:
- main
- 'release-v**'
- 'full-sonar-analysis-**'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
manylinux_build:
name: Build linux ${{ matrix.python.name }} wheel
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux2014_x86_64:2024-10-07-1887322
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
strategy:
matrix:
python:
- {
name: cp38,
abi: cp38,
version: '3.8'
}
- {
name: cp39,
abi: cp39,
version: '3.9'
}
- {
name: cp310,
abi: cp310,
version: '3.10'
}
- {
name: cp311,
abi: cp311,
version: '3.11'
}
- {
name: cp312,
abi: cp312,
version: '3.12'
}
- {
name: cp313,
abi: cp313,
version: '3.13'
}
steps:
- name: Install Maven
run: |
curl --fail --silent --show-error https://dlcdn.apache.org/maven/maven-3/3.9.6/binaries/apache-maven-3.9.6-bin.tar.gz -o /tmp/apache-maven-3.9.6-bin.tar.gz
tar xf /tmp/apache-maven-*.tar.gz -C /opt
echo /opt/apache-maven-3.9.6/bin >> $GITHUB_PATH
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1.1.5 # !!! this is last version compatible with manylinux 2014
with:
java-version: '17.0.12'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: true
- name: Setup path
run: echo "/opt/python/${{ matrix.python.name }}-${{ matrix.python.abi }}/bin/" >> $GITHUB_PATH
- name: Install dependencies
run: pip3 install -r requirements.txt
- name: Build wheel
run: |
python3 setup.py bdist_wheel
auditwheel repair dist/*.whl
- name: Install wheel
run: pip3 install wheelhouse/*.whl --user
- name: Run basic pypowsybl import
working-directory: ./tests
run: python3 basic_import_test.py
- name: Run tests
working-directory: ./tests # Run in subdir to use installed lib, not sources
run: |
pytest
- name: Type checking
run: mypy -p pypowsybl
- name: Dev install # In order to generate coverage and linting, we need to install in sources
if: matrix.python.name == 'cp39'
run: |
pip3 uninstall -y pypowsybl
python3 setup.py develop
- name: Generate coverage
if: matrix.python.name == 'cp39'
run: |
coverage run -m pytest tests/
coverage xml
- name: Linting
if: matrix.python.name == 'cp39'
run: pylint pypowsybl
- name: Sonar analysis
if: matrix.python.name == 'cp39'
uses: sonarsource/sonarcloud-github-action@v2.0.2
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: |
-Dsonar.python.coverage.reportPaths=coverage.xml
- name: Run doc examples
working-directory: ./docs
run: make html doctest SPHINXOPTS="-W"
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: pypowsybl-wheel-linux-${{ matrix.python.name }}
path: wheelhouse/*.whl
macos_windows_build:
name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {
name: darwin,
os: macos-12,
macosx_deployment_target: "10.16", # to ensure pip finds wheel when Big Sur is configured to return 10.16 as version instead of 11.0
bdist_wheel_args: "--plat-name macosx-11.0-x86_64", # needed to avoid the wheel to be named -universal2
}
- {
name: darwin-arm64,
os: macos-14,
macosx_deployment_target: "11", # first arm64 version of macosx
bdist_wheel_args: "--plat-name macosx-11.0-arm64", # needed to avoid the wheel to be named -universal2
}
- {
name: windows,
os: windows-2022,
}
python:
- {
name: cp38,
version: '3.8',
}
- {
name: cp39,
version: '3.9',
}
- {
name: cp310,
version: '3.10',
}
- {
name: cp311,
version: '3.11',
}
- {
name: cp312,
version: '3.12',
}
- {
name: cp313,
version: '3.13',
}
steps:
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python.version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Build wheel
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.config.macosx_deployment_target }}
run: python setup.py bdist_wheel ${{ matrix.config.bdist_wheel_args }}
- name: Install wheel
shell: bash
run: python -m pip install dist/*.whl --user
- name: Run basic pypowsybl import
working-directory: ./tests
run: python3 basic_import_test.py
- name: Run tests
working-directory: ./tests
run: python3 -m pytest
- name: Type checking
run: mypy -p pypowsybl
- name: Run doc examples
working-directory: ./docs
run: make html doctest SPHINXOPTS="-W"
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: pypowsybl-wheel-${{ matrix.config.name }}-${{ matrix.python.name }}
path: dist/*.whl
package:
name: Package wheels
runs-on: ubuntu-latest
needs: [manylinux_build, macos_windows_build]
steps:
- name: Download wheels
uses: actions/download-artifact@v3
with:
path: download
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: pypowsybl-wheels
path: |
download/**/*.whl
- name: Release on PyPi
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
python -m pip install --user --upgrade twine
python -m twine upload --username __token__ --password ${{ secrets.PYPI_TOKEN }} download/*/*.whl
build:
name: Run SonarCloud analysis for Java code
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK 17
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: 'temurin'
java-version: '17'
- name: Build with Maven (Ubuntu)
working-directory: ./java
run: >
mvn --batch-mode install
- name: Run SonarCloud analysis
working-directory: ./java
run: >
mvn --batch-mode -DskipTests sonar:sonar
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=powsybl-ci-github
-Dsonar.projectKey=powsybl_pypowsybl-java
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}