Build Intel macOS binary on macos-14 via cross-compilation (macos-13 … #3
Workflow file for this run
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
| # Builds snapcode-ls for every platform and attaches the archives to a | |
| # GitHub release whenever a `v*` tag is pushed. The Zed extension downloads | |
| # these assets automatically (see src/lib.rs), so the asset names below must | |
| # stay in sync with the `asset_name` format there: | |
| # | |
| # snapcode-ls-{arch}-{os}.{tar.gz|zip} | |
| name: Release snapcode-ls | |
| on: | |
| push: | |
| tags: ["v*"] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-22.04 | |
| target: x86_64-unknown-linux-gnu | |
| asset: snapcode-ls-x86_64-linux.tar.gz | |
| - os: ubuntu-22.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| asset: snapcode-ls-aarch64-linux.tar.gz | |
| # Cross-compiled from an Apple Silicon runner (macos-13 Intel | |
| # runners are retired). | |
| - os: macos-14 | |
| target: x86_64-apple-darwin | |
| asset: snapcode-ls-x86_64-macos.tar.gz | |
| - os: macos-14 | |
| target: aarch64-apple-darwin | |
| asset: snapcode-ls-aarch64-macos.tar.gz | |
| - os: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| asset: snapcode-ls-x86_64-windows.zip | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build | |
| working-directory: snapcode-ls | |
| run: cargo build --release --target ${{ matrix.target }} | |
| - name: Package (unix) | |
| if: runner.os != 'Windows' | |
| run: tar -czf ${{ matrix.asset }} -C snapcode-ls/target/${{ matrix.target }}/release snapcode-ls | |
| - name: Package (windows) | |
| if: runner.os == 'Windows' | |
| run: Compress-Archive -Path snapcode-ls/target/${{ matrix.target }}/release/snapcode-ls.exe -DestinationPath ${{ matrix.asset }} | |
| - name: Upload release asset | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{ matrix.asset }} |