name: Build for Raspberry Pi on: push: branches: - main pull_request: branches: - main env: CARGO_TERM_COLOR: always # Target for 64-bit Raspberry Pi (Raspberry Pi OS) RUST_TARGET: aarch64-unknown-linux-gnu jobs: build: name: Build for aarch64 runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: ${{ env.RUST_TARGET }} - name: Install cross-compilation dependencies run: | sudo dpkg --add-architecture arm64 # Add arm64-specific sources to avoid 404 errors on security repos echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy main restricted universe multiverse" | sudo tee /etc/apt/sources.list.d/arm64.list echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list.d/arm64.list sudo apt-get update -y # Install build tools and cross-compilation libraries. # cmake is included as it's in setup.sh and might be needed by a dependency. # The :arm64 suffix is required for cross-compilation. sudo apt-get install -y gcc-aarch64-linux-gnu libudev-dev:arm64 cmake - name: Build release binary run: cargo build --release --target ${{ env.RUST_TARGET }} env: # Set linker for the target CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc # Configure pkg-config for cross-compilation PKG_CONFIG_ALLOW_CROSS: 1 PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig # Add library path for the cross-compiler's linker RUSTFLAGS: -L/usr/lib/aarch64-linux-gnu - name: Upload artifact uses: actions/upload-artifact@v4 with: name: timeturner-aarch64 path: target/${{ env.RUST_TARGET }}/release/timeturner