mineshare 0.2.0

A small, no portforwarding reverse proxy app for small Minecraft servers
Documentation
name: Main

on:
  pull_request:
  push:

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - target: x86_64-unknown-linux-musl
            os: ubuntu-latest
            cargo: cargo
            ext: ""
          - target: aarch64-unknown-linux-musl
            os: ubuntu-latest
            cargo: cross
            ext: ""
          - target: x86_64-apple-darwin
            os: macos-latest
            cargo: cargo
            ext: ""
          - target: aarch64-apple-darwin
            os: macos-latest
            cargo: cargo
            ext: ""
          - target: x86_64-pc-windows-msvc
            os: windows-latest
            cargo: cargo
            ext: ".exe"
          - target: aarch64-pc-windows-msvc
            os: windows-latest
            cargo: cargo
            ext: ".exe"

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

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

      - name: Set up binstall
        uses: cargo-bins/cargo-binstall@main

      - name: Set up cross
        run: cargo binstall cross

      - name: Set up musl
        if: contains(matrix.target, 'musl')
        run: |
          sudo apt-get update
          sudo apt-get install -y musl-tools gcc-aarch64-linux-gnu
          export RUSTFLAGS="-C target-feature=+crt-static"

      - name: export env vars for aarch64 linux
        if: contains(matrix.target, 'musl') && contains(matrix.target, 'aarch64')
        run: |
          export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc
          export CC=aarch64-linux-gnu-gcc

      - name: Build
        run: |
          ${{ matrix.cargo }} build --release --target ${{ matrix.target }}

      - name: Package
        run: |
          mkdir dist
          cp target/${{ matrix.target }}/release/mineshare${{ matrix.ext }} dist/mineshare-${{ matrix.target }}${{ matrix.ext }}
          cp target/${{ matrix.target }}/release/mineshare_server${{ matrix.ext }} dist/mineshare_server-${{ matrix.target }}${{ matrix.ext }}

      - name: Upload artifacts
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.target }}
          path: dist/*

      - name: Release
        if: github.ref_type == 'tag'
        uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631
        with:
          files: dist/mineshare-${{ matrix.target }}${{ matrix.ext }}
  clippy:
    name: Run clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up rust
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: clippy
      - run: cargo clippy --all-targets --all-features -- -D warnings
  format:
    name: Run rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up rust
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: rustfmt
      - run: cargo fmt --check

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