This repository has been archived by the owner on Sep 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 233
220 lines (220 loc) · 8.31 KB
/
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
on: [push, pull_request]
name: CI
jobs:
ci-linux:
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
build-type: [Debug, Release]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install system dependencies
run: >
sudo apt-get update &&
sudo apt-get install build-essential clang cmake git libssl-dev default-jdk maven &&
mkdir build
- name: CMake configure
working-directory: build
run: >
flags="-Wall -Wextra -Wno-unused-parameter" &&
if [ "${{ matrix.compiler }}" = "gcc" ]; then flags="${flags} -Wno-format-truncation"; fi &&
if [ "${{ matrix.compiler }}" = "gcc" ]; then c_compiler="gcc" && cxx_compiler="g++"; else c_compiler="clang" && cxx_compiler="clang++"; fi &&
cmake
-DDNP3_EVERYTHING=ON
-DDNP3_STATIC_LIBS=ON
-DDNP3_COVERAGE=OFF
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DCMAKE_C_COMPILER="${c_compiler}"
-DCMAKE_CXX_COMPILER="${cxx_compiler}"
-DCMAKE_CXX_FLAGS="${flags}"
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/opendnp3-package
..
- name: CMake build
working-directory: build
run: cmake --build . --parallel 4
- name: Run C++ tests
working-directory: build
run: ctest -VV
- name: Package build
working-directory: build
run: cmake --build . --target install
- name: Upload package
uses: actions/upload-artifact@v1
with:
name: opendnp3-linux-x64-${{ matrix.compiler }}-${{ matrix.build-type }}-${{ github.sha }}
path: build/opendnp3-package
- name: Build and test Java bindings
working-directory: java
run: >
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ github.workspace }}/build/java &&
export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") &&
mvn --batch-mode verify
- name: Upload Java bindings
if: ${{ matrix.compiler == 'gcc' && matrix.build-type == 'Release' }}
uses: actions/upload-artifact@v2-preview
with:
name: opendnp3-java-bindings-${{ github.sha }}
path: java/bindings/target/opendnp3-bindings-*-SNAPSHOT.jar
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install system dependencies
run: >
sudo apt-get update &&
sudo apt-get install build-essential cmake curl git libssl-dev lcov &&
mkdir build
- name: CMake configure
working-directory: build
run: >
cmake
-DDNP3_TESTS=ON
-DDNP3_COVERAGE=ON
-DCMAKE_BUILD_TYPE=Debug
..
- name: Build and run tests with code coverage
if: ${{ matrix.coverage }} == "ON"
working-directory: build
run: cmake --build . --target coverage --parallel 4
- name: Upload code coverage results
working-directory: build
run: bash <(curl -s https://codecov.io/bash) -f coverage.info.cleaned
ci-windows:
strategy:
fail-fast: false
matrix:
build-type: [Debug, Release]
architecture: [x86, x64]
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install system dependencies
run: >
if("${{ matrix.architecture }}" -eq "x86") { $flag = "--x86" } else { $flag = "" };
choco install --no-progress "$flag" cmake.portable nuget.commandline openssl; mkdir build
- name: Install Java
uses: actions/setup-java@v1
with:
java-version: 8
java-package: jdk
architecture: ${{ matrix.architecture }}
- name: CMake configure
working-directory: build
run: >
if("${{ matrix.architecture }}" -eq "x86") { $arch = "Win32" } else { $arch = "x64" };
cmake -A "$arch"
-DDNP3_EVERYTHING=ON
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/opendnp3-package
..
- name: CMake build
working-directory: build
run: cmake --build . --config ${{ matrix.build-type }} --parallel 4
- name: Run C++ tests
working-directory: build
run: ctest -VV -C ${{ matrix.build-type }}
- name: Package build
working-directory: build
run: cmake --build . --config ${{ matrix.build-type }} --target install
- name: Upload package
uses: actions/upload-artifact@v1
with:
name: opendnp3-win-${{ matrix.architecture }}-msvc-${{ matrix.build-type }}-${{ github.sha }}
path: build/opendnp3-package
- name: Copy NuGet stuff
if: ${{ matrix.build-type == 'Release' }}
run: >
New-Item -ItemType Directory -Force -Path build/opendnp3-nuget/runtime/${{ matrix.architecture }};
Copy-Item build/dotnet/nuget/* -Destination build/opendnp3-nuget -Recurse -Force;
Copy-Item build/opendnp3-package/lib/45/* -Destination build/opendnp3-nuget/runtime/${{ matrix.architecture }} -Recurse -Force
- name: Upload NuGet stuff
if: ${{ matrix.build-type == 'Release' }}
uses: actions/upload-artifact@v2-preview
with:
name: temp-nuget-${{ github.sha }}
path: build/opendnp3-nuget/*
- name: Build and test Java bindings
working-directory: java
run: >
refreshenv;
$env:Path += ";${{ github.workspace }}\build\java\${{ matrix.build-type }}";
mvn --batch-mode verify
nuget:
needs: ci-windows
runs-on: windows-latest
steps:
- name: Install NuGet
uses: nuget/setup-nuget@v1
with:
nuget-version: latest
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
- name: Download NuGet stuff
uses: actions/download-artifact@v2-preview
with:
name: temp-nuget-${{ github.sha }}
path: opendnp3-nuget
- name: Generate NuGet package
working-directory: opendnp3-nuget
run: nuget pack
- name: Upload NuGet package as artifact
uses: actions/upload-artifact@v2-preview
with:
name: opendnp3-nuget-${{ github.sha }}
path: opendnp3-nuget/*.nupkg
- name: Publish NuGet package
if: startsWith(github.ref, 'refs/tags/')
working-directory: opendnp3-nuget
run: "nuget push *.nupkg -NoSymbols -Source https://api.nuget.org/v3/index.json"
conformance:
needs: ci-linux
runs-on: ubuntu-latest
if: "!startsWith(github.ref, 'refs/tags/')"
steps:
- name: Download pre-compiled OpenDNP3
uses: actions/download-artifact@v2-preview
with:
name: opendnp3-linux-x64-gcc-Release-${{ github.sha }}
path: opendnp3
- name: Download pre-built OpenDNP3 Java bindings
uses: actions/download-artifact@v2-preview
with:
name: opendnp3-java-bindings-${{ github.sha }}
path: opendnp3-java
- name: Install OpenDNP3 Java bindings
run: >
jarfile=( opendnp3-java/*.jar ) &&
sudo mvn --batch-mode org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile=$jarfile
- name: Checkout dnp4s
uses: actions/checkout@v2
with:
repository: grid-io/dnp4s
ssh-key: ${{ secrets.DNP4S_SSH_KEY }}
ref: develop
path: dnp4s
- name: Checkout OpenDNP3 test runner
uses: actions/checkout@v2
with:
repository: dnp3/opendnp3-dnp4s-driver
path: opendnp3-dnp4s-driver
- name: Build dnp4s
working-directory: dnp4s
run: sudo mvn --batch-mode install
- name: Build OpenDNP3-dnp4s driver
working-directory: opendnp3-dnp4s-driver
run: sudo mvn --batch-mode compile
- name: Run the conformance tests
working-directory: opendnp3-dnp4s-driver
run: >
sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ github.workspace }}/opendnp3/lib
mvn --batch-mode exec:exec
- name: Upload conformance test results
if: always()
uses: actions/upload-artifact@v1
with:
name: conformance-results-${{ github.sha }}
path: opendnp3-dnp4s-driver/results