artem 1.1.5

Convert images from multiple formats (jpg, png, webp, etc…) to ASCII art
Documentation
on: [push]

name: Continuous Integration

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

jobs:
  check:
    name: Check
    #format does not need to run on all platforms
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - name: Checkout sources
        uses: actions/checkout@v2

      - name: Install stable toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
      #use caching for cargo build
      - name: Cache dependencies
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Run cargo check
        uses: actions-rs/cargo@v1
        continue-on-error: false
        with:
          command: check

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - name: Checkout sources
        uses: actions/checkout@v2

      - name: Install stable toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
      #use caching for cargo build
      - name: Cache dependencies
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

        #install and run clippy
      - run: rustup component add clippy
      - name: Run clippy
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: -- -Dwarnings

  test:
    name: Test Suite
    strategy:
      matrix:
        platform: [ubuntu-latest] # test only on ubuntu, testing on every platform would take too much time and fail too often due to a few flaky test
        rust:
          - 1.59.0 # MSRV
          - stable
          - beta
          - nightly
      #tests should pass on all platforms
    runs-on: ${{ matrix.platform }}
    timeout-minutes: 25
    steps:
      - name: Checkout sources
        uses: actions/checkout@v2

      - name: Install ${{ matrix.rust }} toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          profile: minimal
          override: true
      #use caching for cargo build
      - name: Cache dependencies
        uses: actions/cache@v2
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Build artem
        uses: actions-rs/cargo@v1
        continue-on-error: false
        with:
          command: build

      - name: Run tests
        if: contains(${{ matrix.target }}, "x86_64") #arm build can not run tests
        uses: actions-rs/cargo@v1
        continue-on-error: false
        with:
          command: test
          args: --locked --verbose