netrix 0.0.0

A Matrix chat client written using Makepad + Robius app dev framework in Rust.
# Robrix Build CI Workflow
# This workflow builds the Robrix project across multiple platforms including desktop and mobile.
# It includes 3 main hosts: macOS, Linux, and Windows for 5 targets: MacOS, Linux, Windows, IOS, and Android.

# Build Robrix Matrix Coverage:
# ┌─────────────────┬─────────────────┬─────────────────┐
# │   Host OS       │   Target        │   Build Tool    │
# ├─────────────────┼─────────────────┼─────────────────┤
# │ Ubuntu Latest   │ Linux x86_64    │ cargo build     │
# │ macOS 15 Intel  │ macOS x86_64    │ cargo build     │
# │ macOS 14 ARM64  │ macOS ARM64     │ cargo build     │
# │ Windows 2022    │ Windows x86_64  │ cargo build     │
# │ macOS 14        │ iOS aarch64     │ cargo-makepad   │
# │ macOS 14        │ Android         │ cargo-makepad   │
# │ Ubuntu Latest   │ Android         │ cargo-makepad   │
# │ Windows 2022    │ Android         │ cargo-makepad   │
# └─────────────────┴─────────────────┴─────────────────┘

name: Robrix Build CI

on:
  push:
    branches:
      - main
    paths:
        - packaging/**
        - resources/**
        - src/**
        - .github/**
        - .cargo/**
        - Cargo.lock
        - Cargo.toml
        - rust-toolchain.toml
        # ignore files
        - '!**/*.md'
        - '!LICENSE-MIT'
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]
    branches:
      - main
    paths:
        - packaging/**
        - resources/**
        - src/**
        - .github/**
        - .cargo/**
        - Cargo.lock
        - Cargo.toml
        - rust-toolchain.toml
        # ignore files
        - '!**/*.md'
        - '!LICENSE-MIT'
env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1
  CARGO_INCREMENTAL: 0

jobs:
  # ═══════════════════════════════════════════════════════════════════════════════════════
  # NATIVE DESKTOP BUILDS
  # These jobs build Robrix for desktop platforms using standard cargo build
  # ═══════════════════════════════════════════════════════════════════════════════════════
  build_ubuntu:
    name: Build Ubuntu
    runs-on: ubuntu-latest
    if: github.event.pull_request.draft == false
    steps:
      - uses: actions/checkout@v4

      - name: Install system dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y \
            libssl-dev \
            libsqlite3-dev \
            pkg-config \
            llvm \
            clang \
            libclang-dev \
            binfmt-support \
            libxcursor-dev \
            libx11-dev \
            libasound2-dev \
            libpulse-dev \
            libwayland-dev libxkbcommon-dev

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2
        with:
          key: ubuntu-build-${{ hashFiles('Cargo.lock') }}

      - name: Build
        env:
          RUSTFLAGS: "-D warnings"
        run: |
          cargo build

  build_macos:
    name: Build macOS (${{ matrix.arch }})
    runs-on: ${{ matrix.os }}
    if: github.event.pull_request.draft == false
    strategy:
      fail-fast: false
      matrix:
        include:
          # Apple Silicon Macs (M1/M2/M3/M4 chips)
          - os: macos-14
            arch: arm64
          # Intel Macs (x86_64 architecture)
          - os: macos-15-intel
            arch: x86_64
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2
        with:
          key: macos-${{ matrix.arch }}-build-${{ hashFiles('Cargo.lock') }}

      - name: Build
        env:
          RUSTFLAGS: "-D warnings"
        run: |
          cargo build

  build_windows:
    name: Build Windows
    runs-on: windows-2022
    if: github.event.pull_request.draft == false
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2
        with:
          key: windows-build-${{ hashFiles('Cargo.lock') }}

      - name: Build
        env:
          RUSTFLAGS: "-D warnings"
        run: |
          cargo build

  # ═══════════════════════════════════════════════════════════════════════════════════════
  # CROSS-PLATFORM MOBILE BUILDS
  # These jobs use cargo-makepad for mobile cross-compilation
  # ═══════════════════════════════════════════════════════════════════════════════════════

  build_ios_on_macos:
    name: Build iOS (macOS Host)
    runs-on: macos-14
    if: github.event.pull_request.draft == false
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust stable and nightly
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable

      - name: Install Rust nightly
        run: |
          rustup toolchain install nightly

      - name: Setup cargo-makepad
        uses: ./.github/actions/setup-cargo-makepad

      - name: Install iOS toolchain
        run: |
          cargo makepad apple ios install-toolchain

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2
        with:
          key: ios-macos-build-${{ hashFiles('Cargo.lock') }}

      - name: Build for iOS targets
        env:
          RUSTFLAGS: "-D warnings"
        run: |
          # Install iOS targets
          rustup target add aarch64-apple-ios

          # Build the iOS simulator and device targets
          cargo makepad apple ios \
          --org=rs.robius \
          --app=robrix \
          run-sim -p robrix
        continue-on-error: true # iOS builds may fail due to signing requirements in CI

  build_android_on_macos:
    name: Build Android (macOS Host)
    runs-on: macos-14
    if: github.event.pull_request.draft == false
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Setup cargo-makepad
        uses: ./.github/actions/setup-cargo-makepad

      - name: Install Android toolchain
        run: |
          cargo makepad android install-toolchain

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2
        with:
          key: android-macos-build-${{ hashFiles('Cargo.lock') }}

      - name: Build Android APK
        env:
          RUSTFLAGS: "-D warnings"
        run: |
          cargo makepad android build -p robrix

  build_android_on_linux:
    name: Build Android (Linux Host)
    runs-on: ubuntu-latest
    if: github.event.pull_request.draft == false
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Setup cargo-makepad
        uses: ./.github/actions/setup-cargo-makepad

      - name: Install Android toolchain
        run: |
          cargo makepad android install-toolchain

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2
        with:
          key: android-linux-build-${{ hashFiles('Cargo.lock') }}

      - name: Build Android APK
        env:
          RUSTFLAGS: "-D warnings"
        run: |
          cargo makepad android build -p robrix

  build_android_on_windows:
    name: Build Android (Windows Host)
    runs-on: windows-2022
    if: github.event.pull_request.draft == false
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2
        with:
          key: android-windows-build-${{ hashFiles('Cargo.lock') }}

      - name: Setup cargo-makepad
        uses: ./.github/actions/setup-cargo-makepad

      - name: Install Android toolchain
        run: |
          cargo makepad android install-toolchain

      - name: Build Android APK
        env:
          RUSTFLAGS: "-D warnings"
        run: |
          cargo makepad android build -p robrix

  # Build Summary
  build_summary:
    name: Robrix Build Results Summary
    runs-on: ubuntu-latest
    needs: [
      build_ubuntu,
      build_macos,
      build_windows,
      build_ios_on_macos,
      build_android_on_macos,
      build_android_on_linux,
      build_android_on_windows
    ]
    if: always()

    steps:
      - run: |
          echo "=== Desktop Builds ==="
          echo "Ubuntu: ${{ needs.build_ubuntu.result }}"
          echo "macOS: ${{ needs.build_macos.result }}"
          echo "Windows: ${{ needs.build_windows.result }}"
          echo "=== iOS Builds ==="
          echo "iOS (macOS): ${{ needs.build_ios_on_macos.result }}"
          echo "=== Android Builds ==="
          echo "Android (macOS): ${{ needs.build_android_on_macos.result }}"
          echo "Android (Linux): ${{ needs.build_android_on_linux.result }}"
          echo "Android (Windows): ${{ needs.build_android_on_windows.result }}"

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  cancel-in-progress: true