From 8657672ff082b8fcb9033d056dfd0eaeba36d495 Mon Sep 17 00:00:00 2001 From: sirknightj Date: Wed, 11 Dec 2024 23:37:51 -0800 Subject: [PATCH] MIPS32 cross compilation, threadpool, and use DRY --- .github/workflows/ci.yml | 54 ------------ .github/workflows/cross-compilation.yml | 104 ++++++++++++++++++++++++ 2 files changed, 104 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/cross-compilation.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1c02143f7..cd3eca28a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -612,60 +612,6 @@ jobs: # cd D:\a\webrtc # git config --system core.longpaths true # .github\build_windows_mbedtls.bat - arm64-cross-compilation: - runs-on: ubuntu-20.04 - env: - CC: aarch64-linux-gnu-gcc - CXX: aarch64-linux-gnu-g++ - steps: - - name: Install dependencies - run: | - sudo apt clean && sudo apt update - sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu - - name: Clone repository - uses: actions/checkout@v4 - - name: Build Repository - run: | - sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6' - mkdir build && cd build - cmake .. -DBUILD_OPENSSL=TRUE -DBUILD_OPENSSL_PLATFORM=linux-generic64 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi - make - linux-aarch64-cross-compilation: - runs-on: ubuntu-20.04 - env: - CC: aarch64-linux-gnu-gcc - CXX: aarch64-linux-gnu-g++ - steps: - - name: Install dependencies - run: | - sudo apt clean && sudo apt update - sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu - - name: Clone repository - uses: actions/checkout@v4 - - name: Build Repository - run: | - sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6' - mkdir build && cd build - cmake .. -DBUILD_OPENSSL=TRUE -DBUILD_OPENSSL_PLATFORM=linux-aarch64 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi - make - arm32-cross-compilation: - runs-on: ubuntu-20.04 - env: - CC: arm-linux-gnueabi-gcc - CXX: arm-linux-gnueabi-g++ - steps: - - name: Install dependencies - run: | - sudo apt clean && sudo apt update - sudo apt-get -y install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi binutils-arm-linux-gnueabi - - name: Clone repository - uses: actions/checkout@v4 - - name: Build Repository - run: | - sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6' - mkdir build && cd build - cmake .. -DBUILD_OPENSSL=TRUE -DBUILD_OPENSSL_PLATFORM=linux-generic32 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi - make stack-size-check: runs-on: ubuntu-latest diff --git a/.github/workflows/cross-compilation.yml b/.github/workflows/cross-compilation.yml new file mode 100644 index 0000000000..a2c27707d2 --- /dev/null +++ b/.github/workflows/cross-compilation.yml @@ -0,0 +1,104 @@ +name: WebRTC C SDK Cross Compilation +on: + push: + branches: + - develop + - main + pull_request: + branches: + - develop + - main +jobs: + linux-cross-compilation: + strategy: + matrix: + compiler: + - name: mips-32 + runner: public.ecr.aws/ubuntu/ubuntu:22.04_stable + install: gcc-mips-linux-gnu g++-mips-linux-gnu + cc: mips-linux-gnu-gcc + cxx: mips-linux-gnu-g++ + cmake_flags: -DBUILD_OPENSSL_PLATFORM=linux-mips32 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=mips-unknown-linux-gnu + file-expected-output: "ELF 32-bit MSB executable, MIPS, MIPS32" + - name: arm-32 + runner: public.ecr.aws/ubuntu/ubuntu:22.04_stable + install: gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf + cc: arm-linux-gnueabihf-gcc + cxx: arm-linux-gnueabihf-g++ + cmake_flags: -DBUILD_OPENSSL_PLATFORM=linux-generic32 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi + file-expected-output: "ELF 32-bit LSB pie executable, ARM" + - name: arm-64 + runner: public.ecr.aws/ubuntu/ubuntu:22.04_stable + install: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + cc: aarch64-linux-gnu-gcc + cxx: aarch64-linux-gnu-g++ + cmake_flags: -DBUILD_OPENSSL_PLATFORM=linux-generic64 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi + file-expected-output: "ELF 64-bit LSB pie executable, ARM" + - name: aarch-64 + runner: public.ecr.aws/ubuntu/ubuntu:22.04_stable + install: gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + cc: aarch64-linux-gnu-gcc + cxx: aarch64-linux-gnu-g++ + cmake_flags: -DBUILD_OPENSSL_PLATFORM=linux-aarch64 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-unknown-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi + file-expected-output: "ELF 64-bit LSB pie executable, ARM" + + build-type: + - name: Shared + cmake_flags: -DBUILD_STATIC_LIBS=OFF + - name: Static + cmake_flags: -DBUILD_STATIC_LIBS=ON + + crypto: + - name: OpenSSL + cmake_flags: -DUSE_OPENSSL=ON -DUSE_MBEDTLS=OFF + - name: MbedTLS + cmake_flags: -DUSE_OPENSSL=OFF -DUSE_MBEDTLS=ON + + threadpool: + - name: Threadpool On + cmake_flags: -DENABLE_KVS_THREADPOOL=ON + - name: Threadpool Off + cmake_flags: -DENABLE_KVS_THREADPOOL=OFF + + fail-fast: false + runs-on: ubuntu-latest + container: + image: ${{ matrix.compiler.runner }} + name: ${{ matrix.compiler.name }}, ${{ matrix.build-type.name }}, ${{ matrix.crypto.name }}, ${{ matrix.threadpool.name }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install dependencies + run: | + apt-get update + apt-get install -y build-essential cmake git pkg-config file ${{ matrix.compiler.install }} + - name: Configure and build ${{ matrix.compiler.name }}, ${{ matrix.build-type.name }}, ${{ matrix.crypto.name }}, ${{ matrix.threadpool.name }} + run: | + export CC=${{ matrix.compiler.cc }} + export CXX=${{ matrix.compiler.cxx }} + echo "Using $CC and $CXX" + + mkdir -p build + cd build + + cmake .. -DBUILD_TEST=ON \ + -DENABLE_AWS_SDK_IN_TESTS=OFF \ + ${{ matrix.build-type.cmake_flags }} \ + ${{ matrix.crypto.cmake_flags }} \ + ${{ matrix.compiler.cmake_flags }} \ + ${{ matrix.threadpool.cmake_flags }} + make -j$(sysctl -n hw.ncpu) + shell: bash + - name: Check test file is compiled correctly + run: | + cd build + + file ./tst/webrtc_client_test + file ./samples/kvsWebrtcClientMaster + + readelf -a ./tst/webrtc_client_test + readelf -a ./samples/kvsWebrtcClientMaster + + file ./tst/webrtc_client_test | grep "${{ matrix.compiler.file-expected-output }}" + file ./samples/kvsWebrtcClientMaster | grep "${{ matrix.compiler.file-expected-output }}" + shell: bash