12 runs-on: ubuntu-latest
16 uses: actions/checkout@v2
18 - name: Install code formatting tools
20 sudo apt-get install -y astyle
21 curl -OL 'https://github.com/koalaman/shellcheck/releases/download/v0.7.2/shellcheck-v0.7.2.linux.x86_64.tar.xz'
22 tar -C ~ --strip-components=1 --wildcards -xf ./shellcheck-*.tar.xz 'shellcheck-*/shellcheck'
23 curl -o ~/shfmt -L 'https://github.com/mvdan/sh/releases/download/v3.3.0/shfmt_v3.3.0_linux_amd64'
24 chmod 755 ~/shfmt ~/shellcheck
26 - name: Check code formatting
27 run: "! astyle -r --options=.astylerc --dry-run --formatted '*.c' '*.h' | grep '^Formatted'"
29 - name: Check scripts formatting
30 run: find -type f -regextype egrep -regex '.+\.(sh|sh\.in|test)$' -exec ~/shfmt -d -i 2 -s '{}' +
33 - name: Run static analysis on scripts
34 run: find -type f -regextype egrep -regex '.+\.sh(\.in)?$' -exec shellcheck -x '{}' +
37 - name: Prepare test library and run static analysis on tests
40 ./configure --disable-{lzo,readline,zlib,curses}
41 find -type f -name '*.test' -execdir shellcheck -x '{}' +
45 runs-on: ubuntu-latest
55 SANITIZER: "${{ matrix.sanitizer }}"
59 uses: actions/checkout@v2
66 sudo apt-get install -y
67 git binutils make autoconf automake diffutils texinfo netcat
68 zlib1g-dev lib{ssl,lzo2,ncurses,readline,vdeplug,miniupnpc}-dev
70 - name: Configure and compile
72 run: bash .github/workflows/sanitizers/build.sh
77 run: bash .github/workflows/sanitizers/run.sh
79 - name: Archive test results
80 run: sudo tar -c -z -f test-results.tar.gz test/ sanitizer/
83 - name: Upload test results
84 uses: actions/upload-artifact@v2
86 name: tests_sanitizer_${{ matrix.sanitizer }}
87 path: test-results.tar.gz
91 runs-on: ubuntu-latest
98 - centos:7 # aka RHEL 7
99 - almalinux:8 # aka RHEL 8
104 - ubuntu:18.04 # previous LTS
105 - ubuntu:20.04 # current LTS
106 - opensuse/leap # aka SLES
108 image: ${{ matrix.os }}
109 options: --privileged
112 - name: Install deps (Alpine)
114 apk add git binutils make autoconf automake gcc linux-headers libtool
115 diffutils texinfo procps openssl-dev zlib-dev lzo-dev ncurses-dev
116 readline-dev musl-dev lz4-dev socat
117 if: startsWith(matrix.os, 'alpine')
119 - name: Install deps (Debian and Ubuntu)
123 apt-get install -y git binutils make autoconf automake gcc diffutils \
124 texinfo netcat procps socat zlib1g-dev lib{ssl,lzo2,lz4,ncurses,readline}-dev
126 DEBIAN_FRONTEND: noninteractive
127 if: startsWith(matrix.os, 'debian') || startsWith(matrix.os, 'ubuntu')
129 - name: Install deps (RHEL)
132 if type dnf 2>/dev/null; then
133 dnf install -y 'dnf-command(config-manager)'
134 dnf config-manager --enable powertools
136 yum install -y epel-release
137 yum install -y git binutils make autoconf automake gcc diffutils \
138 texinfo netcat procps socat {lzo,zlib,lz4,ncurses,readline}-devel
139 yum install -y openssl11-devel || yum install -y openssl-devel
140 if: startsWith(matrix.os, 'centos') || startsWith(matrix.os, 'alma')
142 - name: Install deps (SUSE)
145 zypper install -y tar git binutils make autoconf automake gcc procps
146 makeinfo diffutils gzip socat {openssl,zlib,lzo,liblz4,ncurses,readline}-devel
147 if: startsWith(matrix.os, 'opensuse')
149 - name: Checkout code
150 uses: actions/checkout@v2
154 - name: Assign name for test results artifact
155 run: echo TEST_ARTIFACT="$(echo '${{ matrix.os }}' | sed 's|[:/]|_|g')" >>"$GITHUB_ENV"
157 - name: Run tests with default settings
158 run: sh .github/workflows/test/run.sh default
160 - name: Run tests without legacy protocol
161 run: sh .github/workflows/test/run.sh nolegacy
163 - name: Upload test results
164 uses: actions/upload-artifact@v2
166 name: tests_${{ env.TEST_ARTIFACT }}
167 path: /tmp/tests.*.tar.gz
171 if: startsWith(github.ref, 'refs/tags/release-')
176 os: [ubuntu-18.04, ubuntu-20.04]
178 runs-on: ${{ matrix.os }}
182 - name: Checkout code
183 uses: actions/checkout@v2
187 - name: Install build deps
189 sudo apt-get install -y --no-install-{recommends,suggests}
201 - name: Configure project
204 - name: Prepare debian directory
205 run: bash .github/workflows/deb/prepare.sh
207 JOB_DISTRIBUTION: ${{ matrix.os }}
209 - name: Build deb package
211 dpkg-buildpackage -d -us -uc
214 - name: Upload packages
215 uses: actions/upload-artifact@v2
217 name: deb-${{ matrix.os }}
225 os: [ubuntu-18.04, ubuntu-20.04]
227 runs-on: ${{ matrix.os }}
231 - name: Download built packages
232 uses: actions/download-artifact@v2
234 name: deb-${{ matrix.os }}
236 - name: Install package
237 run: sudo apt-get install -y ./*.deb
239 - name: Prepare tinc configs
242 sudo mkdir -p /etc/tinc/test/hosts
243 sudo tinc -b -n test generate-ed25519-keys
244 echo "Name test" | sudo tee /etc/tinc/test/tinc.conf
246 - name: Enable and start tincd
248 sudo systemctl start tinc@test
249 sudo tinc -n test dump reachable nodes
251 - name: Publish deb package
252 uses: softprops/action-gh-release@v1
256 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
259 runs-on: macos-latest
265 legacy_protocol: ["", --disable-legacy-protocol]
268 - name: Checkout code
269 uses: actions/checkout@v2
273 - name: Install build deps
274 run: brew install coreutils netcat automake lzo lz4 miniupnpc
276 - name: Configure project
279 ./configure --with-openssl=/usr/local/opt/openssl@1.1 --enable-{tunemu,miniupnpc} ${{ matrix.legacy_protocol }}
281 - name: Compile project
282 run: make -j$(sysctl -n hw.ncpu)
285 run: make check-recursive VERBOSE=1
287 - name: Archive test results
288 run: sudo tar -c -z -f test-results.tar.gz test/
291 - name: Upload test results
292 uses: actions/upload-artifact@v2
294 name: tests_${{ runner.os }}_${{ matrix.legacy_protocol }}
295 path: test-results.tar.gz
299 runs-on: windows-latest
305 legacy_protocol: ["", --disable-legacy-protocol]
308 - name: Checkout code
309 uses: actions/checkout@v2
313 - name: Install msys2
314 uses: msys2/setup-msys2@v2
317 # https://packages.msys2.org/package/
321 mingw-w64-x86_64-openssl
322 mingw-w64-x86_64-zlib
323 mingw-w64-x86_64-lzo2
325 mingw-w64-x86_64-ncurses
326 mingw-w64-x86_64-miniupnpc
331 - name: Configure project
335 ./configure --enable-miniupnpc --disable-readline --with-curses-include=/mingw64/include/ncurses ${{ matrix.legacy_protocol }}
337 - name: Compile project
343 run: make check-recursive VERBOSE=1
345 - name: Archive test results
347 run: tar -c -z -f test-results.tar.gz test/
350 - name: Upload test results
351 uses: actions/upload-artifact@v2
353 name: tests_${{ runner.os }}_${{ matrix.legacy_protocol }}
354 path: test-results.tar.gz