From 34535ed0c029ec606827c6a80dcfa3761510e11e Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 8 Mar 2024 04:07:40 +0100 Subject: [PATCH] Create macos-arm-latest.yaml Signed-off-by: Nathan --- .github/workflows/macos-arm-latest.yaml | 187 ++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 .github/workflows/macos-arm-latest.yaml diff --git a/.github/workflows/macos-arm-latest.yaml b/.github/workflows/macos-arm-latest.yaml new file mode 100644 index 0000000..11f2848 --- /dev/null +++ b/.github/workflows/macos-arm-latest.yaml @@ -0,0 +1,187 @@ +name: macos-arm-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: macos-arm-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 + VCPKG_OSX_ARCHITECTURES: "arm64;x86_64" + SCCACHE_GHA_ENABLED: "true" + SCCACHE_CACHE_MULTIARCH: 1 # for macos actions only! + HOMEBREW_NO_INSTALL_CLEANUP: 1 + STONEYDSP_BIQUADS_CURRENT_VERSION: 0.0.1 + STONEYDSP_CURRENT_JUCE_VERSION: 7.0.9 + +jobs: + macos-arm: + # 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: macos-14 + + steps: + + - name: Install JUCE's macOS Deps + run: brew install ninja osxutils autoconf automake libtool m4 curl openssl sccache + + # This block can be removed once 15.1 is default (JUCE requires it when building on macOS 14) + - name: Use latest Xcode on system (macOS) + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + + - 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: arm64-osx + # Extra vcpkg command line args (optional) + # extra-args: --allow-unsupported # optional + # Additional cache key component (optional) + cache-key: macos-14 # 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${{github.workspace}} + -B${{github.workspace}}/${{ env.BUILD_DIR }} + -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} + -DCMAKE_C_COMPILER_LAUNCHER=sccache + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" + -DSTONEYDSP_BIQUADS_BUILD_TESTS:BOOL=TRUE + -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install + -DVCPKG_HOST_TRIPLET:STRING=arm64-osx + -DVCPKG_TARGET_TRIPLET:STRING=arm64-osx + -DVCPKG_MANIFEST_MODE:BOOL=TRUE + -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${{ github.workspace }}/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 ${{github.workspace}}/${{ 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 ${{ github.workspace }}/${{ 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 ${{ github.workspace }}/${{ env.BUILD_DIR }} + + - name: Zip Source + shell: bash + working-directory: ${{ github.workspace }} + # Pack the StoneyDSP source code with the given configuration + run: cpack --config ${{ github.workspace }}/${{ env.BUILD_DIR }}/CPackSourceConfig.cmake -B install -G ZIP + + - name: Tar Source + shell: bash + working-directory: ${{ github.workspace }} + # Pack the StoneyDSP source code with the given configuration + run: cpack --config ${{ github.workspace }}/${{ env.BUILD_DIR }}/CPackSourceConfig.cmake -B install -G TGZ + + - name: Zip Build + shell: bash + working-directory: ${{github.workspace}} + # Pack the StoneyDSP source code with the given configuration + run: cpack --config ${{ github.workspace }}/${{ env.BUILD_DIR }}/CPackConfig.cmake -B install -G ZIP + + - name: Tar Build + shell: bash + working-directory: ${{github.workspace}} + # Pack the StoneyDSP source code with the given configuration + run: cpack --config ${{ github.workspace }}/${{ env.BUILD_DIR }}/CPackConfig.cmake -B install -G TGZ + + # - name: Upload Zip Source + # uses: actions/upload-artifact@v4 + # with: + # name: StoneyDSP-v${{ env.STONEYDSP_BIQUADS_CURRENT_VERSION }}-Source.zip + # path: '${{ github.workspace }}/install/StoneyDSP-v${{ env.STONEYDSP_BIQUADS_CURRENT_VERSION }}-Source.zip' + + # - name: Upload Tar Source + # uses: actions/upload-artifact@v4 + # with: + # name: StoneyDSP-v${{ env.STONEYDSP_BIQUADS_CURRENT_VERSION }}-Source.tar.gz + # path: '${{ github.workspace }}/install/StoneyDSP-v${{ env.STONEYDSP_BIQUADS_CURRENT_VERSION }}-Source.tar.gz' + + - name: Upload Zip Build + uses: actions/upload-artifact@v4 + with: + name: StoneyDSP-v${{ env.STONEYDSP_BIQUADS_CURRENT_VERSION }}-Darwin-arm64-JUCE-v${{ env.STONEYDSP_CURRENT_JUCE_VERSION }}.zip + path: '${{ github.workspace }}/install/StoneyDSP-v${{ env.STONEYDSP_BIQUADS_CURRENT_VERSION }}-Darwin-arm64-JUCE-v${{ env.STONEYDSP_CURRENT_JUCE_VERSION }}.zip' + + - name: Upload Tar Build + uses: actions/upload-artifact@v4 + with: + name: StoneyDSP-v${{ env.STONEYDSP_BIQUADS_CURRENT_VERSION }}-Darwin-arm64-JUCE-v${{ env.STONEYDSP_CURRENT_JUCE_VERSION }}.tar.gz + path: '${{ github.workspace }}/install/StoneyDSP-v${{ env.STONEYDSP_BIQUADS_CURRENT_VERSION }}-Darwin-arm64-JUCE-v${{ env.STONEYDSP_CURRENT_JUCE_VERSION }}.tar.gz' + + - name: Get Artifacts + uses: actions/download-artifact@v4