Skip to content

Commit 19556c1

Browse files
authored
chore: add cross-compile checks to every PR (#1680)
1 parent 14f2233 commit 19556c1

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/ci.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,61 @@ jobs:
2525

2626
- name: Validate PR commits with commitlint
2727
run: sudo npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
28+
29+
check-cross-build:
30+
# This is a stripped-down version of the full release build in .github/workflows/release.yml
31+
# Some key changes:
32+
# - No need to extract the version of the build
33+
# - No need to upload artifacts
34+
# - Fewer architectures, just to verify that some custom cases work
35+
name: Verify cross-compilation
36+
strategy:
37+
matrix:
38+
arch:
39+
[
40+
x86_64-unknown-linux-gnu,
41+
aarch64-apple-darwin,
42+
x86_64-pc-windows-gnu,
43+
]
44+
include:
45+
- arch: x86_64-unknown-linux-gnu
46+
platform: ubuntu-20.04
47+
profile: release
48+
- arch: aarch64-apple-darwin
49+
platform: macos-latest
50+
profile: release
51+
- arch: x86_64-pc-windows-gnu
52+
platform: ubuntu-20.04
53+
profile: release
54+
55+
runs-on: ${{ matrix.platform }}
56+
steps:
57+
- name: Checkout sources
58+
uses: actions/checkout@v4
59+
- name: Get latest version of stable Rust
60+
run: rustup update stable
61+
- name: Install target
62+
run: rustup target add ${{ matrix.arch }}
63+
- uses: Swatinem/rust-cache@v2
64+
with:
65+
cache-on-failure: true
66+
67+
# ==============================
68+
# Apple M1 SDK setup
69+
# ==============================
70+
71+
- name: Apple M1 setup
72+
if: ${{ matrix.job.target == 'aarch64-apple-darwin' }}
73+
run: |
74+
echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV
75+
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV
76+
77+
# ==============================
78+
# Builds
79+
# ==============================
80+
81+
# This is the main thing being tested, looking for a `make` failure
82+
- name: Build trin for ${{ matrix.arch }}
83+
run: |
84+
cargo install cross --git https://github.com/cross-rs/cross
85+
env PROFILE=${{ matrix.profile }} make build-${{ matrix.arch }}

0 commit comments

Comments
 (0)