diff --git a/.github/workflows/windows-latest.yaml b/.github/workflows/windows-latest.yaml new file mode 100644 index 0000000..946057d --- /dev/null +++ b/.github/workflows/windows-latest.yaml @@ -0,0 +1,175 @@ +name: windows-latest + +on: + workflow_dispatch: # lets you run a build from the UI + push: + +# When pushing new commits, cancel any running builds on that branch +concurrency: + group: windows-latest-${{ github.ref }} + cancel-in-progress: true + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + CMAKE_CONFIGURATION_TYPES: Debug;Release;RelWithDebInfo;MinSizeRel + BUILD_TYPE: Release + BUILD_DIR: Builds + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DISPLAY: :0 # linux pluginval needs this + CMAKE_BUILD_PARALLEL_LEVEL: 3 # Use up to 3 cpus to build juceaide, etc + VCPKG_MAX_CONCURRENCY: 3 + SCCACHE_GHA_ENABLED: "true" + IPP_DIR: C:\Program Files (x86)\Intel\oneAPI\ipp\latest\lib\cmake\ipp + STONEYDSP_BIQUADS_CURRENT_VERSION: 0.0.1 + STONEYDSP_CURRENT_JUCE_VERSION: 7.0.9 + +jobs: + windows: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: windows-latest + + steps: + + # This is just easier than debugging different compilers on different platforms + - name: Set up Clang + uses: egor-tensin/setup-clang@v1 + + - name: Cache IPP + id: cache-ipp + uses: actions/cache@v4 + with: + key: ipp-v4 + path: C:\Program Files (x86)\Intel + + - name: Install IPP + if: (steps.cache-ipp.outputs.cache-hit != 'true') + shell: bash + run: | + curl --output oneapi.exe https://registrationcenter-download.intel.com/akdlm/IRC_NAS/8d158661-ca8f-4e66-b5ea-3e0b3d00836a/w_ipp_oneapi_p_2021.10.1.15_offline.exe + ./oneapi.exe -s -x -f oneapi + ./oneapi/bootstrapper.exe -s -c --action install --components=intel.oneapi.win.ipp.devel --eula=accept -p=NEED_VS2022_INTEGRATION=1 --log-dir=. + + - name: Save IPP cache (even on CI fail) + if: (steps.cache-ipp.outputs.cache-hit != 'true') + uses: actions/cache/save@v4 + with: + path: C:\Program Files (x86)\Intel + key: ipp-v4 + + - name: Install Ninja + shell: bash + run: choco install ninja sccache + + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: true # Get JUCE populated (if used) + + - name: Cache the build + uses: mozilla-actions/sccache-action@v0.0.4 + + - name: vcpkg install + # You may pin to the exact commit or the version. + # uses: johnwason/vcpkg-action@7c4b562bb35ef5a01d9d728acc90100b107dee4d + uses: johnwason/vcpkg-action@v6 + with: + # List of packages to build, separated by spaces. Cannot be used with manifest-dir + # pkgs: # optional + # vcpkg triplet to use + triplet: x64-windows + # Extra vcpkg command line args (optional) + # extra-args: --allow-unsupported # optional + # Additional cache key component (optional) + cache-key: windows-latest # optional + # Disable cache (useful for release builds) + # disable-cache: # optional, default is false + # vcpkg revision to checkout. + revision: master # optional, default is + # GitHub token to authenticate API requests. Recommended to use github.token + token: ${{ github.token }} + # Directory containing vcpkg.json manifest file. Cannot be used with pkgs. + manifest-dir: ${{ github.workspace }} # optional, default is + # Use vcpkg built-in GitHub binary caching. If not specified, will use the dry-run based file cache. + github-binarycache: true + # Fetch depth for vcpkg checkout + # fetch-depth: # optional, default is 1 + + - name: Use Node.js 16.18.0 + uses: actions/setup-node@v4 + with: + node-version: 16.18.0 + + - name: npm install + run: npm install + + - name: Configure + working-directory: ${{github.workspace}} + shell: bash + # Configure CMake in a 'bin' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: >- + cmake -S${PWD} + -B${PWD}/${{ env.BUILD_DIR }} + -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} + -DCMAKE_C_COMPILER_LAUNCHER=sccache + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + -DSTONEYDSP_BIQUADS_BUILD_TESTS:BOOL=TRUE + -DCMAKE_INSTALL_PREFIX=${PWD}/install + -DVCPKG_HOST_TRIPLET:STRING=x64-windows + -DVCPKG_TARGET_TRIPLET:STRING=x64-windows + -DVCPKG_MANIFEST_MODE:BOOL=FALSE + -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${PWD}/vcpkg/scripts/buildsystems/vcpkg.cmake" + -G "Ninja" + --compile-no-warning-as-error + --no-warn-unused-cli + + - name: Build + # Build your program with the given configuration + run: >- + cmake + --build ${PWD}/${{ env.BUILD_DIR }} + --config ${{env.BUILD_TYPE}} + --parallel 4 + --target all + + - name: Test + working-directory: ${{ github.workspace }} + shell: bash + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: >- + ctest + --test-dir ${PWD}/${{ env.BUILD_DIR }} + -j4 + --rerun-failed + --output-on-failure + --verbose + + - name: Install + shell: bash + working-directory: ${{ github.workspace }} + # Install StoneyDSP with the given configuration + run: cmake --install ${PWD}/${{ env.BUILD_DIR }} + + - name: Zip Source + shell: bash + working-directory: ${{ github.workspace }} + # Pack the StoneyDSP source code with the given configuration + run: cpack --config ${PWD}/${{ env.BUILD_DIR }}/CPackSourceConfig.cmake -B install -G ZIP + + - name: Zip Build + shell: bash + working-directory: ${{github.workspace}} + # Pack the StoneyDSP source code with the given configuration + run: cpack --config ${PWD}/${{ env.BUILD_DIR }}/CPackConfig.cmake -B install -G ZIP + + - name: Upload Zip Build + uses: actions/upload-artifact@v4 + with: + name: StoneyDSP-v${{ env.STONEYDSP_BIQUADS_CURRENT_VERSION }}-Windows-AMD64-JUCE-v${{ env.STONEYDSP_CURRENT_JUCE_VERSION }}.zip + path: '${{ github.workspace }}/install/StoneyDSP-v${{ env.STONEYDSP_BIQUADS_CURRENT_VERSION }}-Windows-AMD64-JUCE-v${{ env.STONEYDSP_CURRENT_JUCE_VERSION }}.zip' + + - name: Get Artifacts + uses: actions/download-artifact@v4