12 runs-on: ubuntu-latest
16 uses: actions/checkout@v2
20 sudo apt-get install -y astyle clang-tidy-$CLANG
21 sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$CLANG 100
22 curl -OL "https://github.com/koalaman/shellcheck/releases/download/v$SHELLCHECK/shellcheck-v${SHELLCHECK}.linux.x86_64.tar.xz"
23 tar -C ~ --strip-components=1 --wildcards -xf ./shellcheck-*.tar.xz 'shellcheck-*/shellcheck'
24 curl -o ~/shfmt -L "https://github.com/mvdan/sh/releases/download/v$SHFMT/shfmt_v${SHFMT}_linux_amd64"
25 chmod 755 ~/shfmt ~/shellcheck
26 pip3 install --user compiledb
34 sudo apt-get install -y
35 git binutils make autoconf automake diffutils texinfo netcat
36 zlib1g-dev lib{ssl,lzo2,ncurses,readline,vdeplug,miniupnpc,gcrypt}-dev
38 - name: Configure and compile
41 ./configure --enable-{uml,vde,miniupnpc}
43 compiledb -n make check
45 - name: Check code formatting
46 run: "! astyle -r --options=.astylerc --dry-run --formatted '*.c' '*.h' | grep '^Formatted'"
49 - name: Check scripts formatting
50 run: find -type f -regextype egrep -regex '.+\.(sh|sh\.in|test)$' -exec ~/shfmt -d -i 2 -s '{}' +
53 - name: Run static analysis on scripts
54 run: find -type f -regextype egrep -regex '.+\.sh(\.in)?$' -exec shellcheck -x '{}' +
57 - name: Run static analysis on tests
58 run: find -type f -name '*.test' -execdir shellcheck -x '{}' +
61 - name: Run clang-tidy
64 ! '(' -path src/solaris -prune ')' \
65 ! '(' -path src/mingw -prune ')' \
66 ! '(' -path src/bsd -prune ')' \
68 -exec clang-tidy --header-filter='.*' '{}' +
72 runs-on: ubuntu-latest
82 SANITIZER: "${{ matrix.sanitizer }}"
86 uses: actions/checkout@v2
93 sudo apt-get install -y
94 git binutils make autoconf automake diffutils texinfo netcat
95 zlib1g-dev lib{ssl,lzo2,ncurses,readline,vdeplug,miniupnpc}-dev
97 - name: Configure and compile
99 run: bash .github/workflows/sanitizers/build.sh
104 run: bash .github/workflows/sanitizers/run.sh
106 - name: Archive test results
107 run: sudo tar -c -z -f test-results.tar.gz test/ sanitizer/
110 - name: Upload test results
111 uses: actions/upload-artifact@v2
113 name: tests_sanitizer_${{ matrix.sanitizer }}
114 path: test-results.tar.gz
118 runs-on: ubuntu-latest
125 - centos:7 # aka RHEL 7
126 - almalinux:8 # aka RHEL 8
131 - ubuntu:18.04 # previous LTS
132 - ubuntu:20.04 # current LTS
133 - opensuse/leap # aka SLES
135 image: ${{ matrix.os }}
136 options: --privileged
140 - name: Install deps (Alpine)
142 apk add git binutils make autoconf automake gcc linux-headers libtool
143 diffutils texinfo procps openssl-dev zlib-dev lzo-dev ncurses-dev
144 readline-dev musl-dev lz4-dev socat shadow sudo
145 if: startsWith(matrix.os, 'alpine')
147 - name: Install deps (Debian and Ubuntu)
151 apt-get install -y git binutils make autoconf automake gcc diffutils sudo \
152 texinfo netcat procps socat zlib1g-dev lib{ssl,lzo2,lz4,ncurses,readline}-dev
154 DEBIAN_FRONTEND: noninteractive
155 if: startsWith(matrix.os, 'debian') || startsWith(matrix.os, 'ubuntu')
157 - name: Install deps (RHEL)
160 if type dnf 2>/dev/null; then
161 dnf install -y 'dnf-command(config-manager)'
162 dnf config-manager --enable powertools
164 yum install -y epel-release
165 yum install -y git binutils make autoconf automake gcc diffutils sudo \
166 texinfo netcat procps socat {lzo,zlib,lz4,ncurses,readline}-devel
167 yum install -y openssl11-devel || yum install -y openssl-devel
168 if: startsWith(matrix.os, 'centos') || startsWith(matrix.os, 'alma')
170 - name: Install deps (SUSE)
173 zypper install -y tar git binutils make autoconf automake gcc procps sudo
174 makeinfo diffutils gzip socat {openssl,zlib,lzo,liblz4,ncurses,readline}-devel
175 if: startsWith(matrix.os, 'opensuse')
177 - name: Checkout code
178 uses: actions/checkout@v2
182 - name: Assign name for test results artifact
183 run: echo TEST_ARTIFACT="$(echo '${{ matrix.os }}' | sed 's|[:/]|_|g')" >>"$GITHUB_ENV"
185 - name: Create a non-privileged user
187 useradd --user-group build
188 chown -R build:build .
189 echo 'build ALL=(ALL) NOPASSWD: ALL' >/etc/sudoers.d/build
191 - name: Run tests with default settings
192 run: sudo -u build CI=1 sh .github/workflows/test/run.sh default
194 - name: Run tests without legacy protocol
195 run: sudo -u build CI=1 sh .github/workflows/test/run.sh nolegacy
197 - name: Upload test results
198 uses: actions/upload-artifact@v2
200 name: tests_${{ env.TEST_ARTIFACT }}
201 path: /tmp/tests.*.tar.gz
205 if: startsWith(github.ref, 'refs/tags/release-')
210 os: [ubuntu-18.04, ubuntu-20.04]
212 runs-on: ${{ matrix.os }}
216 - name: Checkout code
217 uses: actions/checkout@v2
221 - name: Install build deps
223 sudo apt-get install -y --no-install-{recommends,suggests}
235 - name: Configure project
238 - name: Prepare debian directory
239 run: bash .github/workflows/deb/prepare.sh
241 JOB_DISTRIBUTION: ${{ matrix.os }}
243 - name: Build deb package
245 dpkg-buildpackage -d -us -uc
248 - name: Upload packages
249 uses: actions/upload-artifact@v2
251 name: deb-${{ matrix.os }}
259 os: [ubuntu-18.04, ubuntu-20.04]
261 runs-on: ${{ matrix.os }}
265 - name: Download built packages
266 uses: actions/download-artifact@v2
268 name: deb-${{ matrix.os }}
270 - name: Install package
271 run: sudo apt-get install -y ./*.deb
273 - name: Prepare tinc configs
276 sudo mkdir -p /etc/tinc/test/hosts
277 sudo tinc -b -n test generate-ed25519-keys
278 echo "Name test" | sudo tee /etc/tinc/test/tinc.conf
280 - name: Enable and start tincd
282 sudo systemctl start tinc@test
283 sudo tinc -n test dump reachable nodes
285 - name: Publish deb package
286 uses: softprops/action-gh-release@v1
290 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
293 runs-on: macos-latest
299 legacy_protocol: ["", --disable-legacy-protocol]
302 - name: Checkout code
303 uses: actions/checkout@v2
307 - name: Install build deps
309 brew install coreutils netcat automake lzo lz4 miniupnpc
310 pip3 install --user compiledb
312 - name: Configure and compile
314 export CPPFLAGS="-I/usr/local/include"
315 export CPPFLAGS="$CPPFLAGS -I$(brew --prefix libgcrypt)/include"
316 export CPPFLAGS="$CPPFLAGS -I$(brew --prefix openssl)/include"
317 export CPPFLAGS="$CPPFLAGS -I$(brew --prefix libgcrypt)/include"
321 --with-openssl="$(brew --prefix openssl)" \
322 --with-miniupnpc="$(brew --prefix miniupnpc)" \
323 --enable-{tunemu,miniupnpc} \
324 ${{ matrix.legacy_protocol }}
326 make -j$(sysctl -n hw.ncpu)
330 export PATH="$PATH:$HOME/Library/Python/3.9/bin"
331 compiledb make -j$(sysctl -n hw.ncpu) check VERBOSE=1
333 - name: Run clang-tidy
335 export PATH="$PATH:$(brew --prefix llvm)/bin/"
337 ! '(' -path src/solaris -prune ')' \
338 ! '(' -path src/mingw -prune ')' \
339 ! '(' -path src/linux -prune ')' \
340 ! -name vde_device.c \
342 -exec clang-tidy --header-filter='.*' '{}' +
343 if: ${{ matrix.legacy_protocol == '' }}
345 - name: Archive test results
346 run: sudo tar -c -z -f test-results.tar.gz test/
349 - name: Upload test results
350 uses: actions/upload-artifact@v2
352 name: tests_${{ runner.os }}_${{ matrix.legacy_protocol }}
353 path: test-results.tar.gz
357 runs-on: windows-latest
363 legacy_protocol: ["", --disable-legacy-protocol]
366 - name: Checkout code
367 uses: actions/checkout@v2
371 - name: Install msys2
372 uses: msys2/setup-msys2@v2
375 # https://packages.msys2.org/package/
379 mingw-w64-x86_64-openssl
380 mingw-w64-x86_64-zlib
381 mingw-w64-x86_64-lzo2
383 mingw-w64-x86_64-ncurses
384 mingw-w64-x86_64-miniupnpc
389 - name: Configure project
393 ./configure --enable-miniupnpc --disable-readline --with-curses-include=/mingw64/include/ncurses ${{ matrix.legacy_protocol }}
395 - name: Compile project
401 run: make check-recursive VERBOSE=1
403 - name: Archive test results
405 run: tar -c -z -f test-results.tar.gz test/
408 - name: Upload test results
409 uses: actions/upload-artifact@v2
411 name: tests_${{ runner.os }}_${{ matrix.legacy_protocol }}
412 path: test-results.tar.gz