forked from powsybl/pypowsybl
-
Notifications
You must be signed in to change notification settings - Fork 0
315 lines (288 loc) · 13.4 KB
/
snapshot-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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
name: Snapshot CI
on:
workflow_dispatch:
schedule:
- cron: '0 3 * * *'
env:
BUILD_STATUS: ${{ github.workspace }}/build_status.txt
jobs:
build_pypowsybl:
name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel
runs-on: ${{ matrix.config.os }}
outputs:
matrix_result: ${{ steps.set_result.outputs.result }}
build_status: ${{ steps.build_status.outputs.BUILD_STATUS_CONTENT }}
strategy:
matrix:
config:
- { name: ubuntu, os: ubuntu-latest}
- { name: darwin, os: macos-12, macosx_deployment_target: "10.16", bdist_wheel_args: "--plat-name macosx-11.0-x86_64" }
python:
- { name: cp38, version: '3.8' }
- { name: cp39, version: '3.9' }
fail-fast: false
defaults:
run:
shell: bash
steps:
#SETUP PYTHON
- name: Set up Python ${{ matrix.python.version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python.version }}
- name: Install Python dependencies
run: python -m pip install --upgrade pip
#SETUP GRAALVM
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '17'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
#INITIALISE REPORT
- name: Initialize test summary
run: |
if [[ "${{ matrix.config.name }}" == "windows" ]]; then
mkdir -p $(dirname "$BUILD_STATUS")
fi
touch "$BUILD_STATUS"
#DEFINE SCRIPTS PATH
- name: Set up script path
run: |
SCRIPTS_PATH="${GITHUB_WORKSPACE}/scripts/.github/workflows/scripts"
if [[ "${{ matrix.config.name }}" == "windows" ]]; then
SCRIPTS_PATH=$(echo "$SCRIPTS_PATH" | sed 's/\\/\//g')
fi
echo "SCRIPTS_PATH=$SCRIPTS_PATH" >> $GITHUB_ENV
#BUILD CORE
- name: Checkout core sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-core
ref: main
path: powsybl-core
- name: Build CORE
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
working-directory: ./powsybl-core
- name: get CORE_VERSION
run: echo "CORE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
working-directory: ./powsybl-core
#CHECKOUT SCRIPT
#The script check_snapshot_branch.sh is located in the workflow folder of the pypowsybl repository
#It is necessary for checking out the integration branch if it exists (pypowsybl include)
- name: Checkout script
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
sparse-checkout-cone-mode: false
path: scripts
#BUILD OPENLOADFLOW
- name: Checking for openloadflow snapshot branch
run : ${{ env.SCRIPTS_PATH }}/check_snapshot_branch.sh "https://github.com/powsybl/powsybl-open-loadflow.git" ${{ env.CORE_VERSION }}
- name: Checkout openloadflow sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-open-loadflow
ref: ${{ env.SNAPSHOT_BRANCH }}
path: powsybl-open-loadflow
- name: Change core version
run: mvn versions:set-property -Dproperty=powsybl-core.version -DnewVersion=${{ env.CORE_VERSION}} -DgenerateBackupPoms=false
working-directory: ./powsybl-open-loadflow
- name: Build LOADFLOW
continue-on-error: true
run: |
chmod +x ${{ env.SCRIPTS_PATH }}/build_module.sh
${{ env.SCRIPTS_PATH }}/build_module.sh "LOADFLOW" "mvn -batch-mode --no-transfer-progress clean install -Dmaven.test.failure.ignore=true"
working-directory: ./powsybl-open-loadflow
- name: Get LOADFLOW_VERSION
run: echo "LOADFLOW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
working-directory: ./powsybl-open-loadflow
#BUILD DIAGRAM
- name: Checking for diagram snapshot branch
run : ${{ env.SCRIPTS_PATH }}/check_snapshot_branch.sh "https://github.com/powsybl/powsybl-diagram.git" ${{ env.CORE_VERSION }}
- name: Checkout diagram sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-diagram
ref: ${{ env.SNAPSHOT_BRANCH }}
path: powsybl-diagram
- name: Change core version
run: mvn versions:set-property -Dproperty=powsybl-core.version -DnewVersion=${{ env.CORE_VERSION}} -DgenerateBackupPoms=false
working-directory: ./powsybl-diagram
- name: Build DIAGRAM
continue-on-error: true
run: |
chmod +x ${{ env.SCRIPTS_PATH }}/build_module.sh
${{ env.SCRIPTS_PATH }}/build_module.sh "DIAGRAM" "mvn -batch-mode --no-transfer-progress clean install -Dmaven.test.failure.ignore=true"
working-directory: ./powsybl-diagram
- name: Get DIAGRAM_VERSION version
run: echo "DIAGRAM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
working-directory: ./powsybl-diagram
#BUILD ENTSOE
- name: Checking for entsoe snapshot branch
run : ${{ env.SCRIPTS_PATH }}/check_snapshot_branch.sh "https://github.com/powsybl/powsybl-entsoe.git" ${{ env.CORE_VERSION }}
- name: Checkout entsoe sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-entsoe
ref: ${{ env.SNAPSHOT_BRANCH }}
path: powsybl-enstoe
- name: Change core/loadflow version
run: |
mvn versions:set-property -Dproperty=powsybl.core.version -DnewVersion=${{ env.CORE_VERSION}} -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsyblopenloadflow.version -DnewVersion=${{ env.LOADFLOW_VERSION}} -DgenerateBackupPoms=false
working-directory: ./powsybl-enstoe
- name: Build ENTSOE
continue-on-error: true
run: |
chmod +x ${{ env.SCRIPTS_PATH }}/build_module.sh
${{ env.SCRIPTS_PATH }}/build_module.sh "ENTSOE" "mvn -batch-mode --no-transfer-progress clean install -Dmaven.test.failure.ignore=true"
working-directory: ./powsybl-enstoe
- name: Get ENTSOE_VERSION
run: echo "ENTSOE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
working-directory: ./powsybl-enstoe
#BUILD OPENRAO
- name: Checking for openrao snapshot branch
run : ${{ env.SCRIPTS_PATH }}/check_snapshot_branch.sh "https://github.com/powsybl/powsybl-open-rao.git" ${{ env.CORE_VERSION }}
- name: Checkout openrao sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-open-rao
ref: ${{ env.SNAPSHOT_BRANCH }}
path: powsybl-openrao
- name: Change core/entsoe/loadflow version
run: |
mvn versions:set-property -Dproperty=powsybl.core.version -DnewVersion=${{ env.CORE_VERSION}} -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl.entsoe.version -DnewVersion=${{ env.ENTSOE_VERSION}} -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl.openloadflow.version -DnewVersion=${{ env.LOADFLOW_VERSION}} -DgenerateBackupPoms=false
working-directory: ./powsybl-openrao
- name: Build OPENRAO
continue-on-error: true
run: |
chmod +x ${{ env.SCRIPTS_PATH }}/build_module.sh
${{ env.SCRIPTS_PATH }}/build_module.sh "OPENRAO" "mvn -batch-mode --no-transfer-progress clean install -Dmaven.test.failure.ignore=true"
working-directory: ./powsybl-openrao
- name: Get OPENRAO_VERSION
run: echo "OPENRAO_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
working-directory: ./powsybl-openrao
#BUILD DYNAWO
- name: Checking for dynawo snapshot branch
run: ${{ env.SCRIPTS_PATH }}/check_snapshot_branch.sh "https://github.com/powsybl/powsybl-dynawo.git" ${{ env.CORE_VERSION }}
- name: Checkout dynawo sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-dynawo
ref: ${{ env.SNAPSHOT_BRANCH }}
path: powsybl-dynawo
- name: Change core version
run: mvn versions:set-property -Dproperty=powsybl-core.version -DnewVersion=${{ env.CORE_VERSION}} -DgenerateBackupPoms=false
working-directory: ./powsybl-dynawo
- name: Build DYNAWO
continue-on-error: true
run: |
chmod +x ${{ env.SCRIPTS_PATH }}/build_module.sh
${{ env.SCRIPTS_PATH }}/build_module.sh "DYNAWO" "mvn -batch-mode --no-transfer-progress clean install -Dmaven.test.failure.ignore=true"
working-directory: ./powsybl-dynawo
- name: Get DYNAWO_VERSION
run: echo "DYNAWO_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
working-directory: ./powsybl-dynawo
#CHECKOUT_PYPOWSYBL_DEPENCIES
- name: Checkout powsybl-dependencies sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-dependencies
ref: main
path: powsybl-dependencies
- name: Get DEPENDENCIES_VERSION
run: echo "DEPENDENCIES_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
working-directory: ./powsybl-dependencies
#UPDATE/INSTALL_PYPOWSYBL_DEPENCIES
- name: Update dependencies versions
run: |
mvn versions:set-property -Dproperty=powsybl-open-loadflow.version -DnewVersion=$LOADFLOW_VERSION -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl-core.version -DnewVersion=$CORE_VERSION -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl-diagram.version -DnewVersion=$DIAGRAM_VERSION -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl-dynawo.version -DnewVersion=$DYNAWO_VERSION -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl-entsoe.version -DnewVersion=$ENTSOE_VERSION -DgenerateBackupPoms=false
mvn versions:set-property -Dproperty=powsybl-open-rao.version -DnewVersion=$OPENRAO_VERSION -DgenerateBackupPoms=false
working-directory: ./powsybl-dependencies
- name: Install powsybl-dependencies
continue-on-error: true
run: mvn -batch-mode --no-transfer-progress clean install
working-directory: ./powsybl-dependencies
#BUILD PYPOWSYBL
- name: Checking dor pypowsybl snapshot branch
run: ${{ env.SCRIPTS_PATH }}/check_snapshot_branch.sh "https://github.com/powsybl/pypowsybl.git" ${{ env.CORE_VERSION }}
- name: Checkout pypowsybl
uses: actions/checkout@v4
with:
repository: powsybl/pypowsybl
ref: ${{ env.SNAPSHOT_BRANCH }}
path: pypowsybl
submodules: true
- name: update java/pom.xml
run: mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=$DEPENDENCIES_VERSION -DgenerateBackupPoms=false
working-directory: ./pypowsybl/java
- name: Install requirement.txt
run: pip3 install -r requirements.txt
working-directory: ./pypowsybl
- name: Build wheel
run: python3 setup.py bdist_wheel
working-directory: ./pypowsybl
- name: Install wheel
run: python -m pip install dist/*.whl --user
working-directory: ./pypowsybl
- name: check pypowsybl versions
working-directory: ./pypowsybl/tests
run: python3 basic_import_test.py
- name: Run tests
working-directory: ./pypowsybl/tests
run: pytest
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: pypowsybl-wheel-${{ matrix.config.name }}-${{ matrix.python.name }}
path: dist/*.whl
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: pypowsybl-wheel-${{ matrix.config.name }}-${{ matrix.python.name }}
path: dist/*.whl
- name: Record Job Name
if: failure()
run: |
echo "Job en échec : Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel" >> $BUILD_STATUS
- name: Show Build Status Report
if: always()
run: |
echo "BUILD_STATUS_CONTENT=$(cat $BUILD_STATUS)" >> $GITHUB_OUTPUT
echo "=== BUILD STATUS REPORT ==="
cat $BUILD_STATUS
echo "=========================="
- name: Read Build Status
if: always()
id: build_status
run: |
echo "BUILD_STATUS_CONTENT<<EOF" >> $GITHUB_OUTPUT
cat $BUILD_STATUS >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
#SLACK NOTIFICATION ON FAILURE
notify_slack:
needs: build_pypowsybl
runs-on: ubuntu-latest
if: failure()
steps:
- name: Send Slack Notification
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: |
:x: *Échec du workflow ${{ github.workflow }}*
*Détails des échecs:*
```
${{ needs.build_pypowsybl.outputs.build_status }}
```
Voir les logs : https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}