diff --git a/.github/workflows/actions/ubuntu-build-deps/action.yml b/.github/workflows/actions/ubuntu-build-deps/action.yml index f85a126..faeac1c 100644 --- a/.github/workflows/actions/ubuntu-build-deps/action.yml +++ b/.github/workflows/actions/ubuntu-build-deps/action.yml @@ -14,7 +14,7 @@ runs: - name: check if sudo is set shell: bash run: | - if [ ${{inputs.SUDO}} = true ] + if [ ${{ inputs.SUDO }} = true ] then AS_ROOT="sudo" else @@ -24,12 +24,12 @@ runs: - name: apt update shell: bash - run: ${{env.AS_ROOT}} apt update + run: ${{ env.AS_ROOT }} apt update - name: install build tools shell: bash run: | - ${{env.AS_ROOT}} apt install -y \ + ${{ env.AS_ROOT }} apt install -y \ build-essential \ clang \ clang-tidy \ @@ -42,7 +42,7 @@ runs: - name: install coturn dependencies shell: bash run: | - ${{env.AS_ROOT}} apt install -y \ + ${{ env.AS_ROOT }} apt install -y \ libevent-dev \ libssl-dev \ libpq-dev \ @@ -57,4 +57,5 @@ runs: shell: bash run: | wget https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libprom-dev-0.1.3-Linux.deb - ${{env.AS_ROOT}} apt install -y ./libprom-dev-0.1.3-Linux.deb + ${{ env.AS_ROOT }} apt install -y ./libprom-dev-0.1.3-Linux.deb + working-directory: /tmp/ diff --git a/.github/workflows/amazon_linux2023_tests.yml b/.github/workflows/amazon_linux2023_tests.yml deleted file mode 100644 index 0458101..0000000 --- a/.github/workflows/amazon_linux2023_tests.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: AmazonLinux2023 - -on: - push: - pull_request: - types: [ opened, reopened, synchronize ] - -# make GHA actions use node16 to use ancient container images -# See https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/ -# Unclear how long this will work though -env: - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true - -jobs: - builds: - strategy: - fail-fast: false - matrix: - os: [ 'amazonlinux:2023' ] - - runs-on: ubuntu-latest - container: ${{ matrix.os }} - - steps: - - name: Install Dependencies - run: | - yum install -y gcc make gzip tar openssl-devel libevent-devel - # Delay checkout until after dependencies have been installed. Amazon linux is very minimal and lacks basic stuff by default. - # use v3 of checkout until the weird container, nodejs, glibc issue is fixed - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Configure - run: ./configure - - - name: Compile - run: make - - - name: Unit Test - run: make check - - - name: Integration Test - working-directory: examples - run: ./run_tests.sh && ./run_tests_conf.sh diff --git a/.github/workflows/amazon_linux2_tests.yml b/.github/workflows/amazon_linux2_tests.yml deleted file mode 100644 index 50294e8..0000000 --- a/.github/workflows/amazon_linux2_tests.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: AmazonLinux2 - -on: - push: - pull_request: - types: [ opened, reopened, synchronize ] - -# make GHA actions use node16 to use ancient container images -# See https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/ -# Unclear how long this will work though -env: - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true - -jobs: - builds: - strategy: - fail-fast: false - matrix: - # amazonlinux 2 is end-of-life 2025-06 - os: [ 'amazonlinux:2' ] - - runs-on: ubuntu-latest - container: ${{ matrix.os }} - - steps: - - name: Install Dependencies - run: | - yum install -y gcc make gzip tar openssl11-devel libevent-devel - # Delay checkout until after dependencies have been installed. Amazon linux is very minimal and lacks basic stuff by default. - # use v3 of checkout until the weird container, nodejs, glibc issue is fixed - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Configure - run: ./configure - - - name: Compile - run: make - - - name: Unit Test - run: make check - - - name: Integration Test - working-directory: examples - run: ./run_tests.sh && ./run_tests_conf.sh && ./run_tests_prom.sh diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml deleted file mode 100644 index 1130374..0000000 --- a/.github/workflows/clang-tidy.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: clang-tidy - -on: - push: - pull_request: - types: [ opened, reopened, synchronize ] - -jobs: - clang-tidy: - runs-on: ubuntu-latest - - strategy: - matrix: - config: [Release] - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: install dependencies - uses: ./.github/workflows/actions/ubuntu-build-deps - with: - SUDO: true - - - name: Configure - run: | - cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_EXPORT_COMPILE_COMMANDS=true - - - name: Compile - run: | - cmake --build build --parallel --config ${{ matrix.config }} - - # Implicitly requires build/compile_commands.json to exist - - name: Run Clang Tidy - run: | - wget https://raw.githubusercontent.com/llvm/llvm-project/llvmorg-14.0.6/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py - chmod +x run-clang-tidy.py - ./run-clang-tidy.py -j $(nproc) -p build - - # Implicitly requires build/compile_commands.json to exist - - name: Run IWYU - run: | - wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/clang_14/iwyu_tool.py - chmod +x iwyu_tool.py - # iwyu_tool.py returns non-zero if any executions returned nonzero. Which... happens to be useless unless the project is already IWYU clean. - ./iwyu_tool.py -j $(nproc) -p build -- -Xiwyu --mapping_file=${GITHUB_WORKSPACE}/iwyu-ubuntu.imp | grep -v "has correct" | uniq || exit 0 diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml new file mode 100644 index 0000000..8a22536 --- /dev/null +++ b/.github/workflows/clang.yml @@ -0,0 +1,105 @@ +name: Clang + +on: + push: + branches: ["master"] + tags: ["4.*"] + pull_request: + branches: ["master"] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + format: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + uses: ./.github/workflows/actions/ubuntu-build-deps + with: + SUDO: true + + - name: Install `clang-format-15` + run: sudo apt install -y clang-format-15 + - name: Prepare `clang-format` + run: | + set -e + if which clang-format-15 2>&1 >/dev/null + then + sudo cp $(which clang-format-15) $(which clang-format) + fi + clang-format --version + + - run: ./configure + + - run: make lint + + sanitize: + runs-on: ubuntu-latest + strategy: + matrix: + sanitizer: + - address,pointer-compare,pointer-subtract + - thread + env: + CFLAGS: -fno-omit-frame-pointer -fstack-protector-all -fsanitize=${{ matrix.sanitizer }},bounds,enum -fsanitize-address-use-after-scope -fsanitize-address-use-after-return=always -fsanitize-recover=address -fsanitize-memory-track-origins=2 + CC: clang + ASAN_OPTIONS: strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:detect_leaks=0:detect_invalid_pointer_pairs=1:halt_on_error=0 + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + uses: ./.github/workflows/actions/ubuntu-build-deps + with: + SUDO: true + + - run: ./configure + - run: make -j $(nproc) + + - run: make check + + - run: ./run_tests.sh + working-directory: examples/ + - run: ./run_tests_conf.sh + working-directory: examples/ + - run: ./run_tests_prom.sh + working-directory: examples/ + + tidy: + runs-on: ubuntu-latest + strategy: + matrix: + config: ["Release"] + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + uses: ./.github/workflows/actions/ubuntu-build-deps + with: + SUDO: true + + - name: Configure + run: cmake -G Ninja -B build -DCMAKE_BUILD_TYPE=${{ matrix.config }} + -DCMAKE_EXPORT_COMPILE_COMMANDS=true + - name: Compile + run: cmake --build build --parallel --config ${{ matrix.config }} + + # Implicitly requires `build/compile_commands.json` to exist + - name: Run `clang-tidy` + run: | + set -e + wget https://raw.githubusercontent.com/llvm/llvm-project/llvmorg-14.0.6/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py + chmod +x run-clang-tidy.py + ./run-clang-tidy.py -j $(nproc) -p build + + # Implicitly requires `build/compile_commands.json` to exist + - name: Run IWYU + run: | + set -e + wget https://raw.githubusercontent.com/include-what-you-use/include-what-you-use/clang_14/iwyu_tool.py + chmod +x iwyu_tool.py + # iwyu_tool.py returns non-zero if any executions returned nonzero. Which... happens to be useless unless the project is already IWYU clean. + ./iwyu_tool.py -j $(nproc) -p build -- -Xiwyu --mapping_file=${GITHUB_WORKSPACE}/iwyu-ubuntu.imp | grep -v "has correct" | uniq || exit 0 diff --git a/.github/workflows/cmake.yaml b/.github/workflows/cmake.yaml index dd66fff..b59bbec 100644 --- a/.github/workflows/cmake.yaml +++ b/.github/workflows/cmake.yaml @@ -2,8 +2,14 @@ name: CMake on: push: + branches: ["master"] + tags: ["4.*"] pull_request: - types: [opened, reopened, synchronize] + branches: ["master"] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true env: BUILD_TYPE: Release @@ -11,28 +17,31 @@ env: jobs: build: runs-on: ubuntu-20.04 - steps: - name: Install dependencies run: | sudo apt-get update sudo apt-get install -y \ - wget \ libevent-dev \ libssl-dev \ libpq-dev libmariadb-dev libsqlite3-dev \ libhiredis-dev \ libmongoc-dev \ - libmicrohttpd-dev + libmicrohttpd-dev \ + wget - uses: actions/checkout@v4 - name: Prometheus support run: | wget https://github.com/digitalocean/prometheus-client-c/releases/download/v0.1.3/libprom-dev-0.1.3-Linux.deb && \ sudo apt install ./libprom-dev-0.1.3-Linux.deb && \ rm ./libprom-dev-0.1.3-Linux.deb - - name: Configure CMake + + - name: Configure run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - name: apps tests - run: cd examples && ./run_tests.sh && ./run_tests_conf.sh + + - run: ./run_tests.sh + working-directory: examples/ + - run: ./run_tests_conf.sh + working-directory: examples/ diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 649c441..64685f0 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,42 +1,43 @@ -name: "CodeQL" +name: CodeQL on: push: + branches: ["master"] + tags: ["4.*"] pull_request: - types: [ opened, reopened, synchronize ] + branches: ["master"] schedule: - - cron: '6 13 * * 4' + - cron: "6 13 * * 4" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true env: BUILD_TYPE: Release jobs: analyze: - name: CodeQL Analyze runs-on: ubuntu-latest permissions: security-events: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - uses: actions/checkout@v4 - - name: Install Dependencies - uses: ./.github/workflows/actions/ubuntu-build-deps - with: - SUDO: true + - name: Install dependencies + uses: ./.github/workflows/actions/ubuntu-build-deps + with: + SUDO: true - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: cpp + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: cpp - - name: Configure - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + - name: Configure + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - name: Build - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/compiler-sanitizers.yml b/.github/workflows/compiler-sanitizers.yml deleted file mode 100644 index 32b2972..0000000 --- a/.github/workflows/compiler-sanitizers.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: compiler-sanitizers - -on: - push: - pull_request: - types: [ opened, reopened, synchronize ] - -jobs: - compiler-sanitizers: - runs-on: ubuntu-latest - - strategy: - matrix: - sanitizer: [ 'address,pointer-compare,pointer-subtract', 'thread' ] - - env: - CFLAGS: "-fno-omit-frame-pointer -fstack-protector-all -fsanitize=${{matrix.sanitizer}},bounds,enum -fsanitize-address-use-after-scope -fsanitize-address-use-after-return=always -fsanitize-recover=address -fsanitize-memory-track-origins=2" - CC: "clang" - ASAN_OPTIONS: "strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:detect_leaks=0:detect_invalid_pointer_pairs=1:halt_on_error=0" - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: install dependencies - uses: ./.github/workflows/actions/ubuntu-build-deps - with: - SUDO: true - - - - name: Configure - run: | - ./configure - - - name: Compile - run: | - make -j $(nproc) - - - name: Check - run: | - make check - - - name: Test - run: | - cd examples - ./run_tests.sh && ./run_tests_conf.sh && ./run_tests_prom.sh diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5689aa3..0754988 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,4 +1,4 @@ -name: Docker CI +name: Docker on: push: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index b41cc2a..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Lint - -on: - push: - pull_request: - types: [ opened, reopened, synchronize ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install Dependencies - uses: ./.github/workflows/actions/ubuntu-build-deps - with: - SUDO: true - - - name: Install clang-format-15 - run: sudo apt install -y clang-format-15 - - - name: Configure - run: ./configure - - - name: lint - run: | - if which clang-format-15 2>&1 >/dev/null - then - sudo cp $(which clang-format-15) $(which clang-format) - fi - clang-format --version - make lint diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..0af5f45 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,72 @@ +name: Linux + +on: + push: + branches: ["master"] + tags: ["4.*"] + pull_request: + branches: ["master"] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: build + test + strategy: + fail-fast: false + matrix: + os: + - amazonlinux:2 # EOL 2025-06 + - amazonlinux:2023 + - ubuntu:16.04 + - ubuntu:18.04 + - ubuntu:20.04 + - ubuntu:22.04 + runs-on: ubuntu-latest + container: + image: ${{ matrix.os }} + volumes: + - ${{ contains('amazonlinux:2 ubuntu:16.04 ubuntu:18.04', matrix.os) && '/node20217:/node20217:rw,rshared' || ' ' }} + - ${{ contains('amazonlinux:2 ubuntu:16.04 ubuntu:18.04', matrix.os) && '/node20217:/__e/node20:ro,rshared' || ' ' }} + steps: + - name: Install `yum` dependencies + run: yum install -y gcc make gzip tar openssl-devel libevent-devel wget which + if: ${{ contains(matrix.os, 'amazonlinux') }} + + - name: Install Node.js 20 built against glibc 2.17 for GitHub Actions + run: | + set -ex + which apt \ + && apt update \ + && apt install -y wget xz-utils + which yum \ + && yum install -y wget xz + wget https://unofficial-builds.nodejs.org/download/release/v20.9.0/node-v20.9.0-linux-x64-glibc-217.tar.xz + tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217 + ldd /__e/node20/bin/node + working-directory: /tmp/ + if: ${{ contains('amazonlinux:2 ubuntu:16.04 ubuntu:18.04', matrix.os) }} + + - uses: actions/checkout@v4 + + - name: Install `apt` dependencies + # Set env variable or otherwise `tzdata` package requires interaction. + env: + DEBIAN_FRONTEND: noninteractive + uses: ./.github/workflows/actions/ubuntu-build-deps + if: ${{ contains(matrix.os, 'ubuntu') }} + + - run: ./configure + - run: make + + - run: make check + + - run: ./run_tests.sh + working-directory: examples/ + - run: ./run_tests_conf.sh + working-directory: examples/ + - run: ./run_tests_prom.sh + working-directory: examples/ + if: ${{ contains(matrix.os, 'ubuntu') }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 68617e5..c2d02e7 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,59 +1,50 @@ -name: MacOS +name: macOS on: push: + branches: ["master"] + tags: ["4.*"] pull_request: - types: [ opened, reopened, synchronize ] + branches: ["master"] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: - builds: + build: + name: build + test strategy: fail-fast: false matrix: - os: [ 'macos-12', 'macos-13', 'macos-14' ] - runs-on: ${{ matrix.os }} - + ver: ["13", "14", "15"] + runs-on: macos-${{ matrix.ver }} steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - uses: actions/checkout@v4 - - name: Brew - Relink Python - run: | - # Unlink and re-link to prevent errors when github mac runner images - # install python outside of brew, for example: + - name: Relink `python` package in `brew` + # Unlink and re-link to prevent errors when GitHub `macos` runner images + # install `python` outside of `brew`, for example: # https://github.com/orgs/Homebrew/discussions/3895 # https://github.com/actions/setup-python/issues/577 # https://github.com/actions/runner-images/issues/6459 # https://github.com/actions/runner-images/issues/6507 # https://github.com/actions/runner-images/issues/2322 - brew list -1 | grep python | while read formula; do brew unlink $formula; brew link --overwrite $formula; done + run: brew list -1 + | grep python + | while read formula; do brew unlink $formula; brew link --overwrite $formula; done - - name: Brew - Update pkg listings - run: | - brew update + - run: brew update + - run: brew install wget pkg-config libevent openssl@1.1 sqlite hiredis mongo-c-driver libmicrohttpd - - name: Brew - Install Dependencies - run: | - brew install \ - wget \ - pkg-config \ - libevent \ - openssl@1.1 \ - sqlite \ - hiredis \ - mongo-c-driver \ - libmicrohttpd + - run: ./configure + env: + PKG_CONFIG_PATH: "${{ env.PKG_CONFIG_PATH }}:/usr/local/opt/openssl@1.1/lib/pkgconfig" + - run: make - - name: Configure - run: PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/opt/openssl@1.1/lib/pkgconfig ./configure + - run: make check - - name: Compile - run: make - - - name: Unit Test - run: make check - - - name: Integration Test - working-directory: examples - run: ./run_tests.sh && ./run_tests_conf.sh + - run: ./run_tests.sh + working-directory: examples/ + - run: ./run_tests_conf.sh + working-directory: examples/ diff --git a/.github/workflows/mingw.yml b/.github/workflows/mingw.yml index 2cf4c0b..c3e523c 100644 --- a/.github/workflows/mingw.yml +++ b/.github/workflows/mingw.yml @@ -1,120 +1,120 @@ -name: mingw +name: MinGW on: push: + branches: ["master"] + tags: ["4.*"] pull_request: - types: [ opened, reopened, synchronize ] + branches: ["master"] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: build: name: build - strategy: + fail-fast: false matrix: - os: [windows-latest] - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: [Release, Debug] - BUILD_SHARED_LIBS: [OFF] - + os: ["windows"] + # Customize the CMake build type here (`Release`, `Debug`, `RelWithDebInfo`, etc.) + BUILD_TYPE: ["Release", "Debug"] + BUILD_SHARED_LIBS: ["OFF"] defaults: run: shell: cmd - - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.os }}-latest env: BUILD_TYPE: ${{ matrix.BUILD_TYPE }} - SOURCE_DIR: ${{github.workspace}}\.cache\source - TOOSL_DIR: ${{github.workspace}}\.cache\tools - INSTALL_DIR: ${{github.workspace}}\.cache\install_mingw_2022_02_15 - + SOURCE_DIR: ${{ github.workspace }}\.cache\source + TOOSL_DIR: ${{ github.workspace }}\.cache\tools + INSTALL_DIR: ${{ github.workspace }}\.cache\install_mingw_2022_02_15 steps: - - uses: actions/checkout@v4 - #with: - #fetch-depth: 0 + - uses: actions/checkout@v4 - - name: pacman - env: - PATH: C:\msys64\usr\bin - run: | - C:\msys64\usr\bin\pacman.exe -S --noconfirm ^ - mingw-w64-x86_64-cmake ^ - mingw-w64-x86_64-make ^ - mingw-w64-x86_64-nsis ^ - mingw-w64-x86_64-gcc ^ - mingw-w64-x86_64-zlib ^ - mingw-w64-x86_64-openssl ^ - mingw-w64-x86_64-libevent ^ - mingw-w64-x86_64-sqlite3 ^ - mingw-w64-x86_64-hiredis ^ - mingw-w64-x86_64-postgresql ^ - mingw-w64-x86_64-libmicrohttpd ^ - git base-devel + - name: Install dependencies + run: | + C:\msys64\usr\bin\pacman.exe -S --noconfirm ^ + mingw-w64-x86_64-cmake ^ + mingw-w64-x86_64-make ^ + mingw-w64-x86_64-nsis ^ + mingw-w64-x86_64-gcc ^ + mingw-w64-x86_64-zlib ^ + mingw-w64-x86_64-openssl ^ + mingw-w64-x86_64-libevent ^ + mingw-w64-x86_64-sqlite3 ^ + mingw-w64-x86_64-hiredis ^ + mingw-w64-x86_64-postgresql ^ + mingw-w64-x86_64-libmicrohttpd ^ + git base-devel + env: + PATH: C:\msys64\usr\bin - - name: make_directory - run: | - cmake -E make_directory ${{env.SOURCE_DIR}} - cmake -E make_directory ${{env.TOOSL_DIR}} - cmake -E make_directory ${{env.INSTALL_DIR}} + - name: Create directories + run: | + cmake -E make_directory ${{ env.SOURCE_DIR }} + cmake -E make_directory ${{ env.TOOSL_DIR }} + cmake -E make_directory ${{ env.INSTALL_DIR }} - - name: Cache installed - uses: actions/cache@v4 - id: cache-installed - with: - path: | - ${{env.INSTALL_DIR}} - key: coturn-cache-installed-mingw + - name: Cache installed + uses: actions/cache@v4 + id: cache-installed + with: + path: ${{ env.INSTALL_DIR }} + key: coturn-cache-installed-mingw - - name: build prometheus - if: false - working-directory: ${{env.SOURCE_DIR}} - env: - MSYSTEM: MINGW64 - PATH: C:\msys64\mingw64\bin;C:\msys64\usr\bin - run: | - cd ${{env.SOURCE_DIR}} - git clone https://github.com/digitalocean/prometheus-client-c.git - cd prometheus-client-c/prom - mkdir build - cd build - cmake .. -G"MinGW Makefiles" ^ - -DBUILD_SHARED_LIBS=${{matrix.BUILD_SHARED_LIBS}} ^ - -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^ - -DCMAKE_INSTALL_PREFIX=${{env.INSTALL_DIR}} - cmake --build . --config ${{matrix.BUILD_TYPE}} - cmake --build . --config ${{matrix.BUILD_TYPE}} --target install + - name: Build Prometheus + run: | + cd ${{ env.SOURCE_DIR }} + git clone https://github.com/digitalocean/prometheus-client-c.git + cd prometheus-client-c/prom + mkdir build + cd build + cmake .. -G"MinGW Makefiles" ^ + -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} ^ + -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} ^ + -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} + cmake --build . --config ${{ matrix.BUILD_TYPE }} + cmake --build . --config ${{ matrix.BUILD_TYPE }} --target install + env: + MSYSTEM: MINGW64 + PATH: C:\msys64\mingw64\bin;C:\msys64\usr\bin + working-directory: ${{ env.SOURCE_DIR }} + if: ${{ false }} - - name: build coturn - working-directory: ${{github.workspace}} - env: - MSYSTEM: MINGW64 - PATH: C:\msys64\mingw64\bin;C:\msys64\usr\bin - Prometheus_ROOT: ${{env.INSTALL_DIR}} - run: | - cmake -E make_directory build - cd build - cmake .. -G"MinGW Makefiles" ^ - -DBUILD_SHARED_LIBS=${{matrix.BUILD_SHARED_LIBS}} ^ - -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^ - -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install - cmake --build . --config ${{matrix.BUILD_TYPE}} - cmake --build . --config ${{matrix.BUILD_TYPE}} --target install + - name: Build Coturn + run: | + cmake -E make_directory build + cd build + cmake .. -G"MinGW Makefiles" ^ + -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} ^ + -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} ^ + -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install + cmake --build . --config ${{ matrix.BUILD_TYPE }} + cmake --build . --config ${{ matrix.BUILD_TYPE }} --target install + env: + MSYSTEM: MINGW64 + PATH: C:\msys64\mingw64\bin;C:\msys64\usr\bin + Prometheus_ROOT: ${{ env.INSTALL_DIR }} + working-directory: ${{ github.workspace }} - - name: Package - if: ${{ matrix.BUILD_TYPE == 'Release' }} - working-directory: ${{github.workspace}}\build - run: | - copy /Y ${{env.INSTALL_DIR}}\bin\*.dll install\bin - copy /Y ${{env.INSTALL_DIR}}\lib\*.dll install\bin - copy /Y ${{env.RUNVCPKG_VCPKG_ROOT}}\installed\${{env.RUNVCPKG_VCPKG_TRIPLET_OUT}}\bin\*.dll install\bin - 7z a coturn_windows_mingw.zip ${{github.workspace}}\build\install\* - cmake --build . --config ${{matrix.BUILD_TYPE}} --target package + - name: Package + run: | + copy /Y ${{ env.INSTALL_DIR }}\bin\*.dll install\bin + copy /Y ${{ env.INSTALL_DIR }}\lib\*.dll install\bin + copy /Y ${{ env.RUNVCPKG_VCPKG_ROOT }}\installed\${{ env.RUNVCPKG_VCPKG_TRIPLET_OUT }}\bin\*.dll install\bin + 7z a coturn_windows_mingw.zip ${{ github.workspace }}\build\install\* + cmake --build . --config ${{ matrix.BUILD_TYPE }} --target package + working-directory: ${{ github.workspace }}\build + if: ${{ matrix.BUILD_TYPE == 'Release' }} - - name: update - if: ${{ matrix.BUILD_TYPE == 'Release' }} - uses: actions/upload-artifact@v4 - with: - name: coturn_mingw_${{ matrix.os }} - path: | - ${{github.workspace}}\build\coturn_windows_mingw.zip - ${{github.workspace}}\build\coturn*.exe - ${{github.workspace}}\build\coturn*.md5 + - name: Update artifacts + uses: actions/upload-artifact@v4 + with: + name: coturn_mingw_${{ matrix.os }} + path: | + ${{ github.workspace }}\build\coturn_windows_mingw.zip + ${{ github.workspace }}\build\coturn*.exe + ${{ github.workspace }}\build\coturn*.md5 + if: ${{ matrix.BUILD_TYPE == 'Release' }} diff --git a/.github/workflows/msvc-analyzer.yml b/.github/workflows/msvc-analyzer.yml deleted file mode 100644 index 5470e6a..0000000 --- a/.github/workflows/msvc-analyzer.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: msvc-analyzer - -on: - push: - pull_request: - types: [ opened, reopened, synchronize ] - -jobs: - msvc-analyzer: - runs-on: windows-latest - - permissions: - # required for all codeql to report detected outcomes - security-events: write - - strategy: - matrix: - BUILD_TYPE: [Release] - BUILD_SHARED_LIBS: [OFF] - VCPKG_PLATFORM_TOOLSET: [v143] - CMAKE_GENERATOR_PLATFORM: [x64] - - env: - SOURCE_DIR: ${{github.workspace}}\.cache\source - TOOLS_DIR: ${{github.workspace}}\.cache\tools - INSTALL_DIR: ${{github.workspace}}\.cache\install_msvc_x64-windows_${{matrix.BUILD_TYPE}} - VCPKGGITCOMMITID: 53bef8994c541b6561884a8395ea35715ece75db - VCPKG_PLATFORM_TOOLSET: ${{matrix.VCPKG_PLATFORM_TOOLSET}} - CMAKE_GENERATOR_PLATFORM: ${{matrix.CMAKE_GENERATOR_PLATFORM}} - - defaults: - run: - shell: cmd - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: make directory - run: | - cmake -E make_directory ${{env.SOURCE_DIR}} - cmake -E make_directory ${{env.TOOLS_DIR}} - cmake -E make_directory ${{env.INSTALL_DIR}} - - - name: run-vcpkg - uses: lukka/run-vcpkg@v11 - with: - # If not using a submodule for vcpkg sources, this specifies which commit - # id must be checkout from a Git repo. It must not set if using a submodule - # for vcpkg. - vcpkgGitCommitId: '${{ env.VCPKGGITCOMMITID }}' - - - name: Configure (MSVC) - run: | - cmake -B build ^ - -A ${{matrix.CMAKE_GENERATOR_PLATFORM}} ^ - -T ${{matrix.VCPKG_PLATFORM_TOOLSET}} ^ - -DWITH_MYSQL=OFF ^ - -DBUILD_SHARED_LIBS=${{matrix.BUILD_SHARED_LIBS}} ^ - -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^ - -DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake - - - name: Initialize MSVC Code Analysis - uses: microsoft/msvc-code-analysis-action@v0.1.1 - # Provide a unique ID to access the sarif output path - id: run-analysis - with: - cmakeBuildDirectory: build - buildConfiguration: ${{ matrix.BUILD_TYPE }} - # Ruleset file that will determine what checks will be run - ruleset: NativeRecommendedRules.ruleset - - # Upload SARIF file to GitHub Code Scanning Alerts - - name: Upload SARIF to GitHub - uses: github/codeql-action/upload-sarif@v3 - with: - sarif_file: ${{ steps.run-analysis.outputs.sarif }} diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml index 1d381b4..34d3a68 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/msvc.yml @@ -1,96 +1,160 @@ -name: msvc +name: MSVC on: push: + branches: ["master"] + tags: ["4.*"] pull_request: - types: [ opened, reopened, synchronize ] + branches: ["master"] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + VCPKGGITCOMMITID: 53bef8994c541b6561884a8395ea35715ece75db jobs: - compile: - name: ${{matrix.os}}-vc-${{matrix.VCPKG_PLATFORM_TOOLSET}}-${{matrix.CMAKE_GENERATOR_PLATFORM}}-${{matrix.BUILD_TYPE}}-${{matrix.BUILD_SHARED_LIBS}} - + code-analysis: + name: code analysis (windows-vc-${{ matrix.VCPKG_PLATFORM_TOOLSET }}-${{ matrix.CMAKE_GENERATOR_PLATFORM }}-${{ matrix.BUILD_TYPE }}-${{ matrix.BUILD_SHARED_LIBS }}) + runs-on: windows-latest strategy: + fail-fast: false matrix: - BUILD_TYPE: [Release, Debug] - BUILD_SHARED_LIBS: [OFF, ON] - CMAKE_GENERATOR_PLATFORM: [x64, Win32] - os: [windows-latest] + BUILD_TYPE: [Release] + BUILD_SHARED_LIBS: [OFF] + VCPKG_PLATFORM_TOOLSET: [v143] + CMAKE_GENERATOR_PLATFORM: [x64] + env: + SOURCE_DIR: ${{ github.workspace }}\.cache\source + TOOLS_DIR: ${{ github.workspace }}\.cache\tools + INSTALL_DIR: ${{ github.workspace }}\.cache\install_msvc_x64-windows_${{ matrix.BUILD_TYPE }} + VCPKG_PLATFORM_TOOLSET: ${{ matrix.VCPKG_PLATFORM_TOOLSET }} + CMAKE_GENERATOR_PLATFORM: ${{ matrix.CMAKE_GENERATOR_PLATFORM }} + defaults: + run: + shell: cmd + permissions: + security-events: write # required for all CodeQL to report detected outcomes + steps: + - uses: actions/checkout@v4 + + - name: Create directories + run: | + cmake -E make_directory ${{ env.SOURCE_DIR }} + cmake -E make_directory ${{ env.TOOLS_DIR }} + cmake -E make_directory ${{ env.INSTALL_DIR }} + + - name: run-vcpkg + uses: lukka/run-vcpkg@v11 + with: + # If not using a submodule for vcpkg sources, this specifies which commit + # id must be checkout from a Git repo. It must not set if using a submodule + # for vcpkg. + vcpkgGitCommitId: '${{ env.VCPKGGITCOMMITID }}' + + - name: Configure + run: | + cmake -B build ^ + -A ${{ matrix.CMAKE_GENERATOR_PLATFORM }} ^ + -T ${{ matrix.VCPKG_PLATFORM_TOOLSET }} ^ + -DWITH_MYSQL=OFF ^ + -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} ^ + -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} ^ + -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake + + - name: Initialize MSVC Code Analysis + uses: microsoft/msvc-code-analysis-action@v0.1.1 + # Provide a unique ID to access the SARIF output path. + id: run-analysis + with: + cmakeBuildDirectory: build + buildConfiguration: ${{ matrix.BUILD_TYPE }} + # Ruleset file that will determine what checks will be run. + ruleset: NativeRecommendedRules.ruleset + + # Upload SARIF file to GitHub Code Scanning Alerts + - name: Upload SARIF to GitHub + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: ${{ steps.run-analysis.outputs.sarif }} + + compile: + name: compile (${{ matrix.os }}-vc-${{ matrix.VCPKG_PLATFORM_TOOLSET }}-${{ matrix.CMAKE_GENERATOR_PLATFORM }}-${{ matrix.BUILD_TYPE }}-${{ matrix.BUILD_SHARED_LIBS }}) + strategy: + fail-fast: false + matrix: + BUILD_TYPE: ["Release", "Debug"] + BUILD_SHARED_LIBS: ["OFF", "ON"] + CMAKE_GENERATOR_PLATFORM: ["x64", "Win32"] + os: ["windows"] include: # MSVC 2022 - triplet: x64-windows VCPKG_PLATFORM_TOOLSET: v143 CMAKE_GENERATOR_PLATFORM: x64 - - triplet: x86-windows VCPKG_PLATFORM_TOOLSET: v143 CMAKE_GENERATOR_PLATFORM: Win32 - # MSVC 2019 - triplet: x86-windows VCPKG_PLATFORM_TOOLSET: v142 CMAKE_GENERATOR_PLATFORM: Win32 - - runs-on: ${{matrix.os}} - + runs-on: ${{ matrix.os }}-latest env: - SOURCE_DIR: ${{github.workspace}}\.cache\source - TOOLS_DIR: ${{github.workspace}}\.cache\tools - INSTALL_DIR: ${{github.workspace}}\.cache\install_msvc_${{matrix.triplet}}_${{matrix.BUILD_TYPE}} - VCPKGGITCOMMITID: 53bef8994c541b6561884a8395ea35715ece75db - VCPKG_PLATFORM_TOOLSET: ${{matrix.VCPKG_PLATFORM_TOOLSET}} - CMAKE_GENERATOR_PLATFORM: ${{matrix.CMAKE_GENERATOR_PLATFORM}} - + SOURCE_DIR: ${{ github.workspace }}\.cache\source + TOOLS_DIR: ${{ github.workspace }}\.cache\tools + INSTALL_DIR: ${{ github.workspace }}\.cache\install_msvc_${{matrix.triplet}}_${{matrix.BUILD_TYPE}} + VCPKG_PLATFORM_TOOLSET: ${{ matrix.VCPKG_PLATFORM_TOOLSET }} + CMAKE_GENERATOR_PLATFORM: ${{ matrix.CMAKE_GENERATOR_PLATFORM }} defaults: run: shell: cmd - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - uses: actions/checkout@v4 - - name: make directory - run: | - cmake -E make_directory ${{env.SOURCE_DIR}} - cmake -E make_directory ${{env.TOOLS_DIR}} - cmake -E make_directory ${{env.INSTALL_DIR}} + - name: Create directories + run: | + cmake -E make_directory ${{ env.SOURCE_DIR }} + cmake -E make_directory ${{ env.TOOLS_DIR }} + cmake -E make_directory ${{ env.INSTALL_DIR }} - - name: run-vcpkg - uses: lukka/run-vcpkg@v11 - with: - # If not using a submodule for vcpkg sources, this specifies which commit - # id must be checkout from a Git repo. It must not set if using a submodule - # for vcpkg. - vcpkgGitCommitId: '${{ env.VCPKGGITCOMMITID }}' + - name: run-vcpkg + uses: lukka/run-vcpkg@v11 + with: + # If not using a submodule for vcpkg sources, this specifies which commit + # id must be checkout from a Git repo. It must not set if using a submodule + # for vcpkg. + vcpkgGitCommitId: '${{ env.VCPKGGITCOMMITID }}' - - name: build coturn - run: | - cmake -E make_directory ${{github.workspace}}/build - cd ${{github.workspace}}/build - cmake ${{github.workspace}} ^ - -A ${{matrix.CMAKE_GENERATOR_PLATFORM}} ^ - -T ${{matrix.VCPKG_PLATFORM_TOOLSET}} ^ - -DWITH_MYSQL=OFF ^ - -DBUILD_SHARED_LIBS=${{matrix.BUILD_SHARED_LIBS}} ^ - -DCMAKE_BUILD_TYPE=${{matrix.BUILD_TYPE}} ^ - -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install ^ - -DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake - cmake --build . --config ${{matrix.BUILD_TYPE}} - cmake --build . --config ${{matrix.BUILD_TYPE}} --target install + - name: Build Coturn + run: | + cmake -E make_directory ${{ github.workspace }}/build + cd ${{ github.workspace }}/build + cmake ${{ github.workspace }} ^ + -A ${{ matrix.CMAKE_GENERATOR_PLATFORM }} ^ + -T ${{ matrix.VCPKG_PLATFORM_TOOLSET }} ^ + -DWITH_MYSQL=OFF ^ + -DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED_LIBS }} ^ + -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} ^ + -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install ^ + -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake + cmake --build . --config ${{ matrix.BUILD_TYPE }} + cmake --build . --config ${{ matrix.BUILD_TYPE }} --target install - - name: Package - if: ${{ matrix.BUILD_TYPE == 'Release' }} - working-directory: ${{github.workspace}}\build - run: | - 7z a coturn_windows_msvc.zip ${{github.workspace}}\build\install\* - cmake --build . --config ${{matrix.BUILD_TYPE}} --target package + - name: Package + run: | + 7z a coturn_windows_msvc.zip ${{ github.workspace }}\build\install\* + cmake --build . --config ${{ matrix.BUILD_TYPE }} --target package + working-directory: ${{ github.workspace }}\build + if: ${{ matrix.BUILD_TYPE == 'Release' }} - - name: Update - if: ${{ matrix.BUILD_TYPE == 'Release' }} - uses: actions/upload-artifact@v4 - with: - name: coturn_msvc-${{matrix.VCPKG_PLATFORM_TOOLSET}}-${{matrix.CMAKE_GENERATOR_PLATFORM}}-${{matrix.BUILD_SHARED_LIBS}} - path: | - ${{github.workspace}}\build\coturn_windows_msvc.zip - ${{github.workspace}}\build\coturn*.exe - ${{github.workspace}}\build\coturn*.md5 + - name: Update artifacts + uses: actions/upload-artifact@v4 + with: + name: coturn_msvc-${{ matrix.VCPKG_PLATFORM_TOOLSET }}-${{ matrix.CMAKE_GENERATOR_PLATFORM }}-${{ matrix.BUILD_SHARED_LIBS }} + path: | + ${{ github.workspace }}\build\coturn_windows_msvc.zip + ${{ github.workspace }}\build\coturn*.exe + ${{ github.workspace }}\build\coturn*.md5 + if: ${{ matrix.BUILD_TYPE == 'Release' }} diff --git a/.github/workflows/ubuntu_tests.yml b/.github/workflows/ubuntu_tests.yml deleted file mode 100644 index 9936a90..0000000 --- a/.github/workflows/ubuntu_tests.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Ubuntu - -on: - push: - pull_request: - types: [ opened, reopened, synchronize ] - -# make GHA actions use node16 to use ancient container images -# See https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/ -# Unclear how long this will work though -env: - ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true - -jobs: - builds: - strategy: - fail-fast: false - matrix: - os: [ 'ubuntu:16.04', 'ubuntu:18.04', 'ubuntu:20.04', 'ubuntu:22.04' ] - runs-on: ubuntu-latest - container: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - name: Install dependencies - # Set env variable or otherwise tzdata package requires interaction - env: - DEBIAN_FRONTEND: noninteractive - uses: ./.github/workflows/actions/ubuntu-build-deps - - name: configure - run: ./configure - - name: make - run: make - - name: make check - run: make check - - name: apps tests - run: cd examples && ./run_tests.sh && ./run_tests_conf.sh && ./run_tests_prom.sh