From 1287fc13ccdf96cd18a391d53ce9b47c29b198e2 Mon Sep 17 00:00:00 2001 From: Kirill Isakov Date: Sun, 29 May 2022 01:20:23 +0600 Subject: [PATCH] CI: add checks for basic compatibility with muon --- .ci/deps.sh | 29 +++++++++++++++---- .ci/muon/run.sh | 58 ++++++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 18 ++++++++++++ 3 files changed, 100 insertions(+), 5 deletions(-) create mode 100755 .ci/muon/run.sh diff --git a/.ci/deps.sh b/.ci/deps.sh index 1c8293a7..e297fb13 100755 --- a/.ci/deps.sh +++ b/.ci/deps.sh @@ -2,12 +2,19 @@ set -eu +SKIP_OPENSSL3="${SKIP_OPENSSL3:-}" +SKIP_MESON="${SKIP_MESON:-}" + deps_linux_alpine() { apk upgrade apk add \ - git binutils meson pkgconf gcc linux-headers shadow sudo libgcrypt-dev texinfo gzip \ + git binutils ninja 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 + + if [ -z "$SKIP_MESON" ]; then + apk add meson + fi } deps_linux_debian_mingw() { @@ -51,7 +58,7 @@ deps_linux_debian() { apt-get update apt-get upgrade -y - apt-get install -y git pkgconf sudo texinfo + apt-get install -y git pkgconf sudo texinfo ninja-build HOST=${HOST:-} if [ "$HOST" = mingw ]; then @@ -60,6 +67,10 @@ deps_linux_debian() { deps_linux_debian_linux "$@" fi + if [ -n "$SKIP_MESON" ]; then + return + fi + . /etc/os-release # Debian Buster ships an old version of meson (0.49). @@ -87,9 +98,13 @@ deps_linux_rhel() { fi yum install -y \ - git binutils make meson pkgconf gcc sudo texinfo-tex systemd perl-IPC-Cmd \ + git binutils make ninja-build pkgconf gcc sudo texinfo-tex systemd perl-IPC-Cmd \ lzo-devel zlib-devel lz4-devel ncurses-devel readline-devel libgcrypt-devel "$@" + if [ -z "$SKIP_MESON" ]; then + yum install -y meson + fi + if yum info openssl11-devel; then yum install -y openssl11-devel else @@ -102,7 +117,7 @@ deps_linux_rhel() { } linux_openssl3() { - if [ -n "${SKIP_OPENSSL3:-}" ]; then + if [ -n "$SKIP_OPENSSL3" ]; then echo >&2 "skipping openssl3 installation in this job" return fi @@ -158,7 +173,11 @@ deps_linux() { } deps_macos() { - brew install lzo lz4 miniupnpc libgcrypt openssl meson "$@" + brew install lzo lz4 miniupnpc libgcrypt openssl "$@" + + if [ -z "$SKIP_MESON" ]; then + brew install meson + fi } case "$(uname -s)" in diff --git a/.ci/muon/run.sh b/.ci/muon/run.sh new file mode 100755 index 00000000..bba42cf7 --- /dev/null +++ b/.ci/muon/run.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Fetch and build +# muon (a C reimplementation of the meson build system), +# samurai (a C reimplementation of the ninja build tool), +# and then use both to build tinc. + +set -euo pipefail + +git_samurai=https://github.com/michaelforney/samurai +git_muon=https://git.sr.ht/~lattis/muon +prefix=/opt/tinc_muon + +header() { + echo >&2 '################################################################################' + echo >&2 "# $*" + echo >&2 '################################################################################' +} + +header 'Try to make sure Python is missing' +python --version && exit 1 +python3 --version && exit 1 + +header 'Fetch and build samurai' + +git clone --depth=1 $git_samurai ~/samurai +pushd ~/samurai +make -j"$(nproc)" +make install +popd + +header 'Fetch and build muon' + +git clone --depth=1 $git_muon ~/muon +pushd ~/muon +./bootstrap.sh build +./build/muon setup build +samu -C build +./build/muon -C build install +popd + +header 'Setup build directory' +muon setup -D prefix=$prefix -D systemd=disabled build_muon +samu -C build_muon + +header 'Install tinc' +muon -C build_muon install + +header 'Run smoke tests' +$prefix/sbin/tinc --version +$prefix/sbin/tincd --version +$prefix/sbin/tinc -c /tmp/muon_node <