From b710c2502692ddcdbcbfaa0c8e021e848525ac23 Mon Sep 17 00:00:00 2001 From: fgo Date: Tue, 13 May 2025 14:23:36 +0200 Subject: [PATCH 1/2] Add GitHub CI Action --- .github/workflows/ci.yml | 144 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..18c79fa3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,144 @@ +name: Link CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + macos: + strategy: + matrix: + include: + - os: macos-14 + configuration: Debug + xcode-version: 15.4.0 + - os: macos-14 + configuration: Release + xcode-version: 16.2.0 + fail-fast: false + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Configure + run: | + sudo xcode-select -s '/Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer' + cmake -B build -GNinja . -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} + - name: Build + run: cmake --build build --config ${{ matrix.configuration }} + - name: Test + run: | + ./build/bin/LinkCoreTest + ./build/bin/LinkDiscoveryTest + + linux: + strategy: + matrix: + include: + - os: ubuntu-22.04 + configuration: Debug + cxx: clang++-13 + audio-driver: Alsa + - os: ubuntu-22.04 + configuration: Release + cxx: clang++-14 + audio-driver: Jack + - os: ubuntu-22.04 + configuration: Debug + cxx: g++-10 + audio-driver: Jack + - os: ubuntu-22.04 + configuration: Release + cxx: g++-11 + audio-driver: Alsa + fail-fast: false + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Set up + run: | + sudo apt-get update + sudo apt-get install -y cmake libjack-dev portaudio19-dev valgrind + - name: Configure + env: + CXX: ${{ matrix.cxx }} + run: | + args=(-Bbuild . -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.configuration }}) + if [[ "${{ matrix.audio-driver }}" == "Jack" ]]; then + args+=(-DLINK_BUILD_JACK=ON) + fi + cmake "${args[@]}" + - name: Build + run: cmake --build build --config ${{ matrix.configuration }} + - name: Test + run: | + valgrind --leak-check=full --show-reachable=yes --gen-suppressions=all --error-exitcode=1 --track-origins=yes --suppressions=ci/memcheck.supp build/bin/LinkCoreTest + valgrind --leak-check=full --show-reachable=yes --gen-suppressions=all --error-exitcode=1 --track-origins=yes --suppressions=ci/memcheck.supp build/bin/LinkDiscoveryTest + + windows: + strategy: + matrix: + include: + - os: windows-2022 + generator: "Visual Studio 17 2022" + configuration: Debug + audio-driver: Asio + thread-description: ON + - os: windows-2022 + generator: "Visual Studio 17 2022" + configuration: Release + audio-driver: Wasapi + thread-description: OFF + fail-fast: false + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Configure + run: | + $args = @("-Bbuild", ".", "-DCMAKE_BUILD_TYPE=${{ matrix.configuration }}", "-G${{ matrix.generator }}") + if ("${{ matrix.audio-driver }}" -eq "Asio") { + $args += "-DLINK_BUILD_ASIO=ON" + } + if ("${{ matrix.audio-driver }}" -eq "Wasapi") { + $args += "-DLINK_BUILD_ASIO=OFF" + } + if ("${{ matrix.thread-description }}" -eq "ON") { + $args += "-DLINK_WINDOWS_SETTHREADDESCRIPTION=ON" + } + cmake @args + - name: Build + run: cmake --build build --config ${{ matrix.configuration }} + - name: Test + run: | + .\build\bin\${{ matrix.configuration }}\LinkCoreTest.exe + .\build\bin\${{ matrix.configuration }}\LinkDiscoveryTest.exe + + esp-idf: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Build ESP-IDF + run: docker run --rm -v ${{ github.workspace }}:/link -w /link/examples/esp32 -e LC_ALL=C.UTF-8 espressif/idf:v5.1.1 idf.py build + + check-formatting: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Check Formatting + run: docker run -v ${{ github.workspace }}:/link dalg24/clang-format:18.04.0 python /link/ci/check-formatting.py -c /usr/bin/clang-format-6.0 From d4f1d5dbac617e6e192ec3cf61e2f99d60e8465a Mon Sep 17 00:00:00 2001 From: fgo Date: Mon, 19 May 2025 14:02:09 +0200 Subject: [PATCH 2/2] Remove .appveyor.yml and some unused python scripts --- .appveyor.yml | 134 --------------------------------------- ci/build.py | 72 --------------------- ci/configure.py | 100 ----------------------------- ci/run-tests.py | 93 --------------------------- ci/run_valgrind_tests.sh | 6 -- 5 files changed, 405 deletions(-) delete mode 100644 .appveyor.yml delete mode 100755 ci/build.py delete mode 100755 ci/configure.py delete mode 100755 ci/run-tests.py delete mode 100755 ci/run_valgrind_tests.sh diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 82606c3c..00000000 --- a/.appveyor.yml +++ /dev/null @@ -1,134 +0,0 @@ -clone_depth: 50 - -branches: - only: - - master - -environment: - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey - CONFIGURATION: Release - XCODE_VERSION: 13.4.1 - - APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey - CONFIGURATION: Debug - XCODE_VERSION: 14.2.0 - - APPVEYOR_BUILD_WORKER_IMAGE: macos-ventura - CONFIGURATION: Release - XCODE_VERSION: 14.3.0 - - APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma - CONFIGURATION: Debug - XCODE_VERSION: 15.2.0 - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - AUDIO_DRIVER: Alsa - CONFIGURATION: Release - GENERATOR: Ninja - CXX: clang++-12 - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - AUDIO_DRIVER: Jack - CONFIGURATION: Debug - GENERATOR: Ninja - CXX: clang++-11 - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - AUDIO_DRIVER: Alsa - CONFIGURATION: Release - GENERATOR: Ninja - CXX: clang++-10 - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2204 - AUDIO_DRIVER: Alsa - CONFIGURATION: Release - GENERATOR: Ninja - CXX: g++-11 - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2204 - AUDIO_DRIVER: Jack - CONFIGURATION: Debug - GENERATOR: Ninja - CXX: g++-10 - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - AUDIO_DRIVER: Alsa - CONFIGURATION: Release - GENERATOR: Ninja - CXX: g++-9 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - AUDIO_DRIVER: Wasapi - THREAD_DESCRIPTION: OFF - CONFIGURATION: Debug - GENERATOR: Visual Studio 14 2015 Win64 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - AUDIO_DRIVER: Wasapi - THREAD_DESCRIPTION: OFF - CONFIGURATION: Release - GENERATOR: Visual Studio 14 2015 Win64 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - AUDIO_DRIVER: Asio - THREAD_DESCRIPTION: OFF - CONFIGURATION: Release - GENERATOR: Visual Studio 15 2017 Win64 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - AUDIO_DRIVER: Asio - THREAD_DESCRIPTION: ON - CONFIGURATION: Release - GENERATOR: Visual Studio 16 2019 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - AUDIO_DRIVER: Wasapi - THREAD_DESCRIPTION: ON - CONFIGURATION: Debug - GENERATOR: Visual Studio 17 2022 - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - ESP_IDF: true - IDF_RELEASE: v5.1.1 - - APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 - FORMATTING: true - -install: - - git submodule update --init --recursive - -for: - - matrix: - only: - - APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey - - APPVEYOR_BUILD_WORKER_IMAGE: macos-ventura - - APPVEYOR_BUILD_WORKER_IMAGE: macos-sonoma - build_script: - - sudo xcode-select -s /Applications/Xcode-$XCODE_VERSION.app - - python3 ci/configure.py --generator Xcode - - python3 ci/build.py --configuration $CONFIGURATION - test_script: - - python3 ci/run-tests.py --target LinkCoreTest - - python3 ci/run-tests.py --target LinkDiscoveryTest - - matrix: - only: - # Ubuntu2004 but not ESP_IDF or FORMATTING - - GENERATOR: Ninja - install: - - git submodule update --init --recursive - - sudo apt-get install -y libjack-dev portaudio19-dev valgrind - build_script: - - python3 -m pip install setuptools - - python3 ci/configure.py --audio-driver $AUDIO_DRIVER --generator "$GENERATOR" --configuration $CONFIGURATION - - python3 ci/build.py - test_script: - - python3 ci/run-tests.py --target LinkCoreTest --valgrind - - python3 ci/run-tests.py --target LinkDiscoveryTest --valgrind - - matrix: - only: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 - build_script: - - py -3 -m pip install setuptools - - py -3 ci/configure.py --audio-driver %AUDIO_DRIVER% --thread-description %THREAD_DESCRIPTION% --generator "%GENERATOR%" --flags="-DCMAKE_SYSTEM_VERSION=10.0.18362.0" - - py -3 ci/build.py --configuration %CONFIGURATION% - test_script: - - py -3 ci/run-tests.py --target LinkCoreTest - - py -3 ci/run-tests.py --target LinkDiscoveryTest - - matrix: - only: - - ESP_IDF: true - build_script: - - docker run --rm -v $APPVEYOR_BUILD_FOLDER:/link -w /link/examples/esp32 -e LC_ALL=C.UTF-8 espressif/idf:$IDF_RELEASE idf.py build - - matrix: - only: - - FORMATTING: true - build_script: - - docker run -v $APPVEYOR_BUILD_FOLDER:/link dalg24/clang-format:18.04.0 python /link/ci/check-formatting.py -c /usr/bin/clang-format-6.0 diff --git a/ci/build.py b/ci/build.py deleted file mode 100755 index 2413071c..00000000 --- a/ci/build.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python - -import argparse -import logging -import os -import sys - -from distutils.spawn import find_executable -from subprocess import call - - -def parse_args(): - arg_parser = argparse.ArgumentParser() - - arg_parser.add_argument( - '--cmake', - default=find_executable("cmake"), - help='Path to CMake executable (default: %(default)s)') - - arg_parser.add_argument( - '-c', '--configuration', - help='Build configuration to use (not supported by IDE generators)') - - arg_parser.add_argument( - '-a', '--arguments', - help='Arguments to pass to builder') - - return arg_parser.parse_args(sys.argv[1:]) - - -def build_cmake_args(args, build_dir): - if args.cmake is None: - logging.error('CMake not found, please use the --cmake option') - return None - - cmake_args = [] - cmake_args.append(args.cmake) - cmake_args.append('--build') - cmake_args.append(build_dir) - - if args.configuration is not None: - cmake_args.append('--config') - cmake_args.append(args.configuration) - - if args.arguments is not None: - cmake_args.append('--') - for arg in args.arguments.split(): - cmake_args.append(arg) - - return cmake_args - - -def build(args): - scripts_dir = os.path.dirname(os.path.realpath(__file__)) - root_dir = os.path.join(scripts_dir, os.pardir) - build_dir = os.path.join(root_dir, 'build') - if not os.path.exists(build_dir): - logging.error( - 'Build directory not found, did you forget to run the configure.py script?') - return 2 - - cmake_args = build_cmake_args(args, build_dir) - if cmake_args is None: - return 1 - - logging.info('Running CMake') - return call(cmake_args) - - -if __name__ == '__main__': - logging.basicConfig(format='%(message)s', level=logging.INFO, stream=sys.stdout) - sys.exit(build(parse_args())) diff --git a/ci/configure.py b/ci/configure.py deleted file mode 100755 index 7462052e..00000000 --- a/ci/configure.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env python - -import argparse -import logging -import os -import shutil -import sys - -from distutils.spawn import find_executable -from subprocess import call - - -def parse_args(): - arg_parser = argparse.ArgumentParser() - - arg_parser.add_argument( - '-a', '--audio-driver', - help='Audio driver to build (Windows only, default: %(default)s)') - - arg_parser.add_argument( - '--cmake', - default=find_executable("cmake"), - help='Path to CMake executable (default: %(default)s)') - - arg_parser.add_argument( - '-c', '--configuration', - help='Build configuration to use (not supported by IDE generators)') - - arg_parser.add_argument( - '-g', '--generator', - help='CMake generator to use (default: Determined by CMake)') - - arg_parser.add_argument( - '-f', '--flags', - help='Additional CMake flags') - - arg_parser.add_argument( - '--thread-description', - help='Set thread description. (Windows only)') - - return arg_parser.parse_args(sys.argv[1:]) - - -def build_cmake_args(args): - if args.cmake is None: - logging.error('CMake not found, please use the --cmake option') - return None - - cmake_args = [] - cmake_args.append(args.cmake) - - if args.generator is not None: - cmake_args.append('-G') - cmake_args.append(args.generator) - - if args.configuration is not None: - cmake_args.append('-DCMAKE_BUILD_TYPE=' + args.configuration) - - if args.flags is not None: - cmake_args.append(args.flags) - - if sys.platform == 'win32': - if args.audio_driver is None or args.audio_driver == 'Asio': - cmake_args.append('-DLINK_BUILD_ASIO=ON') - else: - cmake_args.append('-DLINK_BUILD_ASIO=OFF') - if args.thread_description == 'ON': - cmake_args.append('-DLINK_WINDOWS_SETTHREADDESCRIPTION=ON') - elif 'linux' in sys.platform: - if args.audio_driver == 'Jack': - cmake_args.append('-DLINK_BUILD_JACK=ON') - - # This must always be last - cmake_args.append('..') - return cmake_args - - -def configure(args): - scripts_dir = os.path.dirname(os.path.realpath(__file__)) - root_dir = os.path.join(scripts_dir, os.pardir) - build_dir = os.path.join(root_dir, 'build') - if os.path.exists(build_dir): - logging.info('Removing existing build directory') - shutil.rmtree(build_dir) - - logging.debug('Creating build directory') - os.mkdir(build_dir) - os.chdir(build_dir) - - cmake_args = build_cmake_args(args) - if cmake_args is None: - return 1 - - logging.info('Running CMake') - return call(cmake_args) - - -if __name__ == '__main__': - logging.basicConfig(format='%(message)s', level=logging.INFO, stream=sys.stdout) - sys.exit(configure(parse_args())) diff --git a/ci/run-tests.py b/ci/run-tests.py deleted file mode 100755 index 1b3d360d..00000000 --- a/ci/run-tests.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python - -import argparse -import logging -import os -import sys - -from distutils.spawn import find_executable -from subprocess import call - - -def parse_args(): - arg_parser = argparse.ArgumentParser() - - arg_parser.add_argument( - '-t', '--target', - help='Target to test') - - arg_parser.add_argument( - '--valgrind', default=False, - help='Run with Valgrind', - action='store_true') - - return arg_parser.parse_args(sys.argv[1:]) - - -def get_system_exe_extension(): - # Should return 'win32' even on 64-bit Windows - if sys.platform == 'win32': - return '.exe' - else: - return '' - - -def find_exe(name, path): - for root, dirs, files in os.walk(path): - if name in files: - return os.path.join(root, name) - - -def build_test_exe_args(args, build_dir): - if args.target is None: - logging.error('Target not specified, please use the --target option') - return None - - test_exe = find_exe(args.target + get_system_exe_extension(), build_dir) - if not os.path.exists(test_exe): - logging.error('Could not find test executable for target {}, ' - 'did you forget to build?'.format(args.target)) - else: - logging.debug('Test executable is: {}'.format(test_exe)) - - test_exe_args = [test_exe] - - if args.valgrind is not False: - valgrind_exe = find_executable('valgrind') - if valgrind_exe is None: - logging.error('Valgrind not found, cannot continue') - return None - - test_exe_args = [ - valgrind_exe, '--leak-check=full', '--show-reachable=yes', - '--gen-suppressions=all', '--error-exitcode=1', '--track-origins=yes', - '--suppressions=../ci/memcheck.supp', test_exe] - - return test_exe_args - - -def run_tests(args): - scripts_dir = os.path.dirname(os.path.realpath(__file__)) - root_dir = os.path.join(scripts_dir, os.pardir) - build_dir = os.path.join(root_dir, 'build') - if not os.path.exists(build_dir): - logging.error( - 'Build directory not found, did you forget to run the configure.py script?') - return 2 - - os.chdir(build_dir) - env = os.environ.copy() - env['GLIBCXX_FORCE_NEW'] = '1' - - test_exe_args = build_test_exe_args(args, build_dir) - if test_exe_args is None: - return 1 - - logging.info(test_exe_args) - logging.info('Running Tests for {}'.format(args.target)) - return call(test_exe_args, env=env) - - -if __name__ == '__main__': - logging.basicConfig(format='%(message)s', level=logging.INFO, stream=sys.stdout) - sys.exit(run_tests(parse_args())) diff --git a/ci/run_valgrind_tests.sh b/ci/run_valgrind_tests.sh deleted file mode 100755 index a3880ce0..00000000 --- a/ci/run_valgrind_tests.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -python configure.py --generator Ninja -python build.py -python run-tests.py --target LinkCoreTest --valgrind -python run-tests.py --target LinkDiscoveryTest --valgrind