From a3b2626a9ca4dbba18d11c87351194173b005f15 Mon Sep 17 00:00:00 2001 From: jatin Date: Mon, 14 Oct 2024 20:12:45 -0700 Subject: [PATCH] Set up GitHub Actions --- .github/workflows/bench.yml | 80 ++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 92 +++++++++++++++++++++++++++++++++++++ test/CMakeLists.txt | 2 +- 3 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/bench.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml new file mode 100644 index 0000000..feec8ac --- /dev/null +++ b/.github/workflows/bench.yml @@ -0,0 +1,80 @@ +name: Bench + +on: + pull_request: + branches: + - main + - develop + push: + branches: + - ci + + workflow_dispatch: + +jobs: + build_and_test: + name: Build/Test plugin on ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false # show all errors for each platform (vs. cancel jobs on error) + matrix: + include: + - name: Linux + os: ubuntu-22.04 + cmake_args: "-DCMAKE_LINKER_TYPE=MOLD -DCMAKE_C_COMPILER=clang-15 -DCMAKE_CXX_COMPILER=clang++-15" + nparallel: 4 + - name: Windows + os: windows-2022 + cmake_args: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl + nparallel: 4 + - name: MacOS + os: macos-14 + cmake_args: "" + nparallel: 4 + + steps: + - name: Install Linux Deps + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt install libasound2-dev libcurl4-openssl-dev libx11-dev libxinerama-dev libxext-dev libfreetype6-dev libwebkit2gtk-4.0-dev libglu1-mesa-dev libjack-jackd2-dev + sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" + sudo apt install clang-15 -y + + - name: Install Ninja + if: runner.os == 'Linux' || runner.os == 'Windows' + uses: seanmiddleditch/gha-setup-ninja@master + + - name: Get latest CMake + if: runner.os == 'Linux' || runner.os == 'Windows' + uses: lukka/get-cmake@latest + + - uses: rui314/setup-mold@v1 + if: runner.os == 'Linux' + + - name: Upgrade LLVM + if: runner.os == 'Windows' + run: choco upgrade llvm --version=18.1.8 --allow-downgrade + + - name: Add msbuild to PATH + if: runner.os == 'Windows' + uses: microsoft/setup-msbuild@v2 + + - name: Setup MSVC devcmd + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: recursive + token: ${{ secrets.OUR_GITHUB_PAT }} + + - name: Cmake Configure + run: cmake -Bbuild -G"Ninja Multi-Config" -DCHOWDSP_FFT_TESTING=ON ${{ matrix.cmake_args }} + + - name: Build Benchmarks + run: cmake --build build --config Release --parallel ${{ matrix.nparallel }} --target bench_chowdsp_fft + + - name: Run Benchmarks + run: ./build/bench/Release/bench_chowdsp_fft diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..1190f57 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,92 @@ +name: Test + +on: + pull_request: + branches: + - main + - develop + push: + branches: + - ci + + workflow_dispatch: + +jobs: + build_and_test: + name: Build/Test plugin on ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false # show all errors for each platform (vs. cancel jobs on error) + matrix: + include: + - name: Linux + os: ubuntu-22.04 + cmake_args: "-DCMAKE_LINKER_TYPE=MOLD -DCMAKE_C_COMPILER=clang-15 -DCMAKE_CXX_COMPILER=clang++-15" + nparallel: 4 + - name: Windows + os: windows-2022 + cmake_args: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl + nparallel: 4 + - name: MacOS + os: macos-14 + cmake_args: "-D\"CMAKE_OSX_ARCHITECTURES=arm64;x86_64\"" + nparallel: 4 + + steps: + - name: Install Linux Deps + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt install libasound2-dev libcurl4-openssl-dev libx11-dev libxinerama-dev libxext-dev libfreetype6-dev libwebkit2gtk-4.0-dev libglu1-mesa-dev libjack-jackd2-dev + sudo apt-add-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" + sudo apt install clang-15 -y + + - name: Install Ninja + if: runner.os == 'Linux' || runner.os == 'Windows' + uses: seanmiddleditch/gha-setup-ninja@master + + - name: Get latest CMake + if: runner.os == 'Linux' || runner.os == 'Windows' + uses: lukka/get-cmake@latest + + - uses: rui314/setup-mold@v1 + if: runner.os == 'Linux' + + - name: Upgrade LLVM + if: runner.os == 'Windows' + run: choco upgrade llvm --version=18.1.8 --allow-downgrade + + - name: Add msbuild to PATH + if: runner.os == 'Windows' + uses: microsoft/setup-msbuild@v2 + + - name: Setup MSVC devcmd + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1 + + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: recursive + token: ${{ secrets.OUR_GITHUB_PAT }} + + - name: Cmake Configure + run: cmake -Bbuild -G"Ninja Multi-Config" -DCHOWDSP_FFT_TESTING=ON ${{ matrix.cmake_args }} + + - name: Build Test C++ (Debug) + run: cmake --build build --config Debug --parallel ${{ matrix.nparallel }} --target test_chowdsp_fft_cpp + + - name: Run Test C++ (Debug) + run: ./build/test/Debug/test_chowdsp_fft_cpp + + - name: Build Test C (Debug) + run: cmake --build build --config Debug --parallel ${{ matrix.nparallel }} --target test_chowdsp_fft_c + + - name: Run Test C (Debug) + run: ./build/test/Debug/test_chowdsp_fft_c + + - name: Build Test C++ (Release) + run: cmake --build build --config Release --parallel ${{ matrix.nparallel }} --target test_chowdsp_fft_cpp + + - name: Run Test C++ (Release) + run: ./build/test/Release/test_chowdsp_fft_cpp diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f91c8cc..45755ab 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,7 +3,7 @@ message(STATUS "chowdsp_fft -- Configuring tests") include(CPM.cmake) CPMAddPackage("gh:catchorg/Catch2@3.2.1") include(${Catch2_SOURCE_DIR}/extras/Catch.cmake) -CPMAddPackage("bb:jpommier/pffft#master") +CPMAddPackage("bb:jpommier/pffft#fbc4058602803f40dc554b8a5d2bcc694c005f2f") add_executable(test_chowsdp_fft_cpp test.cpp ${pffft_SOURCE_DIR}/pffft.c) target_link_libraries(test_chowsdp_fft_cpp PRIVATE chowdsp_fft Catch2::Catch2WithMain)