diff --git a/.appveyor.yml b/.appveyor.yml index 1254c9c16..93a021c2c 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -18,7 +18,7 @@ build_script: - ps: if ($CNFG -eq "Debug") { if ($VSIMG -match '2015') { .\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS OFF } else {.\scripts\build-windows.ps1 -STATIC_LINK_SSL ON -BUILD_APPS ON }} test_script: - - ps: if ( $Env:RUN_UNIT_TESTS ) { cd ./_build; ctest -E "TestIPv6.v6_calls_v4" --extra-verbose -C $Env:CONFIGURATION; cd ../ } + - ps: if ( $Env:RUN_UNIT_TESTS ) { cd _build; ctest -E "TestIPv6.v6_calls_v4" --extra-verbose -C $Env:CONFIGURATION; cd .. } after_build: - cmd: >- diff --git a/.github/workflows/abi.yml b/.github/workflows/abi.yml index 846dbbb2e..b8f7c7601 100644 --- a/.github/workflows/abi.yml +++ b/.github/workflows/abi.yml @@ -18,40 +18,26 @@ jobs: base_version: ${{ steps.build.outputs.SRT_BASE }} tag_version: ${{ steps.build.outputs.SRT_TAG_VERSION }} steps: + - uses: actions/checkout@v3 with: path: gitview_pr + + - id: settings + run: echo "SCRIPTS=$PWD/gitview_pr/scripts/workflows/abi" >> $GITHUB_ENV + - id: configure name: Configure (cmake) - run: | - cd gitview_pr - mkdir _build && cd _build - cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_BONDING=1 -DENABLE_PKTINFO=1 -DENABLE_MAXREXMITBW=1 ../ + run: $SCRIPTS/step1-configure-pr.sh + - id: build name: Build and dump run: | - sudo apt install -y abi-dumper abi-compliance-checker tcl - cd gitview_pr - cd _build && cmake --build ./ - make install DESTDIR=./installdir - SRT_TAG_VERSION=v$(../scripts/get-build-version.tcl full) - echo "SRT_TAG_VERSION=$SRT_TAG_VERSION" >> "$GITHUB_OUTPUT" - SRT_TAG=${SRT_TAG_VERSION}dev-$(git rev-parse --short HEAD) - echo "TAGGING PR BUILD: $SRT_TAG" - abi-dumper libsrt.so -o libsrt-pr.dump -public-headers installdir/usr/local/include/srt/ -lver $SRT_TAG - ls -ld libsrt-pr.dump - sha256sum libsrt-pr.dump - SRT_BASE=v$(../scripts/get-build-version.tcl base) - if [[ $SRT_TAG_VERSION == $SRT_BASE ]]; then - echo "NOT CHECKING ABI: base version is being built: $SRT_TAG (not emitting SRT_BASE)" - #echo "SRT_BASE=''" >> "$GITHUB_OUTPUT" - else - echo "WILL CHECK ABI changes $SRT_BASE - $SRT_TAG_VERSION" - echo "SRT_BASE=$SRT_BASE" >> "$GITHUB_OUTPUT" - fi + $SCRIPTS/step2-build-pr__OUTPUT.sh $GITHUB_OUTPUT echo "--- GITHUB_OUTPUT ---" cat $GITHUB_OUTPUT echo "---------------------" + - id: upload_pr_dump uses: actions/upload-artifact@v4 with: @@ -68,36 +54,28 @@ jobs: SRT_BASE: ${{ needs.build_pr.outputs.base_version }} SRT_TAG_VERSION: ${{ needs.build_pr.outputs.tag_version }} steps: + + - uses: actions/checkout@v3 + with: + path: gitview_pr + + - id: settings + run: echo "SCRIPTS=$PWD/gitview_pr/scripts/workflows/abi" >> $GITHUB_ENV + - uses: actions/checkout@v3 with: path: gitview_base ref: ${{ env.SRT_BASE }} + - id: configure_tag name: Configure (cmake) run: | - echo "TAG:$SRT_TAG_VERSION BASE:$SRT_BASE" - - #This is currently a paranoid check - the if should do the job - if [[ -z $SRT_BASE ]]; then - echo "NO BASE DEFINED. NOT BUILDING" - exit 1 - fi - cd gitview_base - mkdir _build && cd _build - cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_BONDING=1 -DENABLE_PKTINFO=1 -DENABLE_MAXREXMITBW=1 ../ + $SCRIPTS/step3-configure-base__SRT_TAG_VERSION__SRT_BASE.sh $SRT_TAG_VERSION $SRT_BASE - id: build_tag name: Build and dump if: ${{ success() }} run: | - sudo apt install -y abi-dumper - sudo apt install -y tcl - cd gitview_base - cd _build && cmake --build ./ - make install DESTDIR=./installdir - echo "TAGGING BASE BUILD: $SRT_BASE" - abi-dumper libsrt.so -o libsrt-base.dump -public-headers installdir/usr/local/include/srt/ -lver $SRT_BASE - ls -ld libsrt-base.dump - sha256sum libsrt-base.dump + $SCRIPTS/step4-build-base__SRT_BASE.sh $SRT_BASE - id: upload_base_dump uses: actions/upload-artifact@v4 with: @@ -112,6 +90,13 @@ jobs: SRT_BASE: ${{ needs.build_pr.outputs.base_version }} steps: + + - uses: actions/checkout@v3 + with: + path: gitview_pr + - id: settings + run: | + echo "SCRIPTS=$PWD/gitview_pr/scripts/workflows/abi" >> $GITHUB_ENV - name: Download base dump uses: actions/download-artifact@v4 with: @@ -124,18 +109,8 @@ jobs: path: . - name: abi-check run: | - sudo apt install -y abi-dumper abi-compliance-checker tcl - echo "FILESYSTEM state before running abi-check at $PWD" - ls -l - sha256sum libsrt-base.dump - sha256sum libsrt-pr.dump - RES=0 - abi-compliance-checker -l libsrt -old libsrt-base.dump -new libsrt-pr.dump || RES=$? - # Flatten the report for download-preview - cd compat_reports - REPORT=$(find . -name *.html) - cp $REPORT compat_report.html - cd .. + $SCRIPTS/prepare-environment.sh + $SCRIPTS/step5-run-abi-check.sh || RES=$? if (( $RES != 0 )); then echo "ABI/API Compatibility check failed with value $?" echo "RES=$RES" >>$GITHUB_ENV diff --git a/.github/workflows/iOS.yaml b/.github/workflows/iOS.yaml index 9ae9e9124..8c07efd02 100644 --- a/.github/workflows/iOS.yaml +++ b/.github/workflows/iOS.yaml @@ -10,20 +10,24 @@ jobs: build: strategy: matrix: - cxxstdsync: [OFF, ON] + sync: [posix, std] - name: iOS-cxxsync${{ matrix.cxxstdsync }} + name: iOS SYNC=${{ matrix.sync }} runs-on: macos-latest steps: + - uses: actions/checkout@v3 + - name: Install dependency packages - run: | - brew install make llvm + run: ./scripts/workflows/build/macos-prepare-environment.sh + - name: configure run: | - mkdir _build && cd _build export PATH="/opt/homebrew/opt/llvm/bin:$PATH" CC=clang CXX=clang++ - cmake .. -DCMAKE_MAKE_PROGRAM=gmake -DENABLE_ENCRYPTION=OFF -DENABLE_STDCXX_SYNC=${{matrix.cxxstdsync}} -DENABLE_MONOTONIC_CLOCK=OFF -DENABLE_UNITTESTS=OFF -DUSE_CXX_STD=c++11 -DENABLE_BONDING=ON --toolchain scripts/iOS.cmake + echo "Compiler id:" + $CXX -v + ./scripts/workflows/build/configure.sh _build -sync ${{ matrix.sync }} -ut off -enc off -std 11 -bonding on -- -DCMAKE_MAKE_PROGRAM=gmake --toolchain scripts/iOS.cmake + - name: build - run: cd _build && cmake --build ./ + run: ./scripts/workflows/build/build.sh _build diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index d8b1f3b89..f806acd64 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -12,21 +12,16 @@ jobs: runs-on: macos-latest steps: - - name: GoogleTest - run: | - brew tap-new Haivision/gt-local - brew extract --version=1.12.1 --force googletest Haivision/gt-local - brew trust Haivision/gt-local - brew install googletest@1.12.1 - # NOTE: 1.12.1 is the last version that requires C++11; might need update later - # curl -o googletest.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/23e7fb4dc0cc73facc3772815741e1deb87d6406/Formula/googletest.rb - # brew install -s googletest.rb - uses: actions/checkout@v3 + + - name: Environment + run: ./scripts/workflows/build/macos-prepare-environment.sh -ut on + - name: configure - run: | - mkdir _build && cd _build - cmake ../ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DENABLE_STDCXX_SYNC=ON -DENABLE_ENCRYPTION=OFF -DENABLE_UNITTESTS=ON -DENABLE_BONDING=ON -DUSE_CXX_STD=17 + run: ./scripts/workflows/build/configure.sh _build -werror on -sync std -enc off -ut on -bonding on -std 17 + - name: build - run: cd _build && cmake --build ./ + run: ./scripts/workflows/build/build.sh _build + - name: test - run: cd _build && ctest --extra-verbose + run: ./scripts/workflows/build/test.sh _build diff --git a/.github/workflows/ubuntu-c++03.yml b/.github/workflows/ubuntu-c++03.yml index 8b9b685f5..c2c96cd1c 100644 --- a/.github/workflows/ubuntu-c++03.yml +++ b/.github/workflows/ubuntu-c++03.yml @@ -18,24 +18,20 @@ jobs: name: logging=${{ matrix.logging }} bonding=${{ matrix.bonding }} runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + - name: prepare - run: | - sudo apt update - sudo apt install -y tcl cmake libssl-dev gdb + run: ./scripts/workflows/build/ubuntu-prepare-environment.sh + - name: configure - run: | - mkdir _build && cd _build - cmake ../ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DENABLE_STDCXX_SYNC=OFF -DUSE_CXX_STD=03 -DENABLE_ENCRYPTION=ON -DENABLE_UNITTESTS=ON -DENABLE_BONDING=${{ matrix.bonding }} -DENABLE_TESTING=ON -DENABLE_EXAMPLES=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DENABLE_LOGGING=${{ matrix.logging }} + run: ./scripts/workflows/build/configure.sh _build -sync posix -std 03 -bonding ${{ matrix.bonding }} -logging ${{ matrix.logging }} -examples on -testing on -werror on -ut on + - name: build # That below is likely SonarQube remains, which was removed earlier. #run: cd _build && build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build . - run: cd _build && cmake --build . + run: ./scripts/workflows/build/build.sh _build + - name: test - run: | - echo "core.%e" | sudo tee /proc/sys/kernel/core_pattern - ulimit -c unlimited - cd _build && ctest --extra-verbose - SUCCESS=$? - if [ -f core.test-srt ]; then gdb -batch ./test-srt -c core.test-srt -ex bt -ex "info thread" -ex quit; else echo "NO CORE - NO CRY!"; fi; - test $SUCCESS == 0; + run: ./scripts/workflows/build/test.sh _build + diff --git a/.github/workflows/ubuntu-c++11.yml b/.github/workflows/ubuntu-c++11.yml index e0152a09d..a9397e91d 100644 --- a/.github/workflows/ubuntu-c++11.yml +++ b/.github/workflows/ubuntu-c++11.yml @@ -16,37 +16,30 @@ jobs: name: ON ${{ matrix.machine }} runs-on: "${{ matrix.machine }}" steps: + - uses: actions/checkout@v3 + - name: prepare run: | - sudo apt update - RUNON=${{ matrix.machine }} - if [[ $RUNON == ubuntu-latest ]]; then - sudo apt install -y gdb - fi - sudo apt install -y tcl cmake - [[ $RUNON == ubuntu-24.04-arm ]] || sudo apt install libssl-dev + [[ ${{ matrix.machine }} == ubuntu-24.04-arm ]] && OPT+=" -gdb off -ssl off" + ./scripts/workflows/build/ubuntu-prepare-environment.sh $OPT + - name: configure run: | - RUNON=${{ matrix.machine }} - ENCRYPTION=ON - [[ $RUNON == ubuntu-24.04-arm ]] && ENCRYPTION=OFF - mkdir _build && cd _build - cmake ../ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DUSE_CXX_STD=11 -DENABLE_STDCXX_SYNC=ON -DENABLE_ENCRYPTION=$ENCRYPTION -DENABLE_UNITTESTS=ON -DENABLE_BONDING=ON -DENABLE_TESTING=ON -DENABLE_EXAMPLES=ON -DENABLE_DEBUG=ON -DENABLE_CODE_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + [[ ${{ matrix.machine }} == ubuntu-24.04-arm ]] && OPT+=" -enc off" + ./scripts/workflows/build/configure.sh _build $OPT -werror on -std 11 -ut on -bonding on -testing on -examples on -debug on -codecov on - name: build - run: cd _build && cmake --build . + run: ./scripts/workflows/build/build.sh _build + - name: test - run: | - echo "core.%e" | sudo tee /proc/sys/kernel/core_pattern - ulimit -c unlimited - cd _build && ctest --extra-verbose - SUCCESS=$? - if [ -f core.test-srt ]; then gdb -batch ./test-srt -c core.test-srt -ex bt -ex "info thread" -ex quit; else echo "NO CORE - NO CRY!"; fi; - test $SUCCESS == 0; + run: ./scripts/workflows/build/test.sh _build + - name: codecov uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} + + # ALTERNATIVE manual running of codecov; not in use as long as Github action works. # name: codecov # run: | # ./scripts/codecov/update.sh diff --git a/.github/workflows/ubuntu-mingw.yml b/.github/workflows/ubuntu-mingw.yml index f9df4bc8c..c7415e7bd 100644 --- a/.github/workflows/ubuntu-mingw.yml +++ b/.github/workflows/ubuntu-mingw.yml @@ -17,11 +17,10 @@ jobs: sudo apt install -y g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix - name: Configure run: | - mkdir _build && cd _build export CC=x86_64-w64-mingw32-gcc-posix CXX=x86_64-w64-mingw32-g++-posix - #cmake .. -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DENABLE_ENCRYPTION=OFF -DENABLE_UNITTESTS=OFF -DUSE_OPENSSL_PC=OFF -DCMAKE_SYSTEM_NAME=Windows -DENABLE_BONDING=ON -DENABLE_TESTING=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - # Warn-on-error turned off because there's a warning about epoll about unimplemented system fd subscription system - cmake .. -DENABLE_ENCRYPTION=OFF -DENABLE_UNITTESTS=OFF -DUSE_OPENSSL_PC=OFF -DCMAKE_SYSTEM_NAME=Windows -DENABLE_BONDING=ON -DENABLE_TESTING=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + # NOTE: -werror off because epoll warns about unimplemented system socket poll + ./scripts/workflows/build/configure.sh _build -werror off -enc off -ut off -bonding on -testing on -- -DUSE_OPENSSL_PC=OFF -DCMAKE_SYSTEM_NAME=Windows + - name: Build - run: cd _build && make -j -k + run: ./scripts/workflows/build/build.sh _build diff --git a/.github/workflows/windows-msvc-noenc.yml b/.github/workflows/windows-msvc-noenc.yml index a2c97cf34..2eb2ff1e4 100644 --- a/.github/workflows/windows-msvc-noenc.yml +++ b/.github/workflows/windows-msvc-noenc.yml @@ -13,12 +13,16 @@ jobs: runs-on: windows-latest steps: + - uses: actions/checkout@v3 + - name: configure run: | md _build && cd _build cmake ../ -DENABLE_STDCXX_SYNC=ON -DENABLE_ENCRYPTION=OFF -DENABLE_UNITTESTS=ON -DENABLE_BONDING=ON -DENABLE_LOCALIF_WIN32=ON -DUSE_CXX_STD=c++11 + - name: build run: cd _build && cmake --build ./ --config Release --verbose + - name: test run: cd _build && ctest -E "TestIPv6.v6_calls_v4|TestConnectionTimeout.BlockingLoop" --extra-verbose -C Release diff --git a/scripts/workflows/abi/prepare-environment.sh b/scripts/workflows/abi/prepare-environment.sh new file mode 100755 index 000000000..69b89b966 --- /dev/null +++ b/scripts/workflows/abi/prepare-environment.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +if [[ "`id -u`" != "0" ]]; then + echo "REQUIRED ROOT; attempting to resolve into sudo:" + exec sudo $0 "$@" +fi + +# Check distro +eval `cat /etc/*release* | grep ^NAME` + +echo "System detected: $NAME" + +case "$NAME" in + Ubuntu) + apt install -y abi-dumper abi-compliance-checker tcl + ;; + + openSUSE*) + zypper install -y abi-dumper abi-compliance-checker tcl + ;; + + *) + echo >&2 "ERROR: Unsupported system. Please update script" + exit 1 + ;; +esac + + diff --git a/scripts/workflows/abi/prepare-repository.sh b/scripts/workflows/abi/prepare-repository.sh new file mode 100755 index 000000000..bf2188643 --- /dev/null +++ b/scripts/workflows/abi/prepare-repository.sh @@ -0,0 +1,17 @@ +#!/bin/bash -x + +# NOTE: This step is to be run manually only. Github workflow +# will do the same through actions. Some duplicated settings are here, too. +# XXX Consider some common settings storage + +export SRT_BASE=v1.5.0 + +WD=$PWD + +PR_LABEL=`git rev-parse HEAD` + +git clone --depth 1 --revision=$PR_LABEL git@github.com:Haivision/srt.git gitview_pr +git clone --depth 1 --branch $SRT_BASE git@github.com:Haivision/srt.git gitview_base + + + diff --git a/scripts/workflows/abi/run-all b/scripts/workflows/abi/run-all new file mode 100755 index 000000000..5cb20bb8b --- /dev/null +++ b/scripts/workflows/abi/run-all @@ -0,0 +1,41 @@ +#!/usr/bin/tclsh + +set HERE [file dirname $argv0] +proc call {descr command args} { + global HERE + + if { [catch {exec >@stdout 2>@stderr $HERE/$command {*}$args} out] } { + puts "*** ERROR: $descr:" + puts $out + puts "***" + exit 1 + } +} + +# Unknown handler to interpret bash variable assignment +proc unknown args { + if {[string first = $args] != -1} { + lassign [split $args =] key val + if { [string first "\"" $val] } { + set val [lindex $val 0] + } else { + set val [string trim $val] + } + set key [string trim $key] + upvar $key kk + set kk $val + return + } + + error "Unknown: $args" +} + +call "prepare-environment" prepare-environment.sh +call "prepare-repository" prepare-repository.sh +call "step1" step1-configure-pr.sh +call "step2" step2-build-pr__OUTPUT.sh OUTPUT +source OUTPUT ;# Expect SRT_TAG_VERSION and SRT_BASE +call "step3" step3-configure-base__SRT_TAG_VERSION__SRT_BASE.sh $SRT_TAG_VERSION $SRT_BASE +call "step4" step4-build-base__SRT_BASE.sh $SRT_BASE +call "step5" step5-run-abi-check.sh + diff --git a/scripts/workflows/abi/step1-configure-pr.sh b/scripts/workflows/abi/step1-configure-pr.sh new file mode 100755 index 000000000..fa386cdd0 --- /dev/null +++ b/scripts/workflows/abi/step1-configure-pr.sh @@ -0,0 +1,6 @@ +#!/bin/bash -x + +cd gitview_pr +mkdir _build && cd _build +cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_BONDING=1 -DENABLE_PKTINFO=1 -DENABLE_MAXREXMITBW=1 ../ + diff --git a/scripts/workflows/abi/step2-build-pr__OUTPUT.sh b/scripts/workflows/abi/step2-build-pr__OUTPUT.sh new file mode 100755 index 000000000..2cd6e9551 --- /dev/null +++ b/scripts/workflows/abi/step2-build-pr__OUTPUT.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +OUTPUT=$1 + +if [[ -z $OUTPUT ]]; then + echo >&2 "ERROR: Please specify github output file, use - as stdout" + exit 1 +fi + +WD=$PWD +HERE=`dirname $0` +$HERE/prepare-environment.sh + +if [[ "$OUTPUT" == "-" ]]; then + exec 3>&1 +else + exec 3>$OUTPUT +fi + +cd gitview_pr +cd _build && cmake --build ./ +make install DESTDIR=./installdir +SRT_TAG_VERSION=v$(../scripts/get-build-version.tcl full) +echo "SRT_TAG_VERSION=$SRT_TAG_VERSION" >&3 +SRT_TAG=${SRT_TAG_VERSION}dev-$(git rev-parse --short HEAD) +echo "TAGGING PR BUILD: $SRT_TAG" +abi-dumper libsrt.so -o libsrt-pr.dump -public-headers installdir/usr/local/include/srt/ -lver $SRT_TAG +ls -ld libsrt-pr.dump +sha256sum libsrt-pr.dump +SRT_BASE=v$(../scripts/get-build-version.tcl base) + +if [[ $SRT_TAG_VERSION == $SRT_BASE ]]; then + echo "NOT CHECKING ABI: base version is being built: $SRT_TAG (not emitting SRT_BASE)" + #echo "SRT_BASE=''" >> "$GITHUB_OUTPUT" +else + echo "WILL CHECK ABI changes $SRT_BASE - $SRT_TAG_VERSION" + echo "SRT_BASE=$SRT_BASE" >&3 +fi + +exec 3>&- + +cd $WD +cp gitview_pr/_build/libsrt-pr.dump . + +exit 0 diff --git a/scripts/workflows/abi/step3-configure-base__SRT_TAG_VERSION__SRT_BASE.sh b/scripts/workflows/abi/step3-configure-base__SRT_TAG_VERSION__SRT_BASE.sh new file mode 100755 index 000000000..ad79f65cc --- /dev/null +++ b/scripts/workflows/abi/step3-configure-base__SRT_TAG_VERSION__SRT_BASE.sh @@ -0,0 +1,21 @@ +#!/bin/bash -x + +SRT_TAG_VERSION=$1 +SRT_BASE=$2 + +if [[ -z $SRT_TAG_VERSION ]]; then + echo "Parameters required: SRT_TAG_VERSION and SRT_BASE" + exit 1 +fi + +echo "TAG:$SRT_TAG_VERSION BASE:$SRT_BASE" + +#This is currently a paranoid check - the if should do the job +if [[ -z $SRT_BASE ]]; then + echo "NO BASE DEFINED. NOT BUILDING" + exit 1 +fi +cd gitview_base +mkdir _build && cd _build +cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_BONDING=1 -DENABLE_PKTINFO=1 -DENABLE_MAXREXMITBW=1 ../ + diff --git a/scripts/workflows/abi/step4-build-base__SRT_BASE.sh b/scripts/workflows/abi/step4-build-base__SRT_BASE.sh new file mode 100755 index 000000000..a594ad693 --- /dev/null +++ b/scripts/workflows/abi/step4-build-base__SRT_BASE.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +SRT_BASE=$1 +if [[ -z $SRT_BASE ]]; then + echo "Parameter required: SRT_BASE" + exit 1 +fi + +WD=$PWD +HERE=`dirname $0` +$HERE/prepare-environment.sh + +cd gitview_base +cd _build && cmake --build ./ +make install DESTDIR=./installdir +echo "TAGGING BASE BUILD: $SRT_BASE" +abi-dumper libsrt.so -o libsrt-base.dump -public-headers installdir/usr/local/include/srt/ -lver $SRT_BASE +ls -ld libsrt-base.dump +sha256sum libsrt-base.dump + +cd $WD +cp gitview_base/_build/libsrt-base.dump . + diff --git a/scripts/workflows/abi/step5-run-abi-check.sh b/scripts/workflows/abi/step5-run-abi-check.sh new file mode 100755 index 000000000..8e2215e54 --- /dev/null +++ b/scripts/workflows/abi/step5-run-abi-check.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +echo "FILESYSTEM state before running abi-check at $PWD" +ls -l +sha256sum libsrt-base.dump +sha256sum libsrt-pr.dump + +RES=0 +abi-compliance-checker -l libsrt -old libsrt-base.dump -new libsrt-pr.dump || RES=$? +# Flatten the report for download-preview +cd compat_reports +REPORT=$(find . -name *.html) +if [[ -n $REPORT ]]; then + cp $REPORT compat_report.html + + echo "SEE REPORT HERE:" + echo + echo compat_reports/compat_report.html + echo +else + echo "*** NO REPORT FOUND" +fi + +exit $RES + diff --git a/scripts/workflows/build/build.sh b/scripts/workflows/build/build.sh new file mode 100755 index 000000000..d6889168a --- /dev/null +++ b/scripts/workflows/build/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +DIR=$1 + +if [[ -z $DIR ]]; then + DIR=. +fi + +cd $DIR && cmake --build ./ diff --git a/scripts/workflows/build/configure.sh b/scripts/workflows/build/configure.sh new file mode 100755 index 000000000..3927f5a00 --- /dev/null +++ b/scripts/workflows/build/configure.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +# Options supported: +# -ut on +# -enc on +# -werror no +# -sync +# -std <98|=11|17> +# -bonding on +# -testing no +# -codecov no +# -examples no +# -logging on +# -debug no + + +# First argument is the directory. +# If first argument is option, directory is . + +OPTMATCH="-*" +if [[ "$1" == $OPTMATCH ]]; then + DIR=. +else + DIR=$1 + shift +fi +OPTIONS=$* + +HERE=`dirname $0` +source $HERE/../options.sh.src + + +CMAKE_ARGS=" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON" +CMAKE_ARGS+=" "-DENABLE_UNITTESTS=$(cmake_ON $(get-opt -ut $OPTIONS)) +CMAKE_ARGS+=" "-DENABLE_ENCRYPTION=$(cmake_OFF $(get-opt -enc $OPTIONS)) +CMAKE_ARGS+=" "-DCMAKE_COMPILE_WARNING_AS_ERROR=$(cmake_ON $(get-opt -werror $OPTIONS)) +CMAKE_ARGS+=" "-DENABLE_STDCXX_SYNC=$(cmake_OFF_if posix $(get-opt -sync $OPTIONS)) +CMAKE_ARGS+=" "-DUSE_CXX_STD=$(if_empty 11 $(get-opt -std $OPTIONS)) +CMAKE_ARGS+=" "-DENABLE_BONDING=$(cmake_OFF $(get-opt -bonding $OPTIONS)) +CMAKE_ARGS+=" "-DENABLE_TESTING=$(cmake_ON $(get-opt -testing $OPTIONS)) +CMAKE_ARGS+=" "-DENABLE_CODE_COVERAGE=$(cmake_ON $(get-opt -codecov $OPTIONS)) +CMAKE_ARGS+=" "-DENABLE_EXAMPLES=$(cmake_ON $(get-opt -examples $OPTIONS)) +CMAKE_ARGS+=" "-DENABLE_LOGGING=$(cmake_OFF $(get-opt -logging $OPTIONS)) +CMAKE_ARGS+=" "-DENABLE_DEBUG=$(cmake_ON $(get-opt -debug $OPTIONS)) +CMAKE_ARGS+=$(get-opt -- $OPTIONS) + +set -o xtrace + +mkdir -p $DIR && cd $DIR && cmake ../ $CMAKE_ARGS + diff --git a/scripts/workflows/build/macos-prepare-environment.sh b/scripts/workflows/build/macos-prepare-environment.sh new file mode 100755 index 000000000..4e716da78 --- /dev/null +++ b/scripts/workflows/build/macos-prepare-environment.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +HERE=`dirname $0` +source $HERE/../options.sh.src + + +set -o xtrace +if is-enable $(get-opt -ut $@); then WITH_UT=1; fi + +brew install make cmake llvm + +if (( $WITH_UT )); then + brew tap-new Haivision/gt-local + brew extract --version=1.12.1 --force googletest Haivision/gt-local + brew trust Haivision/gt-local + brew install googletest@1.12.1 + # NOTE: 1.12.1 is the last version that requires C++11; might need update later + # curl -o googletest.rb https://raw.githubusercontent.com/Homebrew/homebrew-core/23e7fb4dc0cc73facc3772815741e1deb87d6406/Formula/googletest.rb + # brew install -s googletest.rb +fi diff --git a/scripts/workflows/build/run-all b/scripts/workflows/build/run-all new file mode 100755 index 000000000..40f6a4498 --- /dev/null +++ b/scripts/workflows/build/run-all @@ -0,0 +1,39 @@ +#!/bin/bash + +HERE=`dirname $0` +HERE=`readlink -f $HERE` + +if [[ $(uname) == Linux ]]; then + eval `cat /etc/*release* | grep ^NAME` + + echo "System detected: $NAME" + + case "$NAME" in + Ubuntu) + $HERE/ubuntu-prepare-environment.sh + ;; + + openSUSE*) + $HERE/suse-prepare-environment.sh + ;; + + *) + echo >&2 "ERROR: Unsupported system. Please update script" + exit 1 + ;; + esac +elif [[ $(uname) == Darwin ]]; then + $HERE/macos-prepare-environment.sh +fi + + +# CD to toplevel +TOP=$(git rev-parse --show-toplevel) || { echo >&2 "NOT IN GIT REPO - please fix"; exit 1; } +cd $TOP + +set -o xtrace + +$HERE/configure.sh _build -ut on +$HERE/build.sh _build +$HERE/test.sh _build + diff --git a/scripts/workflows/build/suse-prepare-environment.sh b/scripts/workflows/build/suse-prepare-environment.sh new file mode 100755 index 000000000..831169d43 --- /dev/null +++ b/scripts/workflows/build/suse-prepare-environment.sh @@ -0,0 +1,11 @@ + +#!/bin/bash + +if [[ "`id -u`" != "0" ]]; then + echo "REQUIRED ROOT; attempting to resolve into sudo:" + exec sudo $0 "$@" +fi + +zypper update -y +zypper install -y tcl cmake libopenssl-devel gdb + diff --git a/scripts/workflows/build/test.sh b/scripts/workflows/build/test.sh new file mode 100755 index 000000000..52ee03e36 --- /dev/null +++ b/scripts/workflows/build/test.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +DIR=$1 + +if [[ -z $DIR ]]; then + DIR=. +fi + +function is_linux() +{ + if [[ "`uname`" != "Linux" ]]; then + return 1 + fi + return 0 +} + +if is_linux; then + echo "core.%e" | sudo tee /proc/sys/kernel/core_pattern + ulimit -c unlimited +fi + +cd $DIR || exit 1 + +ctest --extra-verbose +SUCCESS=$? + +if is_linux; then + if [[ -f core.test-srt ]]; then + gdb -batch ./test-srt -c core.test-srt -ex bt -ex "info thread" -ex quit + else + echo "NO CORE - NO CRY!" + fi +fi + +# Propagate the status +test $SUCCESS == 0 diff --git a/scripts/workflows/build/ubuntu-prepare-environment.sh b/scripts/workflows/build/ubuntu-prepare-environment.sh new file mode 100755 index 000000000..e8dea8550 --- /dev/null +++ b/scripts/workflows/build/ubuntu-prepare-environment.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +if [[ "`id -u`" != "0" ]]; then + echo "REQUIRED ROOT; attempting to resolve into sudo:" + exec sudo $0 "$@" +fi + +HERE=`dirname $0` +source $HERE/../options.sh.src + +if [[ $(cmake_OFF $(get-opt -gdb $@)) != OFF ]]; then + MAYBE_GDB=gdb +fi + + +if [[ $(cmake_OFF $(get-opt -ssl $@)) != OFF ]]; then + MAYBE_SSL=libssl-dev +fi + +apt update -y +apt install -y tcl cmake $MAYBE_SSL $MAYBE_GDB + diff --git a/scripts/workflows/options.sh.src b/scripts/workflows/options.sh.src new file mode 100644 index 000000000..04983338c --- /dev/null +++ b/scripts/workflows/options.sh.src @@ -0,0 +1,107 @@ +#!/bin/echo This should be sourced, not executed. + +function get-opt() +{ + VAL=$1 + shift + LAST="" + ISOPT=1 + for opt in "$@"; do + if [[ -z $LAST ]]; then + LAST=$opt + elif [[ $LAST == $VAL ]]; then + if [[ "$VAL" == "--" ]]; then + ISOPT=0 + echo -n " $opt" + else + echo $opt + return 0 + fi + else + if (( $ISOPT )); then + LAST="" + fi + fi + done + if (( ! $ISOPT )); then + echo + return 0 + fi + return 1 +} +#Usage: +#get_opt $1 -opt1 val1 -opt2 val2 -opt3 val3 + +function is-enable() +{ + for i in true on yes 1; do + if [[ "$1" == "$i" ]]; then + return 0 + fi + done + return 1 +} + +function to_lower() +{ + echo $@ | tr '[:upper:]' '[:lower:]' +} + +# Turn any boolean option to ON/OFF +function cmake_ON() +{ + ARG=$(to_lower $1) + for i in true on yes 1; do + if [[ "$ARG" == "$i" ]]; then + echo "ON" + return 0 + fi + done + if [[ "$ARG" == "2" ]]; then + # Special case for debug + echo 2 + else + echo "OFF" + fi +} + +function cmake_OFF() +{ + ARG=$(to_lower $1) + for i in false off no 0; do + if [[ "$ARG" == "$i" ]]; then + echo "OFF" + return 0 + fi + done + echo "ON" +} + +function cmake_ON_if() +{ + if [[ $1 == $2 ]]; then + echo ON + else + echo OFF + fi +} + +function cmake_OFF_if() +{ + if [[ $1 == $2 ]]; then + echo OFF + else + echo ON + fi +} + +function if_empty() +{ + if [[ -z $2 ]]; then + echo $1 + else + echo $2 + fi +} + +# vim: ft=bash