ci(release): build linux-aarch64 on native ARM runner instead of cross #4
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
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| platform: linux | |
| arch: x86_64 | |
| ext: tar.gz | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| platform: windows | |
| arch: x86_64 | |
| ext: zip | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| platform: macos | |
| arch: x86_64 | |
| ext: tar.gz | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| platform: macos | |
| arch: aarch64 | |
| ext: tar.gz | |
| # Native aarch64 Linux runner avoids the `cross` tool entirely. | |
| # Previous attempts with `cross` failed on the rusqlite bundled | |
| # SQLite compile because the default docker image lacked the | |
| # necessary aarch64 C toolchain pieces. GitHub's `ubuntu-24.04-arm` | |
| # runner (free for public repos) builds natively — faster, simpler, | |
| # and rusqlite/aes-gcm/sha2/etc. compile against the system gcc | |
| # without any cross-toolchain configuration. | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-24.04-arm | |
| platform: linux | |
| arch: aarch64 | |
| ext: tar.gz | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Build release binary | |
| run: cargo build --release --target ${{ matrix.target }} | |
| shell: bash | |
| - name: Package (Unix) | |
| if: matrix.platform != 'windows' | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| tar czf ../../../opensentry-cloudnode-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz opensentry-cloudnode | |
| cd ../../.. | |
| - name: Package (Windows) | |
| if: matrix.platform == 'windows' | |
| shell: pwsh | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| Compress-Archive -Path opensentry-cloudnode.exe -DestinationPath ../../../opensentry-cloudnode-${{ matrix.platform }}-${{ matrix.arch }}.zip | |
| cd ../../.. | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: opensentry-cloudnode-${{ matrix.platform }}-${{ matrix.arch }} | |
| path: opensentry-cloudnode-${{ matrix.platform }}-${{ matrix.arch }}.${{ matrix.ext }} | |
| release: | |
| name: Create Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: artifacts/**/* |