Update ci.yml as next try on cross compile. #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build CLI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
release: | |
types: [ created ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest ] | |
target: | |
- x86_64-unknown-linux-gnu | |
- aarch64-unknown-linux-gnu # Linux ARM 64-bit | |
- armv7-unknown-linux-gnueabihf # Linux ARM 32-bit | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Add target | |
run: rustup target add ${{ matrix.target }} | |
- name: Set up sysroot and pkg-config | |
run: | | |
case ${{ matrix.target }} in | |
aarch64-unknown-linux-gnu) | |
sudo apt-get install -y gcc-aarch64-linux-gnu | |
export PKG_CONFIG_SYSROOT_DIR=/path/to/aarch64-sysroot | |
export PKG_CONFIG_PATH=/path/to/aarch64-pkgconfig | |
;; | |
armv7-unknown-linux-gnueabihf) | |
sudo apt-get install -y gcc-arm-linux-gnueabihf | |
export PKG_CONFIG_SYSROOT_DIR=/path/to/armv7-sysroot | |
export PKG_CONFIG_PATH=/path/to/armv7-pkgconfig | |
;; | |
esac | |
shell: bash | |
- name: Build | |
run: cargo build --release --target ${{ matrix.target }} | |
env: | |
PKG_CONFIG_SYSROOT_DIR: ${{ steps.set_up_sysroot.outputs.PKG_CONFIG_SYSROOT_DIR }} | |
PKG_CONFIG_PATH: ${{ steps.set_up_sysroot.outputs.PKG_CONFIG_PATH }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rusty-buddy-${{ matrix.target }} | |
path: target/release/rusty-buddy${{ matrix.os == 'windows-latest' && '.exe' || '' }} |