piston_rs 0.4.3

An async wrapper for the Piston code execution engine.
Documentation
name: CI

on:
  push:
    branches:
      - master
  pull_request:

jobs:
  lint-and-format:
    name: Lint and format
    runs-on: ubuntu-latest

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

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

      - name: Run format check
        run: cargo fmt -- --check

      - name: Run clippy check
        run: cargo clippy

  check-coverage:
    name: Check coverage
    runs-on: ubuntu-latest

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

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

      - name: Run tests
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --all-features --no-fail-fast
        env:
          CARGO_INCREMENTAL: "0"
          RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
          RUSTDOCFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"

      - name: Generate coverage report
        uses: actions-rs/grcov@v0.1

      - name: Verify coverage >= 80%
        run: |
          COVERAGE=$(grep -oP "message\":\"\K(\d+)" ./target/debug/coverage/coverage.json);
          if [ $COVERAGE -lt 80 ]; then
            echo "Coverage failing with: $COVERAGE%";
            exit 1;
          else
            echo "Coverage passing with: $COVERAGE%";
            exit 0;
          fi

  test-and-build:
    name: Test and build

    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust_version: [1.46.0, stable, nightly]

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

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

      - name: Install rust version ${{ matrix.rust_version }}
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust_version }}

      - name: Run tests
        run: cargo test

      - name: Build package
        run: cargo build