Skip to content

Commit

Permalink
ci: restore apple x86_64 target
Browse files Browse the repository at this point in the history
In [1], we migrated macos builds from x86_64 to aarch64.
There are still plenty of x86_64 macs running around, and
our CI binaries should support them if we can. Ensure we
cross-compile for x86_64 as well.

[1]: 46a0222
  • Loading branch information
cbs228 committed Jan 19, 2025
1 parent fc50ae3 commit 7725828
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 5 deletions.
81 changes: 79 additions & 2 deletions .github/workflows/rust_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ jobs:
file: ${{ env.samedec_target_exe }}
overwrite: true

# MacOS build, on whatever machine github has available
release_macos:
# MacOS build, aarch64
release_macos_aarch64:
runs-on: macos-latest

needs: vendor_sources
Expand Down Expand Up @@ -297,3 +297,80 @@ jobs:
prerelease: true
file: ${{ env.samedec_target_exe }}
overwrite: true

# MacOS build, x86_64
release_macos_x86_64:
runs-on: macos-latest

needs: vendor_sources

env:
CARGO_BUILD_TARGET: x86_64-apple-darwin
CARGO_NET_OFFLINE: "true"
CARGO_INSTALL_ROOT: "install/"
RUSTFLAGS: '-C strip=symbols'
samedec_exe: 'install/bin/samedec'
samedec_target_exe: install/bin/samedec-x86_64-apple-darwin

steps:
- uses: actions/checkout@v3

- name: Record environment
run: cargo version

- uses: actions/cache/restore@v4
name: Restore crate cargo-vendor cache
with:
path: |
.cargo
vendor
key: cargo-vendor-release-${{ hashFiles('**/Cargo.lock') }}
enableCrossOsArchive: true
fail-on-cache-miss: true

- name: Build
run: |
mkdir -p 'install' &&
cargo fetch --locked &&
cargo build --offline --tests --frozen --release --workspace
- name: Test and install
run: |
cargo test --offline --frozen --release --workspace &&
cargo install --offline --frozen --path=crates/samedec
- name: Run integration tests
run: |
pushd sample &&
./test.sh &&
popd
- name: Copy artifact
run: |
cp "$samedec_exe" "$samedec_target_exe"
- name: Store artifact
uses: actions/upload-artifact@v3
with:
name: samedec-${{ env.CARGO_BUILD_TARGET }}
path: ${{ env.samedec_target_exe }}
retention-days: 3

- name: Upload tagged release
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/samedec-')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.samedec_target_exe }}
overwrite: true

- name: Upload nightly release
uses: svenstaro/upload-release-action@v2
if: github.ref == 'refs/heads/develop'
with:
tag: "latest"
release_name: "Nightly Release"
body: "This is a rolling release built from the latest `develop` branch."
prerelease: true
file: ${{ env.samedec_target_exe }}
overwrite: true
13 changes: 10 additions & 3 deletions .github/workflows/rust_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,16 @@ jobs:
- name: Run integration tests
shell: bash
run: |
pushd sample
./test.sh
popd
pushd sample && ./test.sh && popd
- name: Cross-compile macOS target for x86_64 (apple only)
shell: bash
if: ${{ matrix.os == macos-latest }}
run: |
rustup target add x86_64-apple-darwin && \
SDKROOT="$(xcrun -sdk macosx --show-sdk-path)" && \
MACOSX_DEPLOYMENT_TARGET="$(xcrun -sdk macosx --show-sdk-platform-version)" && \
cargo test --frozen -p samedec --verbose --target=x86_64-apple-darwin
# Linux builds within our containerized release environment
test_samedec_containerized:
Expand Down

0 comments on commit 7725828

Please sign in to comment.