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
53 SANITIZER: "${{ matrix.sanitizer }}"
57 uses: actions/checkout@v2
64 sudo apt-get install -y
65 git binutils make autoconf automake diffutils texinfo netcat
66 zlib1g-dev lib{ssl,lzo2,ncurses,readline,vdeplug,miniupnpc}-dev
68 - name: Configure and compile
70 run: bash .github/workflows/sanitizers/build.sh
75 run: bash .github/workflows/sanitizers/run.sh
77 - name: Archive test results
78 run: sudo tar -c -z -f test-results.tar.gz test/ sanitizer/
81 - name: Upload test results
82 uses: actions/upload-artifact@v2
84 name: tests_sanitizer_${{ matrix.sanitizer }}
85 path: test-results.tar.gz
89 runs-on: ubuntu-latest
95 - centos:7 # aka RHEL 7
96 - almalinux:8 # aka RHEL 8
101 - ubuntu:18.04 # previous LTS
102 - ubuntu:20.04 # current LTS
103 - opensuse/leap # aka SLES
105 image: ${{ matrix.os }}
106 options: --privileged
109 - name: Install deps (Alpine)
111 apk add git binutils make autoconf automake gcc linux-headers libtool
112 diffutils texinfo procps openssl-dev zlib-dev lzo-dev ncurses-dev
113 readline-dev musl-dev lz4-dev socat
114 if: startsWith(matrix.os, 'alpine')
116 - name: Install deps (Debian and Ubuntu)
120 apt-get install -y git binutils make autoconf automake gcc diffutils \
121 texinfo netcat procps socat zlib1g-dev lib{ssl,lzo2,lz4,ncurses,readline}-dev
123 DEBIAN_FRONTEND: noninteractive
124 if: startsWith(matrix.os, 'debian') || startsWith(matrix.os, 'ubuntu')
126 - name: Install deps (RHEL)
129 if type dnf 2>/dev/null; then
130 dnf install -y 'dnf-command(config-manager)'
131 dnf config-manager --enable powertools
133 yum install -y epel-release
134 yum install -y git binutils make autoconf automake gcc diffutils \
135 texinfo netcat procps socat {lzo,zlib,lz4,ncurses,readline}-devel
136 yum install -y openssl11-devel || yum install -y openssl-devel
137 if: startsWith(matrix.os, 'centos') || startsWith(matrix.os, 'alma')
139 - name: Install deps (SUSE)
142 zypper install -y tar git binutils make autoconf automake gcc procps
143 makeinfo diffutils gzip socat {openssl,zlib,lzo,liblz4,ncurses,readline}-devel
144 if: startsWith(matrix.os, 'opensuse')
146 - name: Checkout code
147 uses: actions/checkout@v2
151 - name: Assign name for test results artifact
152 run: echo TEST_ARTIFACT="$(echo '${{ matrix.os }}' | sed 's|[:/]|_|g')" >>"$GITHUB_ENV"
154 - name: Run tests with default settings
155 run: sh .github/workflows/test/run.sh default
157 - name: Run tests without legacy protocol
158 run: sh .github/workflows/test/run.sh nolegacy
160 - name: Upload test results
161 uses: actions/upload-artifact@v2
163 name: tests_${{ env.TEST_ARTIFACT }}
164 path: /tmp/tests.*.tar.gz
168 if: startsWith(github.ref, 'refs/tags/release-')
173 os: [ubuntu-18.04, ubuntu-20.04]
175 runs-on: ${{ matrix.os }}
178 - name: Checkout code
179 uses: actions/checkout@v2
183 - name: Install build deps
185 sudo apt-get install -y --no-install-{recommends,suggests}
197 - name: Configure project
200 - name: Prepare debian directory
201 run: bash .github/workflows/deb/prepare.sh
203 JOB_DISTRIBUTION: ${{ matrix.os }}
205 - name: Build deb package
207 dpkg-buildpackage -d -us -uc
210 - name: Upload packages
211 uses: actions/upload-artifact@v2
213 name: deb-${{ matrix.os }}
221 os: [ubuntu-18.04, ubuntu-20.04]
223 runs-on: ${{ matrix.os }}
226 - name: Download built packages
227 uses: actions/download-artifact@v2
229 name: deb-${{ matrix.os }}
231 - name: Install package
232 run: sudo apt-get install -y ./*.deb
234 - name: Prepare tinc configs
237 sudo mkdir -p /etc/tinc/test/hosts
238 sudo tinc -b -n test generate-ed25519-keys
239 echo "Name test" | sudo tee /etc/tinc/test/tinc.conf
241 - name: Enable and start tincd
243 sudo systemctl start tinc@test
244 sudo tinc -n test dump reachable nodes
246 - name: Publish deb package
247 uses: softprops/action-gh-release@v1
251 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
254 runs-on: macos-latest
259 legacy_protocol: ["", --disable-legacy-protocol]
262 - name: Checkout code
263 uses: actions/checkout@v2
267 - name: Install build deps
268 run: brew install coreutils netcat automake lzo lz4 miniupnpc
270 - name: Configure project
273 ./configure --with-openssl=/usr/local/opt/openssl@1.1 --enable-{tunemu,miniupnpc} ${{ matrix.legacy_protocol }}
275 - name: Compile project
276 run: make -j$(sysctl -n hw.ncpu)
279 run: make check-recursive VERBOSE=1
281 - name: Archive test results
282 run: sudo tar -c -z -f test-results.tar.gz test/
285 - name: Upload test results
286 uses: actions/upload-artifact@v2
288 name: tests_${{ runner.os }}_${{ matrix.legacy_protocol }}
289 path: test-results.tar.gz
293 runs-on: windows-latest
298 legacy_protocol: ["", --disable-legacy-protocol]
301 - name: Checkout code
302 uses: actions/checkout@v2
306 - name: Install msys2
307 uses: msys2/setup-msys2@v2
310 # https://packages.msys2.org/package/
314 mingw-w64-x86_64-openssl
315 mingw-w64-x86_64-zlib
316 mingw-w64-x86_64-lzo2
318 mingw-w64-x86_64-ncurses
319 mingw-w64-x86_64-miniupnpc
324 - name: Configure project
328 ./configure --enable-miniupnpc --disable-readline --with-curses-include=/mingw64/include/ncurses ${{ matrix.legacy_protocol }}
330 - name: Compile project
336 run: make check-recursive VERBOSE=1
338 - name: Archive test results
340 run: tar -c -z -f test-results.tar.gz test/
343 - name: Upload test results
344 uses: actions/upload-artifact@v2
346 name: tests_${{ runner.os }}_${{ matrix.legacy_protocol }}
347 path: test-results.tar.gz