forked from dynawo/dynawo
-
Notifications
You must be signed in to change notification settings - Fork 0
221 lines (197 loc) · 8.14 KB
/
nightly-release.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
name: Nightly Release
on:
workflow_dispatch:
inputs:
perform-nightly:
description: Prepare nightly tag and release
type: boolean
default: true
perform-linux:
description: Build Linux release
type: boolean
default: true
perform-windows:
description: Build Windows release
type: boolean
default: true
perform-nrt:
description: Run NRT on Windows
type: boolean
default: true
perform-dispatch:
description: Tell dynawo-algorithms the nightly release is ready
type: boolean
default: true
schedule:
- cron: "0 22 * * 1-5"
env:
DYNAWO_TAG: nightly
jobs:
nightly:
if: github.event_name != 'workflow_dispatch' || inputs.perform-nightly
name: Prepare nightly tag and release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
sparse-checkout: .github/release.js
sparse-checkout-cone-mode: false
- name: Create nightly tag and release if necessary
uses: actions/github-script@v6
env:
body: |
Dynawo's nightly release. Compiled on *release* settings.
**Don't use it for production**
draft: false
prerelease: true
release_name: Nightly
tag_name: ${{ env.DYNAWO_TAG }}
target_commitish: heads/master
with:
retries: 3
script: |
const release = require('.github/release.js')
await release({github, context, core, glob})
fedora:
if: always() && !cancelled() && !failure() && (github.event_name != 'workflow_dispatch' || inputs.perform-linux)
name: Linux Fedora (Release, GCC, cxx11)
runs-on: ubuntu-latest
container: dynawo/dynawo-distribution-cxx11:latest
needs: nightly
env:
DYNAWO_INSTALL_OPENMODELICA: /opt/OpenModelica/Install
DYNAWO_SRC_OPENMODELICA: /opt/OpenModelica/Source
DYNAWO_RESULTS_SHOW: "false"
DYNAWO_BUILD_TYPE: Release
DYNAWO_FORCE_CXX11_ABI: "true"
DYNAWO_NB_PROCESSORS_USED: 2
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: |
export DYNAWO_HOME=$(pwd)
util/envDynawo.sh build-user
- name: Build documentation
run: |
export DYNAWO_HOME=$(pwd)
util/envDynawo.sh build-doc
- name: Prepare files for distribution
run: |
export DYNAWO_HOME=$(pwd)
util/envDynawo.sh distrib
util/envDynawo.sh distrib-omc
util/envDynawo.sh distrib-headers
- name: INFO. Files created in distributions folder
run: du -hs distributions/*
- name: Upload assets for release
uses: actions/github-script@v6
env:
tag_name: ${{ env.DYNAWO_TAG }}
draft: false
prerelease: true
files: |
distributions/*.zip
documentation/dynawoDocumentation/DynawoDocumentation.pdf
with:
retries: 3
script: |
const release = require('.github/release.js')
await release({github, context, core, glob})
# The secrets.DISPATCH_TOKEN should contain a fine-grained PAT with access to dynawo/dynawo-algorithms with Repository permissions 'Contents: Read and write'
- name: Tell dynawo-algorithms the nightly release is ready
if: github.event_name != 'workflow_dispatch' || inputs.perform-dispatch
uses: actions/github-script@v6
with:
github-token: ${{ secrets.DISPATCH_TOKEN }}
script: |
await github.rest.repos.createDispatchEvent({ owner: context.repo.owner, repo: "dynawo-algorithms", event_type: "nightly-linux" });
windows:
if: always() && !cancelled() && !failure() && (github.event_name != 'workflow_dispatch' || inputs.perform-windows)
name: Windows 2019 (Release, VS2019)
runs-on: windows-2019
needs: nightly
env:
DYNAWO_VERSION: 1.4.1 # latest release with OpenModelica
steps:
- name: No LF to CRLF conversion
shell: cmd
run: git config --global core.autocrlf input
- name: Checkout sources
uses: actions/checkout@v3
- name: Git move to keep path as short as possible
shell: cmd
run: |
cd ..
move dynawo \
md dynawo
- name: Fetch previous release of Dynawo
shell: bash
run: curl -LOs https://github.com/${{ github.repository_owner }}/dynawo/releases/download/v$DYNAWO_VERSION/Dynawo_Windows_v$DYNAWO_VERSION.zip
- name: Unzip and retrieve OpenModelica
shell: cmd
run: |
7z x Dynawo_Windows_v%DYNAWO_VERSION%.zip dynawo\OpenModelica\ -r -o\OpenModelica
del Dynawo_Windows_v%DYNAWO_VERSION%.zip
cd \OpenModelica\dynawo
7z a ${{ github.workspace }}\OpenModelica-windows.zip -r OpenModelica\*
# We are forced to change the path to avoid too long commands when compiling
- name: Build Dynawo Third Parties
shell: cmd
env:
PATH: C:\Windows\system32;C:\Program Files\Git\cmd;C:\hostedtoolcache\windows\Python\3.7.9\x64;C:\hostedtoolcache\windows\Python\3.7.9\x64\Scripts
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd \dynawo
cmake -Wno-dev -S dynawo/3rdParty -B b-3-p -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../d-3-p -DOPENMODELICA_INSTALL=../OpenModelica/dynawo/OpenModelica -DOPENMODELICA_SRC=../OpenModelica/Source -DOMDEV_HOME=../OMDev -G "NMake Makefiles"
cmake --build b-3-p --target openmodelica
cmake --build b-3-p
- name: Create zip for Dynawo Third Parties
shell: cmd
run: |
cd \
ren d-3-p dynawo-3rd-parties-windows
7z a ${{ github.workspace }}\dynawo-3rd-parties-windows.zip -r dynawo-3rd-parties-windows\*
ren dynawo-3rd-parties-windows d-3-p
- name: Build Dynawo
shell: cmd
env:
PATH: C:\Windows\system32;C:\Program Files\Git\cmd;C:\hostedtoolcache\windows\Python\3.7.9\x64;C:\hostedtoolcache\windows\Python\3.7.9\x64\Scripts
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd \dynawo
cmake -Wno-dev -S dynawo -B b -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../d-i -DDYNAWO_HOME=.. -DINSTALL_OPENMODELICA=../../OpenModelica/dynawo/OpenModelica -DDYNAWO_THIRD_PARTY_DIR=../../d-3-p -G "NMake Makefiles"
cmake --build b --target install solvers models || exit /b 1
- name: NRT Dynawo
if: github.event_name != 'workflow_dispatch' || inputs.perform-nrt
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
forfiles /p \dynawo\nrt\data /m *.jobs /s /c "cmd /c cd \dynawo & \d-i\dynawo.cmd jobs @path || exit /b 1"
- name: Deploy Dynawo
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd \dynawo
call util\windows\deploy.cmd ..\d-i ..\d-3-p \OpenModelica\dynawo\OpenModelica || exit /b 1
move /y *.zip ${{ github.workspace }}
- name: Upload OpenModelica, 3rd parties and dynawo distribution
uses: actions/github-script@v6
env:
tag_name: ${{ env.DYNAWO_TAG }}
draft: false
prerelease: true
files: |
*.zip
with:
retries: 3
script: |
const release = require('/dynawo/.github/release.js')
await release({github, context, core, glob})
- name: Tell dynawo-algorithms the nightly release is ready
if: github.event_name != 'workflow_dispatch' || inputs.perform-dispatch
uses: actions/github-script@v6
with:
github-token: ${{ secrets.DISPATCH_TOKEN }}
script: |
await github.rest.repos.createDispatchEvent({ owner: context.repo.owner, repo: "dynawo-algorithms", event_type: "nightly-windows" });