Skip to content

fix: fix trajan protocol #3

fix: fix trajan protocol

fix: fix trajan protocol #3

Workflow file for this run

# Verify all release targets build (no packaging). Run on push to main and on pull_request.
name: Build (all targets)
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
env:
BINARY_NAME: proxy-convert
RUST_BACKTRACE: 1
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.runner || matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: macos-14
target: x86_64-apple-darwin
- os: macos-14
target: aarch64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: aarch64-pc-windows-msvc
runner: windows-11-arm
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Cache cargo
uses: Swatinem/rust-cache@v2.8.2
with:
key: ${{ matrix.target }}
- name: Install Linux deps (glibc cross)
if: matrix.os == 'ubuntu-latest' && matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross binutils-aarch64-linux-gnu
- name: Set env for Linux aarch64 cross
if: matrix.os == 'ubuntu-latest' && matrix.target == 'aarch64-unknown-linux-gnu'
run: |
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV
echo "AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar" >> $GITHUB_ENV
echo "RANLIB_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ranlib" >> $GITHUB_ENV
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Install musl (x86_64)
if: matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Set env for musl (x86_64)
if: matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64-unknown-linux-musl'
run: echo "CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc" >> $GITHUB_ENV
- name: Build
run: cargo build --release --target ${{ matrix.target }} --verbose
- name: Test binary
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
exe="target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}.exe"
else
exe="target/${{ matrix.target }}/release/${{ env.BINARY_NAME }}"
fi
if [ ! -f "$exe" ]; then
echo "Binary not found: $exe"
exit 1
fi
# Only run binary on native target (cross-compiled binaries cannot run on host)
if [ "${{ matrix.os }}" = "ubuntu-latest" ] && [ "${{ matrix.target }}" = "x86_64-unknown-linux-gnu" ]; then
"$exe" --version
elif [ "${{ matrix.os }}" = "windows-latest" ] && { [ "${{ matrix.target }}" = "x86_64-pc-windows-msvc" ] || [ "${{ matrix.target }}" = "aarch64-pc-windows-msvc" ]; }; then
"$exe" --version
elif [ "${{ matrix.os }}" = "macos-14" ] && [ "${{ matrix.target }}" = "aarch64-apple-darwin" ]; then
"$exe" --version
else
echo "Skipping execution (cross-compiled target)."
fi