12 runs-on: ubuntu-latest
15 uses: actions/checkout@v2
17 - name: Install code formatting tools
19 sudo apt-get install -y astyle
20 curl -OL 'https://github.com/koalaman/shellcheck/releases/download/v0.7.2/shellcheck-v0.7.2.linux.x86_64.tar.xz'
21 tar -C ~ --strip-components=1 --wildcards -xf ./shellcheck-*.tar.xz 'shellcheck-*/shellcheck'
22 curl -o ~/shfmt -L 'https://github.com/mvdan/sh/releases/download/v3.3.0/shfmt_v3.3.0_linux_amd64'
23 chmod 755 ~/shfmt ~/shellcheck
25 - name: Check code formatting
26 run: "! astyle -r --options=.astylerc --dry-run --formatted '*.c' '*.h' | grep '^Formatted'"
28 - name: Check scripts formatting
29 run: find -type f -regextype egrep -regex '.+\.(sh|sh\.in|test)$' -exec ~/shfmt -d -i 2 -s '{}' +
32 - name: Run static analysis on scripts
33 run: find -type f -regextype egrep -regex '.+\.sh(\.in)?$' -exec shellcheck -x '{}' +
36 - name: Prepare test library and run static analysis on tests
39 ./configure --disable-{lzo,readline,zlib,curses}
40 find -type f -name '*.test' -execdir shellcheck -x '{}' +
44 runs-on: ubuntu-latest
52 SANITIZER: "${{ matrix.sanitizer }}"
56 uses: actions/checkout@v2
63 sudo apt-get install -y
64 git binutils make autoconf automake diffutils texinfo netcat
65 zlib1g-dev lib{ssl,lzo2,ncurses,readline,vdeplug,miniupnpc}-dev
67 - name: Configure and compile
69 run: bash .github/workflows/sanitizers/build.sh
74 run: bash .github/workflows/sanitizers/run.sh
76 - name: Archive test results
77 run: sudo tar -c -z -f test-results.tar.gz test/ sanitizer/
80 - name: Upload test results
81 uses: actions/upload-artifact@v2
83 name: tests_sanitizer_${{ matrix.sanitizer }}
84 path: test-results.tar.gz
88 runs-on: ubuntu-latest
94 - centos:7 # aka RHEL 7
95 - almalinux:8 # aka RHEL 8
100 - ubuntu:18.04 # previous LTS
101 - ubuntu:20.04 # current LTS
102 - opensuse/leap # aka SLES
104 image: ${{ matrix.os }}
105 options: --privileged
108 - name: Install deps (Alpine)
110 apk add git binutils make autoconf automake gcc linux-headers libtool
111 diffutils texinfo procps openssl-dev zlib-dev lzo-dev ncurses-dev
112 readline-dev musl-dev lz4-dev socat
113 if: startsWith(matrix.os, 'alpine')
115 - name: Install deps (Debian and Ubuntu)
119 apt-get install -y git binutils make autoconf automake gcc diffutils \
120 texinfo netcat procps socat zlib1g-dev lib{ssl,lzo2,lz4,ncurses,readline}-dev
122 DEBIAN_FRONTEND: noninteractive
123 if: startsWith(matrix.os, 'debian') || startsWith(matrix.os, 'ubuntu')
125 - name: Install deps (RHEL)
128 if type dnf 2>/dev/null; then
129 dnf install -y 'dnf-command(config-manager)'
130 dnf config-manager --enable powertools
132 yum install -y epel-release
133 yum install -y git binutils make autoconf automake gcc diffutils \
134 texinfo netcat procps socat {lzo,zlib,lz4,ncurses,readline}-devel
135 yum install -y openssl11-devel || yum install -y openssl-devel
136 if: startsWith(matrix.os, 'centos') || startsWith(matrix.os, 'alma')
138 - name: Install deps (SUSE)
141 zypper install -y tar git binutils make autoconf automake gcc procps
142 makeinfo diffutils gzip socat {openssl,zlib,lzo,liblz4,ncurses,readline}-devel
143 if: startsWith(matrix.os, 'opensuse')
145 - name: Checkout code
146 uses: actions/checkout@v2
150 - name: Assign name for test results artifact
151 run: echo TEST_ARTIFACT="$(echo '${{ matrix.os }}' | sed 's|[:/]|_|g')" >>"$GITHUB_ENV"
153 - name: Run tests with default settings
154 run: sh .github/workflows/test/run.sh default
156 - name: Run tests without legacy protocol
157 run: sh .github/workflows/test/run.sh nolegacy
159 - name: Upload test results
160 uses: actions/upload-artifact@v2
162 name: tests_${{ env.TEST_ARTIFACT }}
163 path: /tmp/tests.*.tar.gz
167 if: startsWith(github.ref, 'refs/tags/release-')
172 os: [ubuntu-18.04, ubuntu-20.04]
174 runs-on: ${{ matrix.os }}
177 - name: Checkout code
178 uses: actions/checkout@v2
182 - name: Install build deps
184 sudo apt-get install -y --no-install-{recommends,suggests}
196 - name: Configure project
199 - name: Prepare debian directory
200 run: bash .github/workflows/deb/prepare.sh
202 JOB_DISTRIBUTION: ${{ matrix.os }}
204 - name: Build deb package
206 dpkg-buildpackage -d -us -uc
209 - name: Upload packages
210 uses: actions/upload-artifact@v2
212 name: deb-${{ matrix.os }}
220 os: [ubuntu-18.04, ubuntu-20.04]
222 runs-on: ${{ matrix.os }}
225 - name: Download built packages
226 uses: actions/download-artifact@v2
228 name: deb-${{ matrix.os }}
230 - name: Install package
231 run: sudo apt-get install -y ./*.deb
233 - name: Prepare tinc configs
236 sudo mkdir -p /etc/tinc/test/hosts
237 sudo tinc -b -n test generate-ed25519-keys
238 echo "Name test" | sudo tee /etc/tinc/test/tinc.conf
240 - name: Enable and start tincd
242 sudo systemctl start tinc@test
243 sudo tinc -n test dump reachable nodes
245 - name: Publish deb package
246 uses: softprops/action-gh-release@v1
250 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
253 runs-on: macos-latest
258 legacy_protocol: ["", --disable-legacy-protocol]
261 - name: Checkout code
262 uses: actions/checkout@v2
266 - name: Install build deps
267 run: brew install coreutils netcat automake lzo lz4 miniupnpc
269 - name: Configure project
272 ./configure --with-openssl=/usr/local/opt/openssl@1.1 --enable-{tunemu,miniupnpc} ${{ matrix.legacy_protocol }}
274 - name: Compile project
275 run: make -j$(sysctl -n hw.ncpu)
278 run: make check-recursive VERBOSE=1
280 - name: Archive test results
281 run: sudo tar -c -z -f test-results.tar.gz test/
284 - name: Upload test results
285 uses: actions/upload-artifact@v2
287 name: tests_${{ runner.os }}_${{ matrix.legacy_protocol }}
288 path: test-results.tar.gz
292 runs-on: windows-latest
297 legacy_protocol: ["", --disable-legacy-protocol]
300 - name: Checkout code
301 uses: actions/checkout@v2
305 - name: Install msys2
306 uses: msys2/setup-msys2@v2
309 # https://packages.msys2.org/package/
313 mingw-w64-x86_64-openssl
314 mingw-w64-x86_64-zlib
315 mingw-w64-x86_64-lzo2
317 mingw-w64-x86_64-ncurses
318 mingw-w64-x86_64-miniupnpc
323 - name: Configure project
327 ./configure --enable-miniupnpc --disable-readline --with-curses-include=/mingw64/include/ncurses ${{ matrix.legacy_protocol }}
329 - name: Compile project
335 run: make check-recursive VERBOSE=1
337 - name: Archive test results
339 run: tar -c -z -f test-results.tar.gz test/
342 - name: Upload test results
343 uses: actions/upload-artifact@v2
345 name: tests_${{ runner.os }}_${{ matrix.legacy_protocol }}
346 path: test-results.tar.gz