2020jobs :
2121 build :
2222 strategy :
23+ fail-fast : false
2324 matrix :
2425 include :
2526 - target : x86_64-unknown-linux-gnu
2627 os : ubuntu-latest
2728 artifact : openpr-mcp-server-linux-amd64
29+ use_cross : false
2830 - target : aarch64-unknown-linux-gnu
2931 os : ubuntu-latest
3032 artifact : openpr-mcp-server-linux-arm64
33+ use_cross : true
3134 - target : x86_64-apple-darwin
32- os : macos-latest
35+ os : macos-13
3336 artifact : openpr-mcp-server-macos-amd64
37+ use_cross : false
3438 - target : aarch64-apple-darwin
3539 os : macos-latest
3640 artifact : openpr-mcp-server-macos-arm64
41+ use_cross : false
3742 - target : x86_64-pc-windows-msvc
3843 os : windows-latest
3944 artifact : openpr-mcp-server-windows-amd64
45+ use_cross : false
4046
4147 runs-on : ${{ matrix.os }}
4248 steps :
@@ -47,31 +53,26 @@ jobs:
4753 with :
4854 targets : ${{ matrix.target }}
4955
50- - name : Install cross-compilation tools (Linux ARM64)
51- if : matrix.target == 'aarch64-unknown-linux-gnu'
52- run : |
53- sudo apt-get update
54- sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
55- echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
56+ - name : Install cross
57+ if : matrix.use_cross
58+ run : cargo install cross --git https://github.com/cross-rs/cross
5659
57- - name : Install OpenSSL (Linux)
58- if : runner.os == 'Linux'
60+ - name : Install system deps (Linux native )
61+ if : runner.os == 'Linux' && !matrix.use_cross
5962 run : |
6063 sudo apt-get update
6164 sudo apt-get install -y pkg-config libssl-dev libpq-dev
62- if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then
63- sudo dpkg --add-architecture arm64
64- sudo apt-get update || true
65- sudo apt-get install -y libssl-dev:arm64 libpq-dev:arm64 || true
66- echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
67- echo "OPENSSL_DIR=/usr" >> $GITHUB_ENV
68- fi
6965
7066 - uses : Swatinem/rust-cache@v2
7167 with :
7268 key : ${{ matrix.target }}
7369
74- - name : Build
70+ - name : Build (cross)
71+ if : matrix.use_cross
72+ run : cross build --release --bin mcp-server --target ${{ matrix.target }}
73+
74+ - name : Build (native)
75+ if : " !matrix.use_cross"
7576 run : cargo build --release --bin mcp-server --target ${{ matrix.target }}
7677
7778 - name : Package (Unix)
0 commit comments