ci: build arm64 binaries #244
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-(Core & Tauri) | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
# cancel ongoing jobs: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build_core: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
- os: macos-latest | |
- os: ubuntu-24.04-arm | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-directories: "${{ github.workspace }}/core_lib/target" | |
prefix-key: "${{ matrix.os }}" | |
- uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install dependencies | |
if: contains(matrix.os, 'macos') == false | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libdbus-1-dev | |
- run: | | |
cd ./core_lib | |
cargo test | |
cargo build | |
build_tauri: | |
runs-on: ${{ matrix.os }} | |
needs: build_core | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
name: legacy | |
target_path: app/legacy | |
dependencies: | | |
sudo apt-get install -y libjavascriptcoregtk-4.0-dev libwebkit2gtk-4.0-dev | |
cache_directory: app/legacy/src-tauri/target | |
- os: ubuntu-24.04 | |
name: main | |
target_path: app/main | |
dependencies: | | |
sudo apt-get install -y libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev | |
cache_directory: app/main/src-tauri/target | |
- os: ubuntu-24.04-arm | |
name: main | |
target_path: app/main | |
dependencies: | | |
sudo apt-get install -y libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev | |
cache_directory: app/main/src-tauri/target | |
- os: ubuntu-24.04-arm | |
name: main-musl | |
target_path: app/main | |
target: aarch64-unknown-linux-musl | |
dependencies: | | |
sudo apt-get install -y libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev musl-tools clang llvm | |
rustup target add aarch64-unknown-linux-musl | |
export CC_aarch64_unknown_linux_musl=clang | |
export AR_aarch64_unknown_linux_musl=llvm-ar | |
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-Clink-self-contained=yes -Clinker=rust-lld" | |
cache_directory: app/main/src-tauri/target | |
- os: macos-latest | |
name: main | |
target_path: app/main | |
cache_directory: app/main/src-tauri/target | |
- os: macos-13 | |
name: main | |
target_path: app/main | |
cache_directory: app/main/src-tauri/target | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target || '' }} | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-directories: "${{ github.workspace }}/${{ matrix.cache_directory }}" | |
prefix-key: "${{ matrix.os }}${{ matrix.name }}${{ matrix.target }}" | |
key: ${{ runner.os }}-cargo-${{ matrix.target }} | |
- uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Linux dependencies for U | |
if: contains(matrix.os, 'macos') == false | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libdbus-1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev | |
- name: Install Linux dependencies | |
if: contains(matrix.os, 'macos') == false | |
run: ${{ matrix.dependencies }} | |
- name: GLIBC version | |
if: contains(matrix.os, 'macos') == false | |
run: | | |
GLIBC_VER=$(ldd --version | head -n1 | awk '{print $NF}') | |
echo "GLIBC version: ${GLIBC_VER}" | |
- name: Check Rust setup | |
run: | | |
which rustc | |
which cargo | |
rustup show | |
rustup target list --installed | |
- name: Build Vite + Tauri | |
run: | | |
rm -rf ${{ github.workspace }}/${{ matrix.target_path }}/src-tauri/target/debug/bundle/ | |
cd ./${{ matrix.target_path }} | |
pnpm install | |
pnpm build:debug ${{ matrix.target != '' && format('--target {0}', matrix.target) || '' }} | |
cd ${{ github.workspace }} | |
./rename_build.sh ${{ github.workspace }}/${{ matrix.target_path }}/src-tauri/target/debug/bundle/ ${{ matrix.name }} | |
- name: Upload result | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-debug-rquickshare-${{ matrix.os }} | |
path: | | |
${{ github.workspace }}/${{ matrix.target_path }}/src-tauri/target/debug/bundle/*/r-quick-share-${{ matrix.name }}* |