-
Notifications
You must be signed in to change notification settings - Fork 12
235 lines (208 loc) · 9.35 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
name: Snapshot CI
on:
workflow_dispatch:
push:
schedule:
- cron: '0 3 * * *'
jobs:
buil_pypowsybl:
name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- { name: ubuntu, os: ubuntu-latest, sed_inplace: "-i" }
python:
- { name: cp38, version: '3.8' }
steps:
#SETUP JDK
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
#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.1.5
with:
java-version: '17'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
#BUILD CORE
- name: Checkout core-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-core
ref: main
- name: Build with Maven
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
shell: bash
- name: Get core version
run: echo "CORE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
shell: bash
#CHECKOUT REPO TO GET SCRIPT
- name: ckeckout pypowsybl repo
uses: actions/checkout@v4
with:
ref: snapshot-ci
submodules: true
#BUILD LOADFLOW
- name: Check SNAPSHOT branch
run : ./.github/workflows/check_snapshot_branch.sh https://github.com/powsybl/powsybl-open-loadflow.git ${{ env.CORE_VERSION }}
- name: Checkout loadflow-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-open-loadflow
ref: ${{ env.SNAPSHOT_BRANCH }}
- name: Change core version
run: sed ${{ matrix.config.sed_inplace }} 's|<powsybl-core.version>.*</powsybl-core.version>|<powsybl-core.version>'"$CORE_VERSION"'</powsybl-core.version>|' pom.xml
shell: bash
- name: Build with Maven
run: |
mvn -batch-mode --no-transfer-progress clean install -DskipTests
shell: bash
- name: Get loadflow version
run: echo "LOADFLOW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
shell: bash
#BUILD DIAGRAM
- name: Check for SNAPSHOT branch
run: |
source .github/workflows/check-snapshot-branch.sh
check_snapshot_branch "https://github.com/powsybl/powsybl-diagram.git" "$CORE_VERSION"
shell: bash
- name: Checkout diagram-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-diagram
ref: ${{ env.SNAPSHOT_BRANCH }}
- name: Change core version
run: |
sed ${{ matrix.config.sed_inplace }} 's|<powsybl-core.version>.*</powsybl-core.version>|<powsybl-core.version>'"$CORE_VERSION"'</powsybl-core.version>|' pom.xml
shell: bash
- name: Build with Maven
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
shell: bash
- name: Get diagram version
run: echo "DIAGRAM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
shell: bash
#BUILD ENTSOE
- name: Check for SNAPSHOT branch
run: |
source .github/workflows/check-snapshot-branch.sh
check_snapshot_branch "https://github.com/powsybl/powsybl-entsoe.git" "$CORE_VERSION"
shell: bash
- name: Checkout entsoe-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-entsoe
ref: ${{ env.SNAPSHOT_BRANCH }}
- name: Change core version
run: sed ${{ matrix.config.sed_inplace }} 's|<powsyblcore.version>.*</powsyblcore.version>|<powsyblcore.version>'"$CORE_VERSION"'</powsyblcore.version>|' pom.xml
shell: bash
- name: Change open-loadflow version
run: sed ${{ matrix.config.sed_inplace }} 's|<powsyblopenloadflow.version>.*</powsyblopenloadflow.version>|<powsyblopenloadflow.version>'"$LOADFLOW_VERSION"'</powsyblopenloadflow.version>|' pom.xml
shell: bash
- name: Build with Maven
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
shell: bash
- name: Get entsoe version
run: echo "ENTSOE_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
shell: bash
#BUILD OPENRAO
- name: Check for SNAPSHOT branch
run: |
source .github/workflows/check-snapshot-branch.sh
check_snapshot_branch "https://github.com/powsybl/powsybl-open-rao.git" "$CORE_VERSION"
shell: bash
- name: Checkout open-rao-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-open-rao
ref: ${{ env.SNAPSHOT_BRANCH }}
- name: Change core version
run: sed ${{ matrix.config.sed_inplace }} 's|<powsybl.core.version>.*</powsybl.core.version>|<powsybl.core.version>'"$CORE_VERSION"'</powsybl.core.version>|' pom.xml
shell: bash
- name: Change entsoe version
run: sed ${{ matrix.config.sed_inplace }} 's|<powsybl.entsoe.version>.*</powsybl.entsoe.version>|<powsybl.entsoe.version>'"$ENTSOE_VERSION"'</powsybl.entsoe.version>|' pom.xml
shell: bash
- name: Change open-loadflow version
run: sed ${{ matrix.config.sed_inplace }} 's|<powsybl.openloadflow.version>.*</powsybl.openloadflow.version>|<powsybl.openloadflow.version>'"$LOADFLOW_VERSION"'</powsybl.openloadflow.version>|' pom.xml
shell: bash
- name: Build with Maven
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
shell: bash
- name: Get open-rao version
run: echo "OPENRAO_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
shell: bash
#BUILD DYNAWO
- name: Check for SNAPSHOT branch
run: |
source .github/workflows/check-snapshot-branch.sh
check_snapshot_branch "https://github.com/powsybl/powsybl-dynawo.git" "$CORE_VERSION"
shell: bash
- name: Checkout dynawo-sources
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-dynawo
ref: ${{ env.SNAPSHOT_BRANCH }}
- name: Change core version
run: sed ${{ matrix.config.sed_inplace }} 's|<powsybl-core.version>.*</powsybl-core.version>|<powsybl-core.version>'"$CORE_VERSION"'</powsybl-core.version>|' pom.xml
shell: bash
- name: Build with Maven
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
- name: Get dynawo version
run: echo "DYNAWO_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
shell: bash
#CHECKOUT_PYPOWSYBL_DEPENCIES
- name: Checkout powsybl-dependencies
uses: actions/checkout@v4
with:
repository: powsybl/powsybl-dependencies
ref: main
- name: Get dependencies version
run: echo "DEPENDENCIES_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
shell: bash
#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
- name: Install powsybl-dependencies
run: mvn -batch-mode --no-transfer-progress clean install -DskipTests
shell: bash
#BUILD PYPOWSYBL
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true
- name: Change java-pom.xml
working-directory: ./java
run: mvn versions:set-property -Dproperty=powsybl-dependencies.version -DnewVersion=$DEPENDENCIES_VERSION -DgenerateBackupPoms=false
- name: Install dependencies
run: pip3 install -r requirements.txt
- name: Build wheel
run: python3 setup.py bdist_wheel
- name: Install wheel
run: python -m pip install dist/*.whl --user
- name: Run tests
working-directory: ./tests
run: pytest
- name: check pypowsybl versions
working-directory: ./tests
run: python3 basic_import_test.py
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: pypowsybl-wheel-${{ matrix.config.name }}-${{ matrix.python.name }}
path: dist/*.whl