git-bonsai 0.3.0

Command-line tool to clean the branches of your git garden
Documentation
name: Build

on:
  pull_request:
  push:
    branches:
      - master
  workflow_dispatch:

jobs:
  lint:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3

      - name: Install stable toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          override: true

      - name: Run static checks
        run: ci/run-static-checks

  build:
    strategy:
      fail-fast: false
      matrix:
        os:
        - ubuntu-20.04
        - macos-11
        - windows-2019

    runs-on: ${{ matrix.os }}

    defaults:
      run:
        shell: bash

    steps:
    - uses: actions/checkout@v3
      with:
        # Use `fetch-depth: 0` otherwise `git describe` does not see valid
        # tags, causing ci/create-archive to create snapshot archives. This
        # also requires the "Fix actions/checkout bug" step below to work.
        fetch-depth: 0

    # See https://github.com/actions/checkout/issues/290#issuecomment-680260080
    - name: Fix actions/checkout bug
      run: git fetch --force --tags

    - name: Build
      run: ci/build-app

    - name: Run tests
      run: ci/run-tests

    - name: Create archive
      run: ci/create-archive

    - name: Upload artifacts
      uses: actions/upload-artifact@v3
      with:
        name: artifacts
        path: |
          artifacts/*.bz2

  server-upload:
    needs: build
    runs-on: ubuntu-20.04
    if: github.ref == 'refs/heads/master'

    steps:
      - uses: actions/checkout@v3

      - name: Download artifacts
        uses: actions/download-artifact@v3
        with:
          name: artifacts
          path: artifacts

      - name: Upload to builds.agateau.com
        run: ci/upload-build git-bonsai artifacts/*.bz2
        env:
          UPLOAD_USERNAME: ${{ secrets.UPLOAD_USERNAME }}
          UPLOAD_PRIVATE_KEY: ${{ secrets.UPLOAD_PRIVATE_KEY }}
          UPLOAD_HOSTNAME: ${{ secrets.UPLOAD_HOSTNAME }}