.gitlab-ci.yml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. image: debian:stable-slim
  2. stages:
  3. - build
  4. - test
  5. before_script:
  6. - test ! -r /etc/debian_version || apt-get -qq update
  7. - test ! -r /etc/debian_version || apt-get install -y git debhelper dpkg-dev build-essential fakeroot flawfinder wget unzip
  8. - test ! -r /etc/debian_version || apt-get install -y libpcap-dev libselinux1-dev
  9. - 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
  10. - test ! -r /etc/debian_version || apt-get install -y valgrind sudo netcat-openbsd
  11. - test ! -r /etc/debian_version || apt-get install -y autoconf automake dh-autoreconf
  12. - test ! -r /etc/arch-release || pacman -Syu --noconfirm
  13. - test ! -r /etc/arch-release || pacman -S --noconfirm binutils gcc base-devel git
  14. - test ! -r /etc/arch-release || pacman -S --noconfirm valgrind sudo
  15. - mkdir -p ./deploy/gcc ./deploy/i686-w64-mingw32-winpcap ./deploy/i686-w64-mingw32-npcap ./deploy/clang ./deploy/android28-clang
  16. build:
  17. script:
  18. - autoreconf -fi
  19. - ./configure --enable-option-checking=fatal --prefix=/
  20. - mv config.log deploy/config-default.log
  21. - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/gcc)" V=s
  22. - make dist
  23. - cp ptunnel-ng-*.tar.gz ./deploy/
  24. stage: build
  25. artifacts:
  26. paths:
  27. - deploy/
  28. when: always
  29. build-sanitizer-asserts:
  30. script:
  31. - autoreconf -fi
  32. - ./configure --enable-option-checking=fatal --prefix=/ --enable-sanitizer --enable-asserts
  33. - mv config.log deploy/config-sanitizer-assert.log
  34. - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/gcc-sanitizer-asserts)" V=s
  35. stage: build
  36. artifacts:
  37. paths:
  38. - deploy/
  39. when: always
  40. build-debian:
  41. script:
  42. - dpkg-buildpackage -b -us -uc
  43. - mv config.log deploy/config-debian.log
  44. - ls -alh ..
  45. - mkdir -p deploy/debian
  46. - mv -v ../ptunnel-ng-dbgsym_* ../ptunnel-ng_* deploy/debian/
  47. stage: build
  48. artifacts:
  49. paths:
  50. - deploy/
  51. when: always
  52. build-archlinux:
  53. image: archlinux/base
  54. script:
  55. - useradd builduser -m
  56. - passwd -d builduser
  57. - chown -R builduser .
  58. - su -m builduser bash -c 'makepkg'
  59. - su -m builduser bash -c 'makepkg -p PKGBUILD.dev --skipchecksums'
  60. - ls -alh .
  61. - mkdir deploy/archlinux
  62. - mv -v ptunnel-ng-*.pkg.tar.zst deploy/archlinux/
  63. stage: build
  64. artifacts:
  65. paths:
  66. - deploy/
  67. when: always
  68. build-mingw:
  69. script:
  70. # print mingw-gcc versions and check if the required define is set
  71. - i686-w64-mingw32-gcc --version
  72. - i686-w64-mingw32-gcc -dM -E - < /dev/null | grep -E '^#define WIN32 1$'
  73. - x86_64-w64-mingw32-gcc --version
  74. - x86_64-w64-mingw32-gcc -dM -E - < /dev/null | grep -E '^#define WIN32 1$'
  75. # the actual build
  76. - autoreconf -fi
  77. # i686-w64-mingw32
  78. - ./configure --enable-option-checking=fatal --prefix=/ --host=i686-w64-mingw32
  79. - mv config.log deploy/config-mingw-i686.log
  80. - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/i686-w64-mingw32-winpcap)" V=s
  81. - make clean
  82. - ./configure --enable-option-checking=fatal --prefix=/ --host=i686-w64-mingw32 --enable-npcap
  83. - mv config.log deploy/config-mingw-i686-npcap.log
  84. - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/i686-w64-mingw32-npcap)" V=s
  85. - make clean
  86. # x86-64-w64-mingw32
  87. - ./configure --enable-option-checking=fatal --prefix=/ --host=x86_64-w64-mingw32
  88. - mv config.log deploy/config-mingw-x86_64.log
  89. - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/x86_64-w64-mingw32-winpcap)" V=s
  90. - make clean
  91. - ./configure --enable-option-checking=fatal --prefix=/ --host=x86_64-w64-mingw32 --enable-npcap
  92. - mv config.log deploy/config-mingw-x86_64-npcap.log
  93. - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/x86_64-w64-mingw32-npcap)" V=s
  94. - make clean
  95. stage: build
  96. artifacts:
  97. paths:
  98. - deploy/
  99. when: always
  100. build-clang:
  101. script:
  102. - autoreconf -fi
  103. - CC=clang ./configure --enable-option-checking=fatal --prefix=/
  104. - mv config.log deploy/config-clang.log
  105. - make install CFLAGS='-Werror' DESTDIR="$(realpath ./deploy/clang)" V=s
  106. stage: build
  107. artifacts:
  108. paths:
  109. - deploy/
  110. when: always
  111. build-android:
  112. cache:
  113. key: toolchain-cache
  114. paths:
  115. - vendor/
  116. script:
  117. - mkdir -p vendor && cd vendor
  118. - 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'
  119. - test -d 'android-ndk-r19' || unzip -q 'android-ndk-r19-linux-x86_64.zip'
  120. - cd ..
  121. - autoreconf -fi
  122. - 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
  123. - mv config.log deploy/config-aarch64-linux-android28-clang.log
  124. - 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
  125. stage: build
  126. artifacts:
  127. paths:
  128. - deploy/
  129. when: always
  130. test-valgrind:
  131. script:
  132. - ls -alhR .
  133. - deploy/gcc/bin/ptunnel-ng --help
  134. - PTUNNEL_BIN="deploy/gcc/bin/ptunnel-ng" test/integration_test.sh
  135. - mv /tmp/ptunnel-client.log ptunnel-client-valgrind.log
  136. - mv /tmp/ptunnel-server.log ptunnel-server-valgrind.log
  137. stage: test
  138. artifacts:
  139. paths:
  140. - deploy/
  141. - ptunnel-client-valgrind.log
  142. - ptunnel-server-valgrind.log
  143. when: always
  144. test-asan:
  145. script:
  146. - ls -alhR .
  147. - deploy/gcc-sanitizer-asserts/bin/ptunnel-ng --help
  148. - export DISABLE_VALGRIND=y && export PTUNNEL_BIN="deploy/gcc-sanitizer-asserts/bin/ptunnel-ng" && test/integration_test.sh
  149. - mv /tmp/ptunnel-client.log ptunnel-client-sanitizer.log
  150. - mv /tmp/ptunnel-server.log ptunnel-server-sanitizer.log
  151. - export DISABLE_VALGRIND=y && export PTUNNEL_BIN="deploy/gcc-sanitizer-asserts/bin/ptunnel-ng" && export PTUNNEL_ARGS="--passwd=ci" && test/integration_test.sh
  152. - mv /tmp/ptunnel-client.log ptunnel-client-sanitizer-passwd.log
  153. - mv /tmp/ptunnel-server.log ptunnel-server-sanitizer-passwd.log
  154. stage: test
  155. artifacts:
  156. paths:
  157. - deploy/
  158. - ptunnel-client-sanitizer.log
  159. - ptunnel-server-sanitizer.log
  160. - ptunnel-client-sanitizer-passwd.log
  161. - ptunnel-server-sanitizer-passwd.log
  162. when: always