This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build MacOS | ||
|
Check failure on line 1 in .github/workflows/macos-test.yml
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| ref: | ||
| description: 'Tag to build' | ||
| required: true | ||
| project_name: | ||
| description: 'The vanagon project to build' | ||
| required: false | ||
| default: 'agent-runtime-main' | ||
| platform_list: | ||
| description: 'A comma-separated list of platforms to build for. Do not include spaces. If not provided, will use the default list of macOS platforms.' | ||
| required: false | ||
| type: string | ||
| default: 'osx-15-arm64,osx-15-x86_64' | ||
| permissions: | ||
| contents: read # minimal required permissions to clone repo | ||
| env: | ||
| ENDPOINT_URL: ${{ secrets.S3_ENDPOINT_URL }} | ||
| BUCKET_NAME: ${{ secrets.S3_ARTIFACTS_BUCKET_NAME }} | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| # https://github.com/boto/boto3/issues/4398#issuecomment-2619946229 | ||
| AWS_REQUEST_CHECKSUM_CALCULATION: "WHEN_REQUIRED" | ||
| AWS_RESPONSE_CHECKSUM_VALIDATION: "WHEN_REQUIRED" | ||
| VANAGON_LOCATION: 'https://github.com/openvoxproject/vanagon#macos_test' | ||
| jobs: | ||
| build_macos: | ||
| timeout-minutes: 7200 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| platform: ${{ fromJson(format('["{0}"]', join(split(inputs.platform_list, ','), '","'))) }} | ||
| runs-on: macos-latest | ||
| name: Build ${{ inputs.project_name }} for ${{ matrix.platform }} | ||
| steps: | ||
| - name: Checkout code at tag | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| ref: ${{ inputs.ref }} | ||
| - name: test | ||
| run: | | ||
| command -v sudo | ||
| - name: Set architecture variables | ||
| id: arch | ||
| run: | | ||
| if [[ "${{ matrix.platform }}" == *"x86_64"* ]]; then | ||
| echo "arch=x86_64" >> $GITHUB_OUTPUT | ||
| echo "needs_brew_reinstall=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "arch=arm64" >> $GITHUB_OUTPUT | ||
| echo "needs_brew_reinstall=false" >> $GITHUB_OUTPUT | ||
| fi | ||
| - name: Setup brew and Ruby (x86_64 only) | ||
| if: steps.arch.outputs.needs_brew_reinstall == 'true' | ||
| # We must fully uninstall the existing brew install as we need | ||
| # the x86_64 version, and then we must install Ruby ourselves | ||
| run: | | ||
| brew list --cask | xargs -r brew uninstall --cask --force | ||
| brew list --formula | xargs -r brew uninstall --force --ignore-dependencies | ||
| brew autoremove | ||
| /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" -- --force | ||
| arch -${{ steps.arch.outputs.arch }} /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
| arch -${{ steps.arch.outputs.arch }} /bin/bash -c 'brew install ruby@3.2' | ||
| - name: Install Ruby (arm64 only) | ||
| if: steps.arch.outputs.needs_brew_reinstall == 'false' | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: '3.2.9' | ||
| - name: Bundle install | ||
| run: | | ||
| arch -${{ steps.arch.outputs.arch }} /bin/bash -c 'bundle install --retry=3 && bundle update' | ||
| - name: Run build script | ||
| run: | | ||
| rm -rf output | ||
| arch -${{ steps.arch.outputs.arch }} /bin/bash -c 'bundle exec rake vox:build["${{ inputs.project_name }}","${{ matrix.platform }}"]' | ||
| - name: Install awscli | ||
| run: | | ||
| arch -${{ steps.arch.outputs.arch }} /bin/bash -c 'brew install awscli' | ||
| - name: Upload output to S3 | ||
| run: arch -${{ steps.arch.outputs.arch }} /bin/bash -c 'bundle exec rake vox:upload["${{ inputs.ref }}","${{ matrix.platform }}"]' | ||