image: debian:stable-slim stages: - build - test before_script: - test ! -r /etc/debian_version || apt-get -qq update - test ! -r /etc/debian_version || apt-get install -y git debhelper dpkg-dev build-essential fakeroot flawfinder wget unzip - test ! -r /etc/debian_version || apt-get install -y libpcap-dev libselinux1-dev - test ! -r /etc/debian_version || apt-get install -y binutils-mingw-w64-i686 gcc-mingw-w64 mingw-w64-i686-dev binutils-mingw-w64-x86-64 mingw-w64-x86-64-dev mingw-w64-common clang - test ! -r /etc/debian_version || apt-get install -y valgrind sudo netcat-openbsd - test ! -r /etc/debian_version || apt-get install -y autoconf automake dh-autoreconf - test ! -r /etc/arch-release || pacman -Syu --noconfirm - test ! -r /etc/arch-release || pacman -S --noconfirm binutils gcc base-devel git - test ! -r /etc/arch-release || pacman -S --noconfirm valgrind sudo - mkdir -p ./deploy/gcc ./deploy/i686-w64-mingw32-winpcap ./deploy/i686-w64-mingw32-npcap ./deploy/clang ./deploy/android28-clang build: script: - autoreconf -fi - ./configure --enable-option-checking=fatal --prefix=/ - mv config.log deploy/config-default.log - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/gcc)" V=s - make dist - cp ptunnel-ng-*.tar.gz ./deploy/ stage: build artifacts: paths: - deploy/ when: always build-sanitizer-asserts: script: - autoreconf -fi - ./configure --enable-option-checking=fatal --prefix=/ --enable-sanitizer --enable-asserts - mv config.log deploy/config-sanitizer-assert.log - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/gcc-sanitizer-asserts)" V=s stage: build artifacts: paths: - deploy/ when: always build-debian: script: - dpkg-buildpackage -b -us -uc - mv config.log deploy/config-debian.log - ls -alh .. - mkdir -p deploy/debian - mv -v ../ptunnel-ng-dbgsym_* ../ptunnel-ng_* deploy/debian/ stage: build artifacts: paths: - deploy/ when: always build-archlinux: image: archlinux:latest script: - useradd builduser -m - passwd -d builduser - chown -R builduser . - su -m builduser bash -c 'makepkg' - su -m builduser bash -c 'makepkg -p PKGBUILD.dev --skipchecksums' - ls -alh . - mkdir deploy/archlinux - mv -v ptunnel-ng-*.tar.xz deploy/archlinux/ stage: build artifacts: paths: - deploy/ when: always build-mingw: script: # print mingw-gcc versions and check if the required define is set - i686-w64-mingw32-gcc --version - i686-w64-mingw32-gcc -dM -E - < /dev/null | grep -E '^#define WIN32 1$' - x86_64-w64-mingw32-gcc --version - x86_64-w64-mingw32-gcc -dM -E - < /dev/null | grep -E '^#define WIN32 1$' # the actual build - autoreconf -fi # i686-w64-mingw32 - ./configure --enable-option-checking=fatal --prefix=/ --host=i686-w64-mingw32 - mv config.log deploy/config-mingw-i686.log - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/i686-w64-mingw32-winpcap)" V=s - make clean - ./configure --enable-option-checking=fatal --prefix=/ --host=i686-w64-mingw32 --enable-npcap - mv config.log deploy/config-mingw-i686-npcap.log - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/i686-w64-mingw32-npcap)" V=s - make clean # x86-64-w64-mingw32 - ./configure --enable-option-checking=fatal --prefix=/ --host=x86_64-w64-mingw32 - mv config.log deploy/config-mingw-x86_64.log - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/x86_64-w64-mingw32-winpcap)" V=s - make clean - ./configure --enable-option-checking=fatal --prefix=/ --host=x86_64-w64-mingw32 --enable-npcap - mv config.log deploy/config-mingw-x86_64-npcap.log - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/x86_64-w64-mingw32-npcap)" V=s - make clean stage: build artifacts: paths: - deploy/ when: always build-clang: script: - autoreconf -fi - CC=clang ./configure --enable-option-checking=fatal --prefix=/ - mv config.log deploy/config-clang.log - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/clang)" V=s stage: build artifacts: paths: - deploy/ when: always build-android: cache: key: toolchain-cache paths: - vendor/ script: - mkdir -p vendor && cd vendor - test -r 'android-ndk-r19-linux-x86_64.zip' || wget --progress=dot:mega 'https://dl.google.com/android/repository/android-ndk-r19-linux-x86_64.zip' - test -d 'android-ndk-r19' || unzip -q 'android-ndk-r19-linux-x86_64.zip' - cd .. - autoreconf -fi - CC=aarch64-linux-android28-clang PATH="${PATH}:$(realpath ./vendor/android-ndk-r19/toolchains/llvm/prebuilt/linux-x86_64/bin)" ./configure --enable-option-checking=fatal --host=aarch64-linux-android - mv config.log deploy/config-aarch64-linux-android28-clang.log - PATH="${PATH}:$(realpath ./vendor/android-ndk-r19/toolchains/llvm/prebuilt/linux-x86_64/bin)" make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/android28-clang)" V=s stage: build artifacts: paths: - deploy/ when: always test-valgrind: script: - ls -alhR . - deploy/gcc/bin/ptunnel-ng --help - PTUNNEL_BIN="deploy/gcc/bin/ptunnel-ng" test/integration_test.sh - mv /tmp/ptunnel-client.log ptunnel-client-valgrind.log - mv /tmp/ptunnel-server.log ptunnel-server-valgrind.log stage: test artifacts: paths: - deploy/ - ptunnel-client-valgrind.log - ptunnel-server-valgrind.log when: always test-asan: script: - ls -alhR . - deploy/gcc-sanitizer-asserts/bin/ptunnel-ng --help - export DISABLE_VALGRIND=y && export PTUNNEL_BIN="deploy/gcc-sanitizer-asserts/bin/ptunnel-ng" && test/integration_test.sh - mv /tmp/ptunnel-client.log ptunnel-client-sanitizer.log - mv /tmp/ptunnel-server.log ptunnel-server-sanitizer.log - export DISABLE_VALGRIND=y && export PTUNNEL_BIN="deploy/gcc-sanitizer-asserts/bin/ptunnel-ng" && export PTUNNEL_ARGS="--passwd=ci" && test/integration_test.sh - mv /tmp/ptunnel-client.log ptunnel-client-sanitizer-passwd.log - mv /tmp/ptunnel-server.log ptunnel-server-sanitizer-passwd.log stage: test artifacts: paths: - deploy/ - ptunnel-client-sanitizer.log - ptunnel-server-sanitizer.log - ptunnel-client-sanitizer-passwd.log - ptunnel-server-sanitizer-passwd.log when: always