nghttp2/.github/workflows/build.yml

289 lines
10 KiB
YAML
Raw Normal View History

2020-11-16 09:48:31 +01:00
name: build
2022-04-25 15:54:18 +02:00
on: [push, pull_request]
2020-11-16 09:48:31 +01:00
jobs:
build:
strategy:
matrix:
2022-05-22 04:23:40 +02:00
os: [ubuntu-22.04, macos-11]
2020-11-16 09:48:31 +01:00
compiler: [gcc, clang]
buildtool: [autotools, cmake]
2021-08-22 14:31:16 +02:00
http3: [http3, no-http3]
2022-06-23 11:47:10 +02:00
openssl: [openssl1, openssl3, boringssl]
2021-09-08 16:23:17 +02:00
exclude:
2022-04-03 14:56:47 +02:00
- os: macos-11
2021-09-08 16:23:17 +02:00
openssl: openssl3
- http3: no-http3
openssl: openssl3
2022-04-03 14:56:47 +02:00
- os: macos-11
compiler: gcc
- # disable macos cmake because of include path issue
os: macos-11
buildtool: cmake
2022-06-23 11:47:10 +02:00
- os: macos-11
openssl: boringssl
- openssl: boringssl
buildtool: cmake
- openssl: boringssl
compiler: gcc
2020-11-16 09:48:31 +01:00
2022-05-22 05:22:32 +02:00
runs-on: ${{ matrix.os }}
2020-11-16 09:48:31 +01:00
steps:
2022-05-15 08:39:03 +02:00
- uses: actions/checkout@v3
2020-11-16 09:48:31 +01:00
- name: Linux setup
if: runner.os == 'Linux'
run: |
sudo apt-get install \
2022-05-22 04:23:40 +02:00
g++-11 \
clang-12 \
2020-11-16 09:48:31 +01:00
autoconf \
automake \
autotools-dev \
libtool \
pkg-config \
zlib1g-dev \
libcunit1-dev \
libssl-dev \
libxml2-dev \
libev-dev \
libevent-dev \
libjansson-dev \
libjemalloc-dev \
libc-ares-dev \
2021-08-29 12:10:49 +02:00
libelf-dev \
2020-11-16 09:48:31 +01:00
cmake \
cmake-data
2021-01-17 09:41:01 +01:00
echo 'CPPFLAGS=-fsanitize=address,undefined -fno-sanitize-recover=undefined -g' >> $GITHUB_ENV
echo 'LDFLAGS=-fsanitize=address,undefined -fno-sanitize-recover=undefined' >> $GITHUB_ENV
2020-11-16 09:48:31 +01:00
- name: MacOS setup
if: runner.os == 'macOS'
run: |
brew install \
libev \
libevent \
c-ares \
cunit \
libressl \
autoconf \
automake \
pkg-config \
libtool
echo 'PKG_CONFIG_PATH=/usr/local/opt/libressl/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig' >> $GITHUB_ENV
- name: Setup clang (Linux)
if: runner.os == 'Linux' && matrix.compiler == 'clang'
run: |
2022-05-22 04:23:40 +02:00
echo 'CC=clang-12' >> $GITHUB_ENV
echo 'CXX=clang++-12' >> $GITHUB_ENV
2020-11-16 09:48:31 +01:00
- name: Setup clang (MacOS)
if: runner.os == 'macOS' && matrix.compiler == 'clang'
run: |
echo 'CC=clang' >> $GITHUB_ENV
echo 'CXX=clang++' >> $GITHUB_ENV
- name: Setup gcc (Linux)
if: runner.os == 'Linux' && matrix.compiler == 'gcc'
run: |
2022-05-22 04:23:40 +02:00
echo 'CC=gcc-11' >> $GITHUB_ENV
echo 'CXX=g++-11' >> $GITHUB_ENV
2020-11-16 09:48:31 +01:00
- name: Setup gcc (MacOS)
if: runner.os == 'macOS' && matrix.compiler == 'gcc'
run: |
echo 'CC=gcc' >> $GITHUB_ENV
echo 'CXX=g++' >> $GITHUB_ENV
2021-08-29 12:10:49 +02:00
- name: Build libbpf
if: matrix.http3 == 'http3' && matrix.compiler == 'clang' && runner.os == 'Linux'
run: |
2022-06-21 14:31:37 +02:00
git clone -b v0.8.0 https://github.com/libbpf/libbpf
2021-08-29 12:10:49 +02:00
cd libbpf
2021-09-17 16:57:26 +02:00
PREFIX=$PWD/build make -C src install
2021-08-29 12:10:49 +02:00
EXTRA_AUTOTOOLS_OPTS="--with-libbpf"
2021-11-16 14:09:48 +01:00
EXTRA_CMAKE_OPTS="-DWITH_LIBBPF=1"
2021-08-29 12:10:49 +02:00
echo 'EXTRA_AUTOTOOLS_OPTS='"$EXTRA_AUTOTOOLS_OPTS" >> $GITHUB_ENV
2021-11-16 14:09:48 +01:00
echo 'EXTRA_CMAKE_OPTS='"$EXTRA_CMAKE_OPTS" >> $GITHUB_ENV
2021-09-08 16:23:17 +02:00
- name: Build quictls/openssl v1.1.1
if: matrix.http3 == 'http3' && matrix.openssl == 'openssl1'
2021-08-22 14:31:16 +02:00
run: |
2022-06-22 17:28:32 +02:00
git clone --depth 1 -b OpenSSL_1_1_1p+quic https://github.com/quictls/openssl
2021-08-22 14:31:16 +02:00
cd openssl
2022-05-08 04:08:05 +02:00
./config --prefix=$PWD/build
2022-05-15 10:36:53 +02:00
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
2021-08-22 14:31:16 +02:00
make install_sw
2021-12-19 12:43:38 +01:00
- name: Build quictls/openssl v3.0.x
2021-09-08 16:23:17 +02:00
if: matrix.http3 == 'http3' && matrix.openssl == 'openssl3'
run: |
unset CPPFLAGS
unset LDFLAGS
2022-06-22 17:28:32 +02:00
git clone --depth 1 -b openssl-3.0.4+quic https://github.com/quictls/openssl
2021-09-08 16:23:17 +02:00
cd openssl
2022-05-08 04:08:05 +02:00
./config enable-ktls --prefix=$PWD/build --libdir=$PWD/build/lib
2022-05-15 10:36:53 +02:00
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
2021-09-08 16:23:17 +02:00
make install_sw
2022-06-23 11:47:10 +02:00
- name: Build BoringSSL
if: matrix.openssl == 'boringssl'
run: |
git clone https://boringssl.googlesource.com/boringssl
cd boringssl
git checkout 27ffcc6e19bbafddf1b59ec0bc6df2904de7eb2c
mkdir build
cd build
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON ..
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
cd ..
OPENSSL_CFLAGS="-I$PWD/include/"
OPENSSL_LIBS="-L$PWD/build/ssl -lssl -L$PWD/build/crypto -lcrypto -pthread"
EXTRA_NGTCP2_OPTS="$EXTRA_NGTCP2_OPTS --without-openssl --with-boringssl"
EXTRA_AUTOTOOLS_OPTS="$EXTRA_AUTOTOOLS_OPTS --without-neverbleed --without-jemalloc"
echo 'OPENSSL_CFLAGS='"$OPENSSL_CFLAGS" >> $GITHUB_ENV
echo 'OPENSSL_LIBS='"$OPENSSL_LIBS" >> $GITHUB_ENV
echo 'BORINGSSL_CFLAGS='"$OPENSSL_CFLAGS" >> $GITHUB_ENV
echo 'BORINGSSL_LIBS='"$OPENSSL_LIBS" >> $GITHUB_ENV
echo 'EXTRA_NGTCP2_OPTS='"$EXTRA_NGTCP2_OPTS" >> "$GITHUB_ENV"
echo 'EXTRA_AUTOTOOLS_OPTS='"$EXTRA_AUTOTOOLS_OPTS" >> $GITHUB_ENV
2021-08-22 14:31:16 +02:00
- name: Build nghttp3
if: matrix.http3 == 'http3'
run: |
2022-06-06 15:34:32 +02:00
git clone --depth 1 -b v0.5.0 https://github.com/ngtcp2/nghttp3
2021-08-22 14:31:16 +02:00
cd nghttp3
autoreconf -i
./configure --prefix=$PWD/build --enable-lib-only
2022-05-15 10:36:53 +02:00
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)" check
2021-08-22 14:31:16 +02:00
make install
- name: Build ngtcp2
if: matrix.http3 == 'http3'
run: |
2022-06-06 15:34:32 +02:00
git clone --depth 1 -b v0.6.0 https://github.com/ngtcp2/ngtcp2
2021-08-22 14:31:16 +02:00
cd ngtcp2
autoreconf -i
2022-06-23 11:47:10 +02:00
./configure --prefix=$PWD/build --enable-lib-only PKG_CONFIG_PATH="../openssl/build/lib/pkgconfig" $EXTRA_NGTCP2_OPTS
2022-05-15 10:36:53 +02:00
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)" check
2021-08-22 14:31:16 +02:00
make install
- name: Setup extra environment variables for HTTP/3
if: matrix.http3 == 'http3'
run: |
2021-08-29 12:10:49 +02:00
PKG_CONFIG_PATH="$PWD/openssl/build/lib/pkgconfig:$PWD/nghttp3/build/lib/pkgconfig:$PWD/ngtcp2/build/lib/pkgconfig:$PWD/libbpf/build/lib64/pkgconfig:$PKG_CONFIG_PATH"
LDFLAGS="$LDFLAGS -Wl,-rpath,$PWD/openssl/build/lib -Wl,-rpath,$PWD/libbpf/build/lib64"
EXTRA_AUTOTOOLS_OPTS="--enable-http3 $EXTRA_AUTOTOOLS_OPTS"
2021-11-16 14:09:48 +01:00
EXTRA_CMAKE_OPTS="-DENABLE_HTTP3=1 $EXTRA_CMAKE_OPTS"
2021-08-22 14:31:16 +02:00
echo 'PKG_CONFIG_PATH='"$PKG_CONFIG_PATH" >> $GITHUB_ENV
echo 'LDFLAGS='"$LDFLAGS" >> $GITHUB_ENV
echo 'EXTRA_AUTOTOOLS_OPTS='"$EXTRA_AUTOTOOLS_OPTS" >> $GITHUB_ENV
2021-11-16 14:09:48 +01:00
echo 'EXTRA_CMAKE_OPTS='"$EXTRA_CMAKE_OPTS" >> $GITHUB_ENV
2020-11-16 09:48:31 +01:00
- name: Setup git submodules
run: |
git submodule update --init
- name: Configure autotools
run: |
autoreconf -i
./configure
- name: Configure cmake (Linux)
if: matrix.buildtool == 'cmake' && runner.os == 'Linux'
run: |
make dist
VERSION=$(grep PACKAGE_VERSION config.h | cut -d' ' -f3 | tr -d '"')
tar xf nghttp2-$VERSION.tar.gz
cd nghttp2-$VERSION
echo 'NGHTTP2_CMAKE_DIR='"$PWD" >> $GITHUB_ENV
cmake -DENABLE_WERROR=1 -DWITH_MRUBY=1 -DWITH_NEVERBLEED=1 -DENABLE_APP=1 $EXTRA_CMAKE_OPTS -DCPPFLAGS="$CPPFLAGS" -DLDFLAGS="$LDFLAGS" .
- name: Configure cmake (MacOS)
if: matrix.buildtool == 'cmake' && runner.os == 'macOS'
2020-11-16 09:48:31 +01:00
run: |
make dist
VERSION=$(grep PACKAGE_VERSION config.h | cut -d' ' -f3 | tr -d '"')
tar xf nghttp2-$VERSION.tar.gz
cd nghttp2-$VERSION
echo 'NGHTTP2_CMAKE_DIR='"$PWD" >> $GITHUB_ENV
# This fixes infamous 'stdio.h not found' error.
echo 'SDKROOT='"$(xcrun --sdk macosx --show-sdk-path)" >> $GITHUB_ENV
cmake -DENABLE_WERROR=1 -DWITH_MRUBY=1 -DENABLE_APP=1 $EXTRA_CMAKE_OPTS -DCPPFLAGS="$CPPFLAGS" -DLDFLAGS="$LDFLAGS" .
- name: Build nghttp2 with autotools (Linux)
if: matrix.buildtool == 'autotools' && runner.os == 'Linux'
2020-11-16 09:48:31 +01:00
run: |
make -j"$(nproc)" distcheck \
DISTCHECK_CONFIGURE_FLAGS="--with-mruby --with-neverbleed --with-libev --enable-werror $EXTRA_AUTOTOOLS_OPTS CPPFLAGS=\"$CPPFLAGS\" LDFLAGS=\"$LDFLAGS\""
- name: Build nghttp2 with autotools (MacOS)
if: matrix.buildtool == 'autotools' && runner.os == 'macOS'
run: |
make -j"$(sysctl -n hw.ncpu)" distcheck \
DISTCHECK_CONFIGURE_FLAGS="--with-mruby --with-libev --enable-werror $EXTRA_AUTOTOOLS_OPTS CPPFLAGS=\"$CPPFLAGS\" LDFLAGS=\"$LDFLAGS\""
2020-11-16 09:48:31 +01:00
- name: Build nghttp2 with cmake
if: matrix.buildtool == 'cmake'
run: |
cd $NGHTTP2_CMAKE_DIR
2022-05-16 14:29:34 +02:00
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)"
make -j"$(nproc 2> /dev/null || sysctl -n hw.ncpu)" check
2020-11-16 09:48:31 +01:00
- name: Integration test
# Integration tests for nghttpx; autotools erases build
# artifacts.
if: matrix.buildtool == 'cmake'
run: |
cd $NGHTTP2_CMAKE_DIR/integration-tests
2020-11-16 09:48:31 +01:00
make itprep it
2022-02-08 11:16:32 +01:00
2022-07-05 11:14:22 +02:00
build-cross:
strategy:
matrix:
host: [x86_64-w64-mingw32, i686-w64-mingw32]
runs-on: ubuntu-22.04
env:
HOST: ${{ matrix.host }}
steps:
- uses: actions/checkout@v3
- name: Linux setup
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install \
gcc-mingw-w64 \
autoconf \
automake \
autotools-dev \
libtool \
pkg-config \
wine
- name: Build CUnit
run: |
curl -LO https://jaist.dl.sourceforge.net/project/cunit/CUnit/2.1-3/CUnit-2.1-3.tar.bz2
tar xf CUnit-2.1-3.tar.bz2
cd CUnit-2.1-3
./bootstrap
./configure --disable-shared --host="$HOST" --prefix="$PWD/build"
make -j$(nproc) install
- name: Configure autotools
run: |
autoreconf -i && \
./configure --enable-werror --enable-lib-only --with-cunit \
--host="$HOST" PKG_CONFIG_PATH="$PWD/CUnit-2.1-3/build/lib/pkgconfig"
- name: Build nghttp2
run: |
make -j$(nproc)
make -j$(nproc) check TESTS=""
cd tests
wine main.exe
2022-02-08 11:16:32 +01:00
build-windows:
runs-on: windows-latest
steps:
2022-05-15 08:39:03 +02:00
- uses: actions/checkout@v3
2022-02-08 11:16:32 +01:00
- name: Configure cmake
run: |
mkdir build
cd build
cmake ..
- name: Build nghttp2
run: |
cmake --build build