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='.*' '{}' +
71 - name: Check warnings (gcc)
72 run: bash .github/workflows/warn/run.sh
77 - name: Check warnings (clang)
78 run: bash .github/workflows/warn/run.sh
84 runs-on: ubuntu-latest
94 SANITIZER: "${{ matrix.sanitizer }}"
98 uses: actions/checkout@v2
105 sudo apt-get install -y
106 git binutils make autoconf automake diffutils texinfo netcat
107 zlib1g-dev lib{ssl,lzo2,ncurses,readline,vdeplug,miniupnpc}-dev
109 - name: Configure and compile
111 run: bash .github/workflows/sanitizers/build.sh
116 run: bash .github/workflows/sanitizers/run.sh
118 - name: Archive test results
119 run: sudo tar -c -z -f test-results.tar.gz test/ sanitizer/
122 - name: Upload test results
123 uses: actions/upload-artifact@v2
125 name: tests_sanitizer_${{ matrix.sanitizer }}
126 path: test-results.tar.gz
130 runs-on: ubuntu-latest
137 - centos:7 # aka RHEL 7
138 - almalinux:8 # aka RHEL 8
143 - ubuntu:18.04 # previous LTS
144 - ubuntu:20.04 # current LTS
145 - opensuse/leap # aka SLES
147 image: ${{ matrix.os }}
148 options: --privileged
152 - name: Install deps (Alpine)
154 apk add git binutils make autoconf automake gcc linux-headers libtool
155 diffutils texinfo procps openssl-dev zlib-dev lzo-dev ncurses-dev
156 readline-dev musl-dev lz4-dev socat shadow sudo
157 if: startsWith(matrix.os, 'alpine')
159 - name: Install deps (Debian and Ubuntu)
163 apt-get install -y git binutils make autoconf automake gcc diffutils sudo \
164 texinfo netcat procps socat zlib1g-dev lib{ssl,lzo2,lz4,ncurses,readline}-dev
166 DEBIAN_FRONTEND: noninteractive
167 if: startsWith(matrix.os, 'debian') || startsWith(matrix.os, 'ubuntu')
169 - name: Install deps (RHEL)
172 if type dnf 2>/dev/null; then
173 dnf install -y 'dnf-command(config-manager)'
174 dnf config-manager --enable powertools
176 yum install -y epel-release
177 yum install -y git binutils make autoconf automake gcc diffutils sudo \
178 texinfo netcat procps socat {lzo,zlib,lz4,ncurses,readline}-devel
179 yum install -y openssl11-devel || yum install -y openssl-devel
180 if: startsWith(matrix.os, 'centos') || startsWith(matrix.os, 'alma')
182 - name: Install deps (SUSE)
185 zypper install -y tar git binutils make autoconf automake gcc procps sudo
186 makeinfo diffutils gzip socat {openssl,zlib,lzo,liblz4,ncurses,readline}-devel
187 if: startsWith(matrix.os, 'opensuse')
189 - name: Checkout code
190 uses: actions/checkout@v2
194 - name: Assign name for test results artifact
195 run: echo TEST_ARTIFACT="$(echo '${{ matrix.os }}' | sed 's|[:/]|_|g')" >>"$GITHUB_ENV"
197 - name: Create a non-privileged user
199 useradd --user-group build
200 chown -R build:build .
201 echo 'build ALL=(ALL) NOPASSWD: ALL' >/etc/sudoers.d/build
203 - name: Run tests with default settings
204 run: sudo -u build CI=1 sh .github/workflows/test/run.sh default
206 - name: Run tests without legacy protocol
207 run: sudo -u build CI=1 sh .github/workflows/test/run.sh nolegacy
209 - name: Upload test results
210 uses: actions/upload-artifact@v2
212 name: tests_${{ env.TEST_ARTIFACT }}
213 path: /tmp/tests.*.tar.gz
217 if: startsWith(github.ref, 'refs/tags/release-')
222 os: [ubuntu-18.04, ubuntu-20.04]
224 runs-on: ${{ matrix.os }}
228 - name: Checkout code
229 uses: actions/checkout@v2
233 - name: Install build deps
235 sudo apt-get install -y --no-install-{recommends,suggests}
247 - name: Configure project
250 - name: Prepare debian directory
251 run: bash .github/workflows/deb/prepare.sh
253 JOB_DISTRIBUTION: ${{ matrix.os }}
255 - name: Build deb package
257 dpkg-buildpackage -d -us -uc
260 - name: Upload packages
261 uses: actions/upload-artifact@v2
263 name: deb-${{ matrix.os }}
271 os: [ubuntu-18.04, ubuntu-20.04]
273 runs-on: ${{ matrix.os }}
277 - name: Download built packages
278 uses: actions/download-artifact@v2
280 name: deb-${{ matrix.os }}
282 - name: Install package
283 run: sudo apt-get install -y ./*.deb
285 - name: Prepare tinc configs
288 sudo mkdir -p /etc/tinc/test/hosts
289 sudo tinc -b -n test generate-ed25519-keys
290 echo "Name test" | sudo tee /etc/tinc/test/tinc.conf
292 - name: Enable and start tincd
294 sudo systemctl start tinc@test
295 sudo tinc -n test dump reachable nodes
297 - name: Publish deb package
298 uses: softprops/action-gh-release@v1
302 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
305 runs-on: macos-latest
311 legacy_protocol: ["", --disable-legacy-protocol]
314 - name: Checkout code
315 uses: actions/checkout@v2
319 - name: Install build deps
321 brew install coreutils netcat automake lzo lz4 miniupnpc
322 pip3 install --user compiledb
324 - name: Configure and compile
326 export CPPFLAGS="-I/usr/local/include"
327 export CPPFLAGS="$CPPFLAGS -I$(brew --prefix libgcrypt)/include"
328 export CPPFLAGS="$CPPFLAGS -I$(brew --prefix openssl)/include"
329 export CPPFLAGS="$CPPFLAGS -I$(brew --prefix libgcrypt)/include"
333 --with-openssl="$(brew --prefix openssl)" \
334 --with-miniupnpc="$(brew --prefix miniupnpc)" \
335 --enable-{tunemu,miniupnpc} \
336 ${{ matrix.legacy_protocol }}
338 make -j$(sysctl -n hw.ncpu)
342 export PATH="$PATH:$HOME/Library/Python/3.9/bin"
343 compiledb make -j$(sysctl -n hw.ncpu) check VERBOSE=1
345 - name: Run clang-tidy
347 export PATH="$PATH:$(brew --prefix llvm)/bin/"
349 ! '(' -path src/solaris -prune ')' \
350 ! '(' -path src/mingw -prune ')' \
351 ! '(' -path src/linux -prune ')' \
352 ! -name vde_device.c \
354 -exec clang-tidy --header-filter='.*' '{}' +
355 if: ${{ matrix.legacy_protocol == '' }}
357 - name: Archive test results
358 run: sudo tar -c -z -f test-results.tar.gz test/
361 - name: Upload test results
362 uses: actions/upload-artifact@v2
364 name: tests_${{ runner.os }}_${{ matrix.legacy_protocol }}
365 path: test-results.tar.gz
369 runs-on: windows-latest
375 legacy_protocol: ["", --disable-legacy-protocol]
378 - name: Checkout code
379 uses: actions/checkout@v2
383 - name: Install msys2
384 uses: msys2/setup-msys2@v2
387 # https://packages.msys2.org/package/
391 mingw-w64-x86_64-openssl
392 mingw-w64-x86_64-zlib
393 mingw-w64-x86_64-lzo2
395 mingw-w64-x86_64-ncurses
396 mingw-w64-x86_64-miniupnpc
401 - name: Configure project
405 ./configure --enable-miniupnpc --disable-readline --with-curses-include=/mingw64/include/ncurses ${{ matrix.legacy_protocol }}
407 - name: Compile project
413 run: make check-recursive VERBOSE=1
415 - name: Archive test results
417 run: tar -c -z -f test-results.tar.gz test/
420 - name: Upload test results
421 uses: actions/upload-artifact@v2
423 name: tests_${{ runner.os }}_${{ matrix.legacy_protocol }}
424 path: test-results.tar.gz