pfetch 2.11.1

A rewrite of the pfetch system information tool
Documentation
on: [push, pull_request]
permissions:
  contents: write
name: CI

env:
  PF_INFO: "ascii"
  PF_PAD1: 0
  PF_PAD2: 0
  PF_PAD3: 0

jobs:
  checks:
    name: ${{ matrix.name }} (${{ matrix.target }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        target:
          - x86_64-unknown-linux-gnu
          - x86_64-unknown-freebsd
          - aarch64-linux-android
          - x86_64-pc-windows-gnu
          - x86_64-apple-darwin

        include:
          - os: ubuntu-latest
            name: Linux x86_64
            target: x86_64-unknown-linux-gnu
            cross: false
            strip: true

          - os: ubuntu-latest
            name: FreeBSD
            target: x86_64-unknown-freebsd
            cross: true
            strip: true

          - os: ubuntu-latest
            name: Android
            target: aarch64-linux-android
            cross: true
            strip: true

          - os: windows-latest
            name: Windows x86_64
            target: x86_64-pc-windows-gnu
            cross: false
            strip: true

          - os: macos-latest
            name: macOS x86_64
            target: x86_64-apple-darwin
            cross: false
            strip: true

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

      - name: Bootstrap
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          components: rustfmt, clippy
          target: ${{ matrix.target }}

      - name: Formatting
        uses: actions-rs/cargo@v1
        with:
          command: fmt
          use-cross: ${{ matrix.cross }}
        continue-on-error: false

      - name: Lints
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: --target=${{ matrix.target }} -- --no-deps -D clippy::all
          use-cross: ${{ matrix.cross }}
        continue-on-error: false

      - name: Build
        uses: actions-rs/cargo@v1
        with:
          command: build
          args: --target=${{ matrix.target }} --target-dir=/tmp
          use-cross: ${{ matrix.cross }}

      - name: Upload Artifact
        uses: actions/upload-artifact@v3
        with:
          name: pfetch-${{ matrix.target }}
          path: /tmp/${{ matrix.target }}/debug/pfetch

      - name: Test
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --target=${{ matrix.target }}
        if: ${{ !matrix.cross }}
  render:
    needs: checks
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Install Jetbrains Mono
        run: sudo apt update && sudo apt install -y fonts-jetbrains-mono

      - name: Install typst
        uses: yusancky/setup-typst@v2
        with:
          version: 'v0.10.0'

      - name: Download Artifact
        uses: actions/download-artifact@v2
        with:
         name: pfetch-x86_64-unknown-linux-gnu
         path: /tmp/

      - name: Run render script
        run: sudo chmod +x /tmp/pfetch && cd ./tools/ && ./render_all.sh /tmp/pfetch

      - name: Commit Files
        uses: EndBug/add-and-commit@v9
        with:
          add:
            assets all_logos.md
          default_author: github_actions
          message: "chore(logos): re-render all logos"