x0x 0.14.2

Agent-to-agent gossip network for AI systems — no winners, no losers, just cooperation
Documentation
name: Build

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always

jobs:
  build-matrix:
    name: Build ${{ matrix.platform }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          # Linux x86_64 GNU
          - platform: linux-x64-gnu
            os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            cross: false

          # Linux x86_64 musl (static linking)
          - platform: linux-x64-musl
            os: ubuntu-latest
            target: x86_64-unknown-linux-musl
            cross: true

          # Linux ARM64
          - platform: linux-arm64-gnu
            os: ubuntu-latest
            target: aarch64-unknown-linux-gnu
            cross: true

          # macOS x86_64 (cross-compiled on Apple Silicon)
          - platform: macos-x64
            os: macos-14
            target: x86_64-apple-darwin
            cross: false

          # macOS ARM64 (Apple Silicon)
          - platform: macos-arm64
            os: macos-14
            target: aarch64-apple-darwin
            cross: false

          # Windows x86_64
          - platform: windows-x64
            os: windows-latest
            target: x86_64-pc-windows-msvc
            cross: false

    steps:
      - uses: actions/checkout@v4

      - name: Install Rust stable
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: ~/.cargo/registry
          key: ${{ runner.os }}-${{ matrix.target }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-${{ matrix.target }}-cargo-registry-

      - name: Cache cargo index
        uses: actions/cache@v4
        with:
          path: ~/.cargo/git
          key: ${{ runner.os }}-${{ matrix.target }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-${{ matrix.target }}-cargo-git-

      - name: Cache target directory
        uses: actions/cache@v4
        with:
          path: target
          key: ${{ runner.os }}-${{ matrix.target }}-target-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-${{ matrix.target }}-target-

      - name: Install cross
        if: matrix.cross
        run: cargo install cross --locked

      - name: Build (native)
        if: ${{ !matrix.cross }}
        run: cargo build --release --target ${{ matrix.target }}

      - name: Build (cross)
        if: matrix.cross
        run: cross build --release --target ${{ matrix.target }}

      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: x0x-${{ matrix.platform }}
          path: |
            target/${{ matrix.target }}/release/x0x*
            !target/${{ matrix.target }}/release/*.d
            !target/${{ matrix.target }}/release/*.pdb
          if-no-files-found: error