wthrr 0.10.0

Weather companion for the terminal
name: CI

on:
  push:
    branches: [main, "**-dev"]
    paths: ["**/*.rs", "**/*.yml", "**/*.toml", "**/*.lock"]
  pull_request:
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always

jobs:
  Lint:
    uses: tobealive/wthrr-the-weathercrab/.github/workflows/lint.yml@main

  Test:
    needs: Lint
    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest, ubuntu-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3
      - uses: actions/cache@v3
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - name: Install cargo-nextest
        uses: taiki-e/install-action@nextest
      - name: Run test
        env:
          RUST_BACKTRACE: full
        run: |
          cargo nextest run --verbose --profile ci
          mv target/nextest/ci/junit.xml target/nextest/ci/junit-${{ matrix.os }}.xml
      - name: Prepare test-results
        run: |
          mkdir -p test-results
          mv target/nextest/ci/junit-*.xml test-results/
      - name: Upload test results
        uses: actions/upload-artifact@v3
        with:
          name: test-results
          path: |
            test-results

  Event:
    needs: test
    name: Upload Test Event
    runs-on: ubuntu-latest
    steps:
      - uses: actions/upload-artifact@v3
        with:
          name: test-event
          path: ${{ github.event_path }}

  Build:
    needs: test
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest, macOS-11, ubuntu-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3
      - uses: actions/cache@v3
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
      - name: Build
        run: cargo build --verbose