ifstat-rs 3.0.0

A tool to report network interface statistics.
Documentation
name: builds
# The job of this script is to check if it builds on all platforms.
# We cross-compile from Linux.

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
  workflow_dispatch:

jobs:
  build:
    runs-on: "ubuntu-latest"
    strategy:
      fail-fast: false
      matrix:
        target:
          - x86_64-unknown-linux-gnu
          - aarch64-unknown-linux-gnu
          - x86_64-pc-windows-gnu

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Rust
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          override: true

      - name: Install target
        run: rustup target add "${{ matrix.target }}"

      - name: Install dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y gcc-multilib g++-multilib
          if [ "${{ matrix.target }}" = "x86_64-pc-windows-gnu" ]; then
            sudo apt-get install -y mingw-w64
          fi
          if [ "${{ matrix.target }}" = "aarch64-unknown-linux-gnu" ]; then
            sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
          fi

      - name: Set environment variables
        run: |
          # build target for rust
          echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV

      - name: Build
        run: |
          cargo build --target "${{ matrix.target }}"
          mkdir -p build_output
          cp target/${{ matrix.target }}/debug/ifstat-rs${{ matrix.target == 'x86_64-pc-windows-gnu' && '.exe' || '' }} build_output/

      - name: Upload built binary
        uses: actions/upload-artifact@v4
        with:
          name: ifstat-rs-${{ matrix.target }}${{ matrix.target == 'x86_64-pc-windows-gnu' && '.exe' || '' }}
          path: build_output/