-
Notifications
You must be signed in to change notification settings - Fork 11
379 lines (330 loc) · 16.3 KB
/
opendatacon.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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
name: opendatacon workflow
on:
push:
branches:
- '**' # matches every branch
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
pull_request:
branches:
- '**'
jobs:
opendatacon-native:
name: ${{matrix.os}} ${{matrix.build-type}} ${{matrix.cross}} ${{matrix.bits}}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
build-type: [Release,Debug]
bits: [64]
cross: ['none']
include:
- os: windows-latest
build-type: Release
bits: 32
cross: 'none'
- os: windows-latest
build-type: Debug
bits: 32
cross: 'none'
- os: ubuntu-latest
build-type: Release
bits: 32
cross: 'rpi'
- os: ubuntu-latest
build-type: Debug
bits: 32
cross: 'rpi'
runs-on: ${{ matrix.os }}
env:
BUILD_TYPE: ${{ matrix.build-type }}
INSTALL_PREFIX: ${{github.workspace}}/build/install
JOB_NAME: ${{matrix.os}}_${{matrix.build-type}}_${{matrix.cross}}_${{matrix.bits}}
steps:
- if: always()
name: Set log level
shell: bash
run: |
([ ${{ runner.debug }} ] && echo 'LOG_LVL=debug' || echo 'LOG_LVL=error') >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: git fetch --force --tags
- if: matrix.cross == 'rpi'
name: Setup QEMU
uses: docker/setup-qemu-action@v1
- if: matrix.bits == 32 && contains(matrix.os,'windows') #FIXME: openssl version pinned to 1.1.1 because 3.x choco doesn't support 32bit
name: Set 32-bit env
run: |
echo 'BITPLAT=x86' >> $env:GITHUB_ENV
echo 'BITGEN=-AWin32' >> $env:GITHUB_ENV
choco install openssl --version=1.1.1.2100 --x86
Remove-Item 'C:\hostedtoolcache\windows\Python\3.7.9\x64' -Recurse
echo "C:\hostedtoolcache\windows\Python\3.7.9\x86" >> $env:GITHUB_PATH
Copy-Item -Path ${{github.workspace}}/Code/Ports/PyPort/x86/python37_d.dll -Destination C:\Windows\sysWOW64\
- if: matrix.bits == 64 && contains(matrix.os,'windows')
name: Set 64-bit env
run: |
echo 'BITPLAT=x64' >> $env:GITHUB_ENV
echo 'BITGEN=-Ax64' >> $env:GITHUB_ENV
choco install openssl
Copy-Item -Path ${{github.workspace}}/Code/Ports/PyPort/x64/python37_d.dll -Destination C:\Windows\system32\
- if: contains(matrix.os,'windows')
name: Setup Windows Environment
run: |
If (-not (Test-Path C:\libmodbus\libmodbus)){
Invoke-WebRequest -OutFile libmodbus.zip "https://www.dropbox.com/s/iqf95y9x1x4ol36/libmodbus.zip?dl=1"
7z x -y libmodbus.zip
New-Item C:\libmodbus -ItemType Directory
Move-Item .\libmodbus C:\libmodbus\libmodbus
}
#hack because debug lib aint available!
Copy-Item -Path ${{github.workspace}}/Code/Ports/PyPort/${{env.BITPLAT}}/python37_d.lib -Destination C:/hostedtoolcache/windows/Python/3.7.9/${{env.BITPLAT}}/libs/
echo 'TOOLCHAIN_OPT=-G"Visual Studio 17 2022" ${{env.BITGEN}} -DCMAKE_CONFIGURATION_TYPES=${{env.BUILD_TYPE}} -DMODBUS_HOME=c:\libmodbus\libmodbus\windows${{matrix.bits}} -DPYTHON_HOME=C:\hostedtoolcache\windows\Python\3.7.9\${{env.BITPLAT}}' >> $env:GITHUB_ENV
- if: contains(matrix.os,'macos')
name: Setup MacOS Environment
run: |
brew install libmodbus socat openssl python
echo 'TOOLCHAIN_OPT=-DPACKAGE_DNP3=OFF -DPACKAGE_LIBMODBUS=OFF -DPACKAGE_PYTHON=OFF -DPACKAGE_DNP3=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3 -DPYTHON_HOME=/opt -DMODBUS_HOME=/opt/homebrew' >> $GITHUB_ENV
echo 'BINDIR=bin/' >> $GITHUB_ENV
- if: contains(matrix.os,'ubuntu') && matrix.cross == 'none'
name: Setup Ubuntu Environment
run: |
sudo apt-get install -y libmodbus-dev libssl-dev socat
echo 'SYSVER_OPT=-DCMAKE_SYSTEM_VERSION=generic' >> $GITHUB_ENV
echo 'BINDIR=bin/' >> $GITHUB_ENV
- if: contains(matrix.os,'ubuntu') && matrix.cross == 'none' && matrix.build-type == 'Release'
name: Upload release text
run: git tag -l --format='%(contents)' $(git describe) > tag_annotation.txt
- if: matrix.cross == 'rpi'
name: Rpi Setup Script
run: |
echo '#!/bin/bash
apt-get update
apt-get install -y libmodbus-dev libc6-dev openssl libssl-dev python3.7 python3.7-dev
mkdir -p /github/workspace/build/sysroot$(dirname /usr/include/*/*/pyconfig.h)
chmod a+rwx /github/workspace/build
rm /usr/lib/python3.7/sitecustomize.py
cp /etc/python3.7/sitecustomize.py /usr/lib/python3.7/sitecustomize.py
cp -a /usr/include/*/*/pyconfig.h /github/workspace/build/sysroot$(dirname /usr/include/*/*/pyconfig.h)
cp -a /usr/include/modbus /github/workspace/build/sysroot/usr/include/
cp -a /usr/include/python* /github/workspace/build/sysroot/usr/include/
cp -a /usr/include/openssl /github/workspace/build/sysroot/usr/include/
cp -a /usr/include/*/*/opensslconf.h /github/workspace/build/sysroot/usr/include/openssl/
cp -a /usr/lib /github/workspace/build/sysroot/usr/
cp -a /lib* /github/workspace/build/sysroot/
' > ${{github.workspace}}/install_rpi_deps.sh
chmod +x ${{github.workspace}}/install_rpi_deps.sh
- if: matrix.cross == 'rpi'
name: Setup Rpi Environment
uses: docker://2000cubits/raspbian:buster
with:
entrypoint: /github/workspace/install_rpi_deps.sh
- if: matrix.cross == 'rpi'
name: Setup cross compilation for Rpi
run: |
sudo apt-get update
sudo apt-get install -y g++-arm-linux-gnueabihf
echo 'SYSROOT=${{github.workspace}}/build/sysroot/' >> $GITHUB_ENV
echo 'TOOLCHAIN_OPT=-DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/Code/cmake/rpi-toolchain.cmake -DPACKAGE_DNP3=OFF -DPACKAGE_LIBMODBUS=OFF -DPACKAGE_PYTHON=OFF' >> $GITHUB_ENV
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_PREFIX}} ${{env.TOOLCHAIN_OPT}} ${{env.SYSVER_OPT}} -DFULL=ON
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel 8
- name: Package
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target package
- name: Install
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target install
- name: ODC_tests
if: ${{ always() && !contains(github.ref, 'tag') && matrix.cross == 'none' }}
run: ${{github.workspace}}/build/install/${{env.BINDIR}}ODC_tests ${{env.LOG_LVL}} -d yes
- name: libLua_tests
if: ${{ always() && !contains(github.ref, 'tag') && matrix.cross == 'none' }}
run: ${{github.workspace}}/build/install/${{env.BINDIR}}libLua_tests ${{env.LOG_LVL}} -d yes
- name: DNP3Port_tests
if: ${{ always() && !contains(github.ref, 'tag') && matrix.cross == 'none' }}
run: ${{github.workspace}}/build/install/${{env.BINDIR}}DNP3Port_tests ${{env.LOG_LVL}} -d yes
- name: SimPort_tests
if: ${{ always() && !contains(github.ref, 'tag') && matrix.cross == 'none' }}
run: ${{github.workspace}}/build/install/${{env.BINDIR}}SimPort_tests -d yes
- name: MD3Port_tests
if: ${{ always() && !contains(github.ref, 'tag') && matrix.cross == 'none' }}
run: ${{github.workspace}}/build/install/${{env.BINDIR}}MD3Port_tests ${{env.LOG_LVL}} -d yes
- name: CBPort_tests
if: ${{ always() && !contains(github.ref, 'tag') && matrix.cross == 'none' }}
run: ${{github.workspace}}/build/install/${{env.BINDIR}}CBPort_tests ${{env.LOG_LVL}} -d yes
- name: PyPort_tests
if: ${{ always() && !contains(github.ref, 'tag') && matrix.cross == 'none' }}
run: ${{github.workspace}}/build/install/${{env.BINDIR}}PyPort_tests ${{env.LOG_LVL}} -d yes
- name: FileTransferPort_tests
if: ${{ always() && !contains(github.ref, 'tag') && matrix.cross == 'none' }}
run: ${{github.workspace}}/build/install/${{env.BINDIR}}FileTransferPort_tests ${{env.LOG_LVL}} -d yes
- name: LuaPort_tests
if: ${{ always() && !contains(github.ref, 'tag') && matrix.cross == 'none' }}
run: ${{github.workspace}}/build/install/${{env.BINDIR}}LuaPort_tests ${{env.LOG_LVL}} -d yes
- name: Integration_tests
if: ${{ always() && !contains(github.ref, 'tag') && matrix.cross == 'none' }}
run: ${{github.workspace}}/build/install/${{env.BINDIR}}Integration_tests ${{env.LOG_LVL}} -d yes
- if: always()
name: Upload ODC_Log
uses: actions/upload-artifact@v2
with:
name: ODC_Log_${{env.JOB_NAME}}
retention-days: 7
path: ODC_Log*
- if: always()
name: Upload Installer
uses: actions/upload-artifact@v2
with:
name: installers
retention-days: 7
path: |
${{github.workspace}}/build/opendatacon-*.*.*-*-*-*-*-*.sh
${{github.workspace}}/build/opendatacon-*.*.*-*-*-*-*-*.exe
tag_annotation.txt
opendatacon-docker:
name: ${{matrix.docker}} ${{matrix.build-type}}
strategy:
fail-fast: false
matrix:
build-type: [Release,Debug]
docker: ['library/oraclelinux:7.6','i386/debian:bookworm-slim']
runs-on: ubuntu-latest
container:
image: ${{ matrix.docker }}
env:
BUILD_TYPE: ${{ matrix.build-type }}
INSTALL_PREFIX: /github/workspace/build/install
BINDIR: bin/
JOB_NAME: ${{matrix.os}}_${{matrix.build-type}}_${{matrix.cross}}_${{matrix.bits}}
steps:
- if: always()
name: Set log level
shell: bash
run: |
([ ${{ runner.debug }} ] && echo 'LOG_LVL=debug' || echo 'LOG_LVL=error') >> $GITHUB_ENV
- name: Start run wrapper
run: echo '#!/bin/bash' >> $HOME/run.sh
- if: contains(matrix.docker, 'oracle')
name: Setup OEL7 Environment
continue-on-error: true
run: |
yum install -y oracle-softwarecollection-release-el7
/usr/bin/ol_yum_configure.sh
yum install -y scl-utils glibc-devel iso-codes redhat-rpm-config socat psmisc make devtoolset-8-gcc-c++ cmake3 file openssl11 openssl11-devel openssl11-static libmodbus libmodbus-devel
ln -s /usr/bin/cmake3 /bin/cmake
mkdir -p /opt/openssl-root
ln -s /usr/include/openssl11 /opt/openssl-root/include
ln -s /usr/lib64/openssl11 /opt/openssl-root/lib
# To get Python3.6 we need scl-util-build tools
curl -O https://public-yum.oracle.com/repo/OracleLinux/OL7/optional/developer/x86_64/getPackage/scl-utils-build-20130529-19.el7.x86_64.rpm
rpm -i scl-utils-build-20130529-19.el7.x86_64.rpm
yum install -y rh-python36 rh-python36-python-devel rh-git218
echo 'TOOLCHAIN_OPT=-DPYTHON_HOME=/opt/rh/rh-python36/root/usr -DOPENSSL_ROOT_DIR=/opt/openssl-root -DADD_LIBS=z' >> $GITHUB_ENV
echo 'SYSVER_OPT=-DCMAKE_SYSTEM_VERSION=oel7' >> $GITHUB_ENV
echo 'source scl_source enable devtoolset-8' >> $HOME/run.sh
echo 'source scl_source enable rh-git218' >> $HOME/run.sh
echo '#!/bin/bash' >> /bin/git
echo "$HOME/run.sh git \"\$@\"" >> /bin/git
chmod +x /bin/git
- if: contains(matrix.docker, 'i386')
name: Setup i386 Environment
run: |
apt-get update
apt-get install -y libmodbus-dev socat psmisc openssl libssl-dev g++ git cmake file make binutils python3 python3-dev
echo 'SYSVER_OPT=-DCMAKE_SYSTEM_VERSION=generic -DARCH_DESC=x86' >> $GITHUB_ENV
- name: Finish run wrapper
run: |
echo 'exec "$@"' >> $HOME/run.sh
chmod +x $HOME/run.sh
# see https://github.com/actions/checkout/issues/760
- name: Work-around perms
run: |
git config --global --add safe.directory /__w/opendatacon/opendatacon
git config --global --add safe.directory /__w/opendatacon/opendatacon/Code/submodules/tclap
git config --global --add safe.directory /__w/opendatacon/opendatacon/Code/submodules/dnp3
git config --global --add safe.directory /__w/opendatacon/opendatacon/Code/submodules/asio
git config --global --add safe.directory /__w/opendatacon/opendatacon/Code/submodules/spdlog
git config --global --add safe.directory /__w/opendatacon/opendatacon/Code/submodules/Simple-Web-Server
git config --global --add safe.directory /__w/opendatacon/opendatacon/Code/submodules/python-cmake-buildsystem
- uses: actions/checkout@v1
- run: git fetch --force --tags
- name: Configure CMake
run: $HOME/run.sh cmake -B /github/workspace/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_PREFIX}} ${{env.TOOLCHAIN_OPT}} ${{env.SYSVER_OPT}} -DFULL=ON
- name: Build
run: $HOME/run.sh cmake --build /github/workspace/build --config ${{env.BUILD_TYPE}} --parallel 8
- name: Package
run: $HOME/run.sh cmake --build /github/workspace/build --config ${{env.BUILD_TYPE}} --target package
- name: Install
run: $HOME/run.sh cmake --build /github/workspace/build --config ${{env.BUILD_TYPE}} --target install
- name: ODC_tests
if: ${{ always() && !contains(github.ref, 'tag') }}
run: /github/workspace/build/install/${{env.BINDIR}}ODC_tests ${{env.LOG_LVL}} -d yes
- name: libLua_tests
if: ${{ always() && !contains(github.ref, 'tag') }}
run: /github/workspace/build/install/${{env.BINDIR}}libLua_tests ${{env.LOG_LVL}} -d yes
- name: DNP3Port_tests
if: ${{ always() && !contains(github.ref, 'tag') }}
run: /github/workspace/build/install/${{env.BINDIR}}DNP3Port_tests ${{env.LOG_LVL}} -d yes
- name: SimPort_tests
if: ${{ always() && !contains(github.ref, 'tag') }}
run: /github/workspace/build/install/${{env.BINDIR}}SimPort_tests -d yes
- name: MD3Port_tests
if: ${{ always() && !contains(github.ref, 'tag') }}
run: /github/workspace/build/install/${{env.BINDIR}}MD3Port_tests ${{env.LOG_LVL}} -d yes
- name: CBPort_tests
if: ${{ always() && !contains(github.ref, 'tag') }}
run: /github/workspace/build/install/${{env.BINDIR}}CBPort_tests ${{env.LOG_LVL}} -d yes
- name: PyPort_tests
if: ${{ always() && !contains(github.ref, 'tag') }}
run: /github/workspace/build/install/${{env.BINDIR}}PyPort_tests ${{env.LOG_LVL}} -d yes
- name: FileTransferPort_tests
if: ${{ always() && !contains(github.ref, 'tag') }}
run: /github/workspace/build/install/${{env.BINDIR}}FileTransferPort_tests ${{env.LOG_LVL}} -d yes
- name: LuaPort_tests
if: ${{ always() && !contains(github.ref, 'tag') }}
run: /github/workspace/build/install/${{env.BINDIR}}LuaPort_tests ${{env.LOG_LVL}} -d yes
- name: Integration_tests
if: ${{ always() && !contains(github.ref, 'tag') }}
run: /github/workspace/build/install/${{env.BINDIR}}Integration_tests ${{env.LOG_LVL}} -d yes
- if: always()
name: Find Installer Name
run: |
echo "INSTALLER_NAME=$(find /github/workspace/build -name "opendatacon-*.*.*-*-*-*-*-*.sh" -printf "%f" -quit)" >> $GITHUB_ENV
cp /github/workspace/build/opendatacon-*.*.*-*-*-*-*-*.sh /github/home/
- if: always()
name: Upload Installer
uses: actions/upload-artifact@v1
with:
name: installers
path: /home/runner/work/_temp/_github_home/${{env.INSTALLER_NAME}}
opendatacon-deploy:
if: always() && contains(github.ref, 'tag')
needs: [opendatacon-native,opendatacon-docker]
runs-on: macos-latest
steps:
- name: Download Installers
uses: actions/download-artifact@v2
with:
name: installers
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: false
body_path: tag_annotation.txt
files: |
**/opendatacon-*.*.*-*-*-*-*-*.sh
**/opendatacon-*.*.*-*-*-*-*-*.exe
fail_on_unmatched_files: false
token: ${{ secrets.GITHUB_TOKEN }}
opendatacon-clean:
if: github.event_name != 'pull_request'
needs: [opendatacon-native,opendatacon-docker]
runs-on: ubuntu-latest
steps:
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: '1 week'
skip-recent: 5
skip-tags: false