set -eux
+dir="$1"
+shift
+
flags=$(./.ci/conf.sh "$@")
# shellcheck disable=SC2086
-meson setup build $flags
+meson setup "$dir" $flags
-ninja -C build
+ninja -C "$dir"
--- /dev/null
+[host_machine]
+system = 'windows'
+cpu_family = 'aarch64'
+cpu = 'armv8'
+endian = 'little'
+
+[binaries]
+c = 'cl'
+cpp = 'cl'
+ar = 'lib'
+windres = 'rc'
apk upgrade
apk add \
- git binutils meson pkgconf gcc linux-headers diffutils \
- procps socat shadow sudo libgcrypt-dev texinfo gzip \
+ git binutils meson pkgconf gcc linux-headers shadow sudo libgcrypt-dev texinfo gzip \
openssl-dev zlib-dev lzo-dev ncurses-dev readline-dev musl-dev lz4-dev vde2-dev cmocka-dev
}
apt-get update
apt-get upgrade -y
- apt-get install -y git pkgconf diffutils sudo texinfo \
- netcat-openbsd procps socat
+ apt-get install -y git pkgconf sudo texinfo
HOST=${HOST:-}
if [ "$HOST" = mingw ]; then
yum upgrade -y
yum install -y \
- git binutils make meson pkgconf gcc diffutils sudo texinfo-tex netcat procps systemd perl-IPC-Cmd \
- findutils socat lzo-devel zlib-devel lz4-devel ncurses-devel readline-devel libgcrypt-devel "$@"
+ git binutils make meson pkgconf gcc sudo texinfo-tex systemd perl-IPC-Cmd \
+ lzo-devel zlib-devel lz4-devel ncurses-devel readline-devel libgcrypt-devel "$@"
if yum info openssl11-devel; then
yum install -y openssl11-devel
}
linux_openssl3() {
+ if [ -n "${SKIP_OPENSSL3:-}" ]; then
+ echo >&2 "skipping openssl3 installation in this job"
+ return
+ fi
+
src=/usr/local/src/openssl
ssl3=/opt/ssl3
}
deps_macos() {
- brew install coreutils netcat lzo lz4 miniupnpc libgcrypt openssl meson "$@"
- pip3 install --user compiledb
+ brew install lzo lz4 miniupnpc libgcrypt openssl meson "$@"
}
case "$(uname -s)" in
set -e
case "$1" in
- upgrade)
- if dpkg --compare-versions "$2" '<<' "1.1~pre11-1"; then
- if [ -f "$NETSFILE" ]; then
- echo -n "Creating systemd service instances from nets.boot:"
- mkdir -p "$WANTS"
- egrep '^[ ]*[a-zA-Z0-9_-]+' $NETSFILE | while read net args; do
- echo -n " $net"
- ln -s "$SYSTEM/tinc@.service" "$WANTS/tinc@$net.service" 2>/dev/null || true
- done
- echo "."
- fi
- fi
- ;;
+upgrade)
+ if dpkg --compare-versions "$2" '<<' "1.1~pre11-1"; then
+ if [ -f "$NETSFILE" ]; then
+ echo -n "Creating systemd service instances from nets.boot:"
+ mkdir -p "$WANTS"
+ egrep '^[ ]*[a-zA-Z0-9_-]+' $NETSFILE | while read net args; do
+ echo -n " $net"
+ ln -s "$SYSTEM/tinc@.service" "$WANTS/tinc@$net.service" 2>/dev/null || true
+ done
+ echo "."
+ fi
+ fi
+ ;;
+
+*) ;;
- *)
- ;;
esac
#DEBHELPER#
sudo pkill -KILL -x "$name" || true
done
- sudo git clean -dfx
sudo chown -R "${USER:-$(whoami)}" .
mkdir -p sanitizer /tmp/logs
header "Running test flavor $flavor"
- ./.ci/build.sh "$@"
+ ./.ci/build.sh "$flavor" "$@"
if [ "${HOST:-}" = mingw ]; then
echo >&2 "Integration tests cannot run under wine, skipping"
return 0
fi
+ if [ -n "${HOST:-}" ]; then
+ echo >&2 "Using higher test timeout for cross-compilation job $HOST"
+ timeout=10
+ else
+ timeout=1
+ fi
+
code=0
- meson test -C build --verbose || code=$?
+ meson test -C "$flavor" --timeout-multiplier $timeout --verbose || code=$?
- sudo tar -c -z -f "/tmp/logs/tests.$flavor.tar.gz" build/ sanitizer/
+ sudo tar -c -z -f "/tmp/logs/tests.$flavor.tar.gz" "$flavor" sanitizer/ || true
return $code
}
set -eu
-./.ci/build.sh "$@"
+./.ci/build.sh build "$@"
# Which paths to ignore.
paths='src/solaris src/windows src/gcrypt'
check_warnings() {
git clean -dfx
- ./.ci/build.sh -Dwerror=true "$@" || result=$?
+ ./.ci/build.sh build -Dwerror=true "$@" || result=$?
}
check_warnings
set crypto=%1
set builddir=%crypto%
+set args=
+set crossfile=.ci\cross\msvc\%HOST_ARCH%
+
+if exist %crossfile% (
+ set args=--cross-file %crossfile%
+)
echo configure build directory
-meson setup %builddir% -Dbuildtype=release -Dcrypto=%crypto% || exit 1
+meson setup %builddir% -Dbuildtype=release -Dcrypto=%crypto% %args% || exit 1
echo build project
meson compile -C %builddir% || exit 1
set builddir=%1
-set data=%builddir%\test-data
-set tinc=%builddir%\src\tinc
-set tincd=%tinc%d
-mkdir %data% || exit 1
+REM Windows jobs on GitHub CI sometimes show surprisingly poor performance
+REM (building tinc with default flags can take from 3 to upwards of 20+
+REM minutes, depending on which machine you happened to land on), so timeout
+REM is set a bit higher here.
-echo can tinc run at all?
-%tinc% --version || exit 1
-
-echo try to initialize a node
-%tinc% -c %data% -b init foo || exit 1
-
-echo try to generate EC keys
-%tinc% -c %data% -b generate-ed25519-keys || exit 1
-
-echo can tincd run?
-%tincd% --version || exit 1
-
-echo bail out if we're missing support for the legacy protocol
-%tinc% --version | findstr legacy_protocol || exit 0
-
-echo try to generate RSA keys
-%tinc% -c %data% -b generate-keys || exit 1
+meson test -C %builddir% --timeout-multiplier 2 --verbose || exit 1
tar -C ~ --strip-components=1 --wildcards -xf ./shellcheck-*.tar.xz 'shellcheck-*/shellcheck'
curl -o ~/shfmt -L "https://github.com/mvdan/sh/releases/download/v$SHFMT/shfmt_v${SHFMT}_linux_amd64"
chmod 755 ~/shfmt ~/shellcheck
- pip3 install --user compiledb
+ python3 -m venv /tmp/venv
+ . /tmp/venv/bin/activate
+ pip3 install black pylint mypy
env:
CLANG: 11
SHELLCHECK: 0.7.2
SHFMT: 3.3.0
- name: Install deps
- run: sudo sh .ci/deps.sh
-
- - name: Run clang-tidy
- run: sh .ci/tidy/run.sh
- if: always()
-
- - name: Check code formatting
- run: "! astyle --exclude=build -r --options=.astylerc --dry-run --formatted '*.c' '*.h' | grep '^Formatted'"
- if: always()
-
- - name: Check scripts formatting
- run: find -type f -regextype egrep -regex '.+\.(sh|sh\.in|test)$' -exec ~/shfmt -d -i 2 -s '{}' +
- if: always()
+ run: sudo SKIP_OPENSSL3=1 sh .ci/deps.sh
- - name: Run static analysis on scripts
- run: find -type f -regextype egrep -regex '.+\.sh(\.in)?$' -exec shellcheck -x '{}' +
+ - name: Lint/typecheck/check formatting on C/shell/Python code
+ run: |
+ . /tmp/venv/bin/activate
+ PATH=$PATH:$HOME ./lint.py
if: always()
- - name: Run static analysis on tests
- run: find -type f -name '*.test' -execdir shellcheck -x '{}' +
+ - name: Run clang-tidy
+ run: sh .ci/tidy/run.sh
if: always()
- name: Check warnings (gcc)
strategy:
fail-fast: false
matrix:
- arch:
- - amd64
- - amd64_x86
+ target:
+ - { build: amd64, host: amd64, test: test }
+ - { build: amd64, host: x86, test: test }
+ - { build: amd64, host: arm64, test: notest }
+
+ env:
+ HOST_ARCH: ${{ matrix.target.host }}
+ BUILD_ARCH: ${{ matrix.target.build }}
steps:
- name: Install meson
- name: Activate dev environment
uses: ilammy/msvc-dev-cmd@v1
with:
- arch: ${{ matrix.arch }}
+ arch: ${{ matrix.target.build == matrix.target.host && matrix.target.host || format('{0}_{1}', matrix.target.build, matrix.target.host) }}
- name: Build (nolegacy)
run: .ci\windows\build.cmd nolegacy
- name: Test (nolegacy)
run: .ci\windows\test.cmd nolegacy
- if: always()
+ if: always() && matrix.target.test == 'test'
- name: Build (OpenSSL)
run: .ci\windows\build.cmd openssl
- name: Test (OpenSSL)
run: .ci\windows\test.cmd openssl
- if: always()
+ if: always() && matrix.target.test == 'test'