ferium 4.1.4

Fast CLI program for managing Minecraft mods and modpacks from Modrinth, CurseForge, and Github Releases
name: Build

on:
  push:
    commits:
    paths:
      - "**.rs"
      - "**.yml"
      - "Cargo.lock"
      - "Cargo.toml"
  workflow_dispatch:

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - uses: actions/checkout@v3
      - uses: extractions/setup-just@v1

      - name: Install Rust for macOS
        if: matrix.os == 'macos-latest'
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          target: aarch64-apple-darwin
      - name: Install Rust for Windows
        if: matrix.os == 'windows-latest'
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
      - name: Install Rust for Linux
        if: matrix.os == 'ubuntu-latest'
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          target: x86_64-pc-windows-gnu

      - name: Install Linux dependencies
        if: matrix.os == 'ubuntu-latest'
        run: |
          sudo apt-get update
          sudo apt-get install librust-gdk-dev gcc-mingw-w64-x86-64

      - name: Lint code
        run: just lint

      - name: Run tests
        uses: actions-rs/cargo@v1
        with:
          command: test

      - name: Build macOS
        if: matrix.os == 'macos-latest'
        run: |
          just build-mac-intel
          just build-mac-arm
      - name: Build Windows
        if: matrix.os == 'windows-latest'
        run: just build-win
      - name: Build Linux
        if: matrix.os == 'ubuntu-latest'
        run: |
          just build-linux-nogui
          just build-linux-gtk
          just build-linux-xdg
          just build-win-gnu

      - name: Upload build artefacts
        uses: actions/upload-artifact@v3
        with:
          name: binaries
          path: out/ferium*.zip
          if-no-files-found: error