Browse code

Add github actions

dummy0 gives strange errors on the Ubuntu 16 runner on github actions
because
dummy already exist, so use a more unique ovpn-dummy0 name instead.

Github actions are a good alternative to travis-ci, which futrure is
questionable
at the moment without payment. The github actions also allows building on
macOS
and Windows (not included in this commit). The matrix is a bit different
than Coverity and uses different Ubuntu version with their native OpenSSL
(1.0.2, 1.1.1)/mbed TLS instead of manually compiling different OpenSSL
versions on just Ubuntu 20.04.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Message-Id: <20210608152434.1403999-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22511.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Arne Schwabe authored on 2021/06/09 00:24:34
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,183 @@
0
+# The name of our workflow
1
+name: Build
2
+on: [push, pull_request]
3
+
4
+jobs:
5
+  mingw:
6
+    strategy:
7
+      matrix:
8
+        include:
9
+          - target: mingw64
10
+            chost: x86_64-w64-mingw32
11
+          - target: mingw
12
+            chost: i686-w64-mingw32
13
+
14
+    runs-on: ubuntu-20.04
15
+    env:
16
+      MAKEFLAGS: -j3
17
+      LZO_VERSION: "2.10"
18
+      PKCS11_HELPER_VERSION: "1.26"
19
+      OPENSSL_VERSION: "1.1.1j"
20
+      TAP_WINDOWS_VERSION: "9.23.3"
21
+      CHOST: ${{ matrix.chost }}
22
+      TARGET: ${{ matrix.target }}
23
+    steps:
24
+      - name: Install dependencies
25
+        run: sudo apt update && sudo apt install -y mingw-w64 libtool automake autoconf man2html unzip
26
+      - name: Checkout ovpn-dco-win
27
+        uses: actions/checkout@v2
28
+        with:
29
+          repository: OpenVPN/ovpn-dco-win
30
+          path: ovpn-dco-win
31
+      - name: Checkout OpenVPN
32
+        uses: actions/checkout@v2
33
+        with:
34
+          path: openvpn
35
+
36
+      - name: autoconf
37
+        run: autoreconf -fvi
38
+        working-directory: openvpn
39
+
40
+      - name: Cache dependencies
41
+        id: cache
42
+        uses: actions/cache@v2
43
+        with:
44
+          path: '~/mingw/'
45
+          key: ${{ matrix.target }}-mingw-${{ env.LZO_VERSION }}-${{ env.PKCS11_HELPER_VERSION }}-${{ env.TAP_WINDOWS_VERSION }}
46
+
47
+      # Repeating  if: steps.cache.outputs.cache-hit != 'true'
48
+      # on every step for building dependencies is ugly but
49
+      # I haven't found a better solution so far.
50
+
51
+      - name: Download mingw depnendencies
52
+        if: steps.cache.outputs.cache-hit != 'true'
53
+        run: |
54
+          wget -c -P download-cache/ "https://build.openvpn.net/downloads/releases/tap-windows-${TAP_WINDOWS_VERSION}.zip"
55
+          wget -c -P download-cache/ "https://www.oberhumer.com/opensource/lzo/download/lzo-${LZO_VERSION}.tar.gz"
56
+          wget -c -P download-cache/ "https://github.com/OpenSC/pkcs11-helper/archive/pkcs11-helper-${PKCS11_HELPER_VERSION}.tar.gz"
57
+          wget -c -P download-cache/ "https://www.openssl.org/source/old/1.1.1/openssl-${OPENSSL_VERSION}.tar.gz"
58
+          tar zxf "download-cache/pkcs11-helper-${PKCS11_HELPER_VERSION}.tar.gz"
59
+          tar zxf "download-cache/openssl-${OPENSSL_VERSION}.tar.gz"
60
+          tar zxf "download-cache/lzo-${LZO_VERSION}.tar.gz"
61
+          unzip download-cache/tap-windows-${TAP_WINDOWS_VERSION}.zip
62
+
63
+      - name: Configure OpenSSL
64
+        if: steps.cache.outputs.cache-hit != 'true'
65
+        run: ./Configure --cross-compile-prefix=${CHOST}- shared ${{ matrix.target }} no-capieng --prefix="${HOME}/mingw/opt" --openssldir="${HOME}/mingw/opt" -static-libgcc
66
+        working-directory: "./openssl-1.1.1j"
67
+
68
+      - name: Build OpenSSL
69
+        if: steps.cache.outputs.cache-hit != 'true'
70
+        run: make
71
+        working-directory: "./openssl-1.1.1j/"
72
+
73
+      - name: Install OpenSSL
74
+        if: steps.cache.outputs.cache-hit != 'true'
75
+        run: make install
76
+        working-directory: "./openssl-1.1.1j/"
77
+
78
+      - name: autoreconf pkcs11-helper
79
+        if: steps.cache.outputs.cache-hit != 'true'
80
+        run: autoreconf -iv
81
+        working-directory: "./pkcs11-helper-pkcs11-helper-1.26"
82
+
83
+      - name: configure pkcs11-helper
84
+        if: steps.cache.outputs.cache-hit != 'true'
85
+        run: OPENSSL_LIBS="-L${HOME}/mingw/opt/lib -lssl -lcrypto" OPENSSL_CFLAGS=-I$HOME/mingw/opt/include PKG_CONFIG_PATH=${HOME}/mingw/opt/lib/pkgconfig ./configure --host=${CHOST} --program-prefix='' --libdir=${HOME}/mingw/opt/lib --prefix=${HOME}/mingw/opt --build=x86_64-pc-linux-gnu --disable-crypto-engine-gnutls --disable-crypto-engine-nss --disable-crypto-engine-polarssl --disable-crypto-engine-mbedtls
86
+        working-directory: "./pkcs11-helper-pkcs11-helper-1.26"
87
+
88
+      - name: build pkcs11-helper
89
+        if: steps.cache.outputs.cache-hit != 'true'
90
+        run: make all
91
+        working-directory: "./pkcs11-helper-pkcs11-helper-1.26"
92
+
93
+      - name: install pkcs11-helper
94
+        if: steps.cache.outputs.cache-hit != 'true'
95
+        run: make install
96
+        working-directory: "./pkcs11-helper-pkcs11-helper-1.26"
97
+
98
+      - name: Configure lzo
99
+        if: steps.cache.outputs.cache-hit != 'true'
100
+        run: ./configure --host=${CHOST} --program-prefix='' --libdir=${HOME}/mingw/opt/lib --prefix=${HOME}/mingw/opt --build=x86_64-pc-linux-gnu
101
+        working-directory: "./lzo-2.10"
102
+
103
+      - name: build lzo
104
+        if: steps.cache.outputs.cache-hit != 'true'
105
+        working-directory: "./lzo-2.10"
106
+        run: make
107
+
108
+      - name: install lzo
109
+        if: steps.cache.outputs.cache-hit != 'true'
110
+        working-directory: "./lzo-2.10"
111
+        run: make install
112
+
113
+      - name: copy tap-windows.h header
114
+        if: steps.cache.outputs.cache-hit != 'true'
115
+        run: cp ./tap-windows-9.23.3/include/tap-windows.h ${HOME}/mingw/opt/include/
116
+
117
+      - name: configure OpenVPN
118
+        run: PKG_CONFIG_PATH=${HOME}/mingw/opt/lib/pkgconfig DCO_SOURCEDIR=$(realpath ../ovpn-dco-win) LDFLAGS=-L$HOME/mingw/opt/lib CFLAGS=-I$HOME/mingw/opt/include OPENSSL_LIBS="-L${HOME}/opt/lib -lssl -lcrypto" OPENSSL_CFLAGS=-I$HOME/mingw/opt/include PREFIX=$HOME/mingw/opt LZO_CFLAGS=-I$HOME/mingw/opt/include LZO_LIBS="-L${HOME}/mingw/opt/lib -llzo2" ./configure  --host=${CHOST} --disable-lz4 --enable-dco
119
+        working-directory: openvpn
120
+
121
+      - name: build OpenVPN
122
+        run: make -j3
123
+        working-directory: openvpn
124
+
125
+  ubuntu:
126
+    strategy:
127
+      matrix:
128
+        os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]
129
+        ssllib: [mbedtls, openssl]
130
+
131
+    runs-on: ${{matrix.os}}
132
+    steps:
133
+      - name: Install dependencies
134
+        run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev linux-libc-dev man2html libcmocka-dev python3-docutils libtool automake autoconf libmbedtls-dev
135
+      - name: Checkout OpenVPN
136
+        uses: actions/checkout@v2
137
+      - name: autoconf
138
+        run: autoreconf -fvi
139
+      - name: configure --with-crypto-library=${{matrix.ssllib}}
140
+        run: ./configure
141
+      - name: make all
142
+        run: make -j3
143
+      - name: make check
144
+        run: make check
145
+
146
+  ubutun20-clang-asan:
147
+    strategy:
148
+      matrix:
149
+        os: [ubuntu-16.04, ubuntu-18.04]
150
+        ssllib: [mbedtls, openssl]
151
+
152
+    runs-on: ubuntu-20.04
153
+    steps:
154
+      - name: Install dependencies
155
+        run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev linux-libc-dev man2html clang libcmocka-dev python3-docutils libtool automake autoconf libmbedtls-dev
156
+      - name: Checkout OpenVPN
157
+        uses: actions/checkout@v2
158
+      - name: autoconf
159
+        run: autoreconf -fvi
160
+      - name: configure
161
+        run: CFLAGS="-fsanitize=address -fno-omit-frame-pointer -O2" CC=clang ./configure --with-crypto-library=${{matrix.ssllib}}
162
+      - name: make all
163
+        run: make -j3
164
+      - name: make check
165
+        run: make check
166
+
167
+
168
+  macos:
169
+    runs-on: macos-latest
170
+    steps:
171
+      - name: Checkout OpenVPN
172
+        uses: actions/checkout@v2
173
+      - name: Install dependencies
174
+        run: brew install openssl lzo lz4 man2html cmocka libtool automake autoconf
175
+      - name: autoconf
176
+        run: autoreconf -fvi
177
+      - name: configure
178
+        run: OPENSSL_CFLAGS=-I/usr/local/opt/openssl@1.1/include  OPENSSL_LIBS="-L/usr/local/opt/openssl@1.1/lib -lcrypto -lssl" ./configure
179
+      - name: make all
180
+        run: make -j4
181
+      - name: make check
182
+        run: make check
... ...
@@ -1,6 +1,6 @@
1 1
 #!/usr/bin/env bash
2 2
 
3
-IFACE="dummy0"
3
+IFACE="ovpn-dummy0"
4 4
 UNIT_TEST="./unit_tests/openvpn/networking_testdriver"
5 5
 MAX_TEST=${1:-7}
6 6
 
... ...
@@ -3,7 +3,7 @@
3 3
 #include "networking.h"
4 4
 
5 5
 
6
-static char *iface = "dummy0";
6
+static char *iface = "ovpn-dummy0";
7 7
 
8 8
 static int
9 9
 net__iface_up(bool up)