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
113 - name: Install deps (Alpine)
115 apk add git binutils make autoconf automake gcc linux-headers libtool
116 diffutils texinfo procps openssl-dev zlib-dev lzo-dev ncurses-dev
117 readline-dev musl-dev lz4-dev socat shadow sudo
118 if: startsWith(matrix.os, 'alpine')
120 - name: Install deps (Debian and Ubuntu)
124 apt-get install -y git binutils make autoconf automake gcc diffutils sudo \
125 texinfo netcat procps socat zlib1g-dev lib{ssl,lzo2,lz4,ncurses,readline}-dev
127 DEBIAN_FRONTEND: noninteractive
128 if: startsWith(matrix.os, 'debian') || startsWith(matrix.os, 'ubuntu')
130 - name: Install deps (RHEL)
133 if type dnf 2>/dev/null; then
134 dnf install -y 'dnf-command(config-manager)'
135 dnf config-manager --enable powertools
137 yum install -y epel-release
138 yum install -y git binutils make autoconf automake gcc diffutils sudo \
139 texinfo netcat procps socat {lzo,zlib,lz4,ncurses,readline}-devel
140 yum install -y openssl11-devel || yum install -y openssl-devel
141 if: startsWith(matrix.os, 'centos') || startsWith(matrix.os, 'alma')
143 - name: Install deps (SUSE)
146 zypper install -y tar git binutils make autoconf automake gcc procps sudo
147 makeinfo diffutils gzip socat {openssl,zlib,lzo,liblz4,ncurses,readline}-devel
148 if: startsWith(matrix.os, 'opensuse')
150 - name: Checkout code
151 uses: actions/checkout@v2
155 - name: Assign name for test results artifact
156 run: echo TEST_ARTIFACT="$(echo '${{ matrix.os }}' | sed 's|[:/]|_|g')" >>"$GITHUB_ENV"
158 - name: Create a non-privileged user
160 useradd --user-group build
161 chown -R build:build .
162 echo 'build ALL=(ALL) NOPASSWD: ALL' >/etc/sudoers.d/build
164 - name: Run tests with default settings
165 run: sudo -u build CI=1 sh .github/workflows/test/run.sh default
167 - name: Run tests without legacy protocol
168 run: sudo -u build CI=1 sh .github/workflows/test/run.sh nolegacy
170 - name: Upload test results
171 uses: actions/upload-artifact@v2
173 name: tests_${{ env.TEST_ARTIFACT }}
174 path: /tmp/tests.*.tar.gz
178 if: startsWith(github.ref, 'refs/tags/release-')
183 os: [ubuntu-18.04, ubuntu-20.04]
185 runs-on: ${{ matrix.os }}
189 - name: Checkout code
190 uses: actions/checkout@v2
194 - name: Install build deps
196 sudo apt-get install -y --no-install-{recommends,suggests}
208 - name: Configure project
211 - name: Prepare debian directory
212 run: bash .github/workflows/deb/prepare.sh
214 JOB_DISTRIBUTION: ${{ matrix.os }}
216 - name: Build deb package
218 dpkg-buildpackage -d -us -uc
221 - name: Upload packages
222 uses: actions/upload-artifact@v2
224 name: deb-${{ matrix.os }}
232 os: [ubuntu-18.04, ubuntu-20.04]
234 runs-on: ${{ matrix.os }}
238 - name: Download built packages
239 uses: actions/download-artifact@v2
241 name: deb-${{ matrix.os }}
243 - name: Install package
244 run: sudo apt-get install -y ./*.deb
246 - name: Prepare tinc configs
249 sudo mkdir -p /etc/tinc/test/hosts
250 sudo tinc -b -n test generate-ed25519-keys
251 echo "Name test" | sudo tee /etc/tinc/test/tinc.conf
253 - name: Enable and start tincd
255 sudo systemctl start tinc@test
256 sudo tinc -n test dump reachable nodes
258 - name: Publish deb package
259 uses: softprops/action-gh-release@v1
263 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
266 runs-on: macos-latest
272 legacy_protocol: ["", --disable-legacy-protocol]
275 - name: Checkout code
276 uses: actions/checkout@v2
280 - name: Install build deps
281 run: brew install coreutils netcat automake lzo lz4 miniupnpc
283 - name: Configure project
286 ./configure --with-openssl=/usr/local/opt/openssl@1.1 --enable-{tunemu,miniupnpc} ${{ matrix.legacy_protocol }}
288 - name: Compile project
289 run: make -j$(sysctl -n hw.ncpu)
292 run: make check-recursive VERBOSE=1
294 - name: Archive test results
295 run: sudo tar -c -z -f test-results.tar.gz test/
298 - name: Upload test results
299 uses: actions/upload-artifact@v2
301 name: tests_${{ runner.os }}_${{ matrix.legacy_protocol }}
302 path: test-results.tar.gz
306 runs-on: windows-latest
312 legacy_protocol: ["", --disable-legacy-protocol]
315 - name: Checkout code
316 uses: actions/checkout@v2
320 - name: Install msys2
321 uses: msys2/setup-msys2@v2
324 # https://packages.msys2.org/package/
328 mingw-w64-x86_64-openssl
329 mingw-w64-x86_64-zlib
330 mingw-w64-x86_64-lzo2
332 mingw-w64-x86_64-ncurses
333 mingw-w64-x86_64-miniupnpc
338 - name: Configure project
342 ./configure --enable-miniupnpc --disable-readline --with-curses-include=/mingw64/include/ncurses ${{ matrix.legacy_protocol }}
344 - name: Compile project
350 run: make check-recursive VERBOSE=1
352 - name: Archive test results
354 run: tar -c -z -f test-results.tar.gz test/
357 - name: Upload test results
358 uses: actions/upload-artifact@v2
360 name: tests_${{ runner.os }}_${{ matrix.legacy_protocol }}
361 path: test-results.tar.gz