name: Rust on: [push, pull_request] jobs: lint: name: Linting and Formatting Checks runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v1 - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable override: true - name: Install rustfmt run: rustup component add rustfmt - name: Cache cargo registry uses: actions/cache@v1 with: path: ~/.cargo/registry key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - name: Cache cargo index uses: actions/cache@v1 with: path: ~/.cargo/git key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - name: Cache cargo build uses: actions/cache@v1 with: path: target key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - name: Check Formatting uses: actions-rs/cargo@v1 with: command: fmt args: --all -- --check - name: Install clippy run: rustup component add clippy - name: Clippy Linting uses: actions-rs/cargo@v1 with: command: clippy args: -- -D warnings test: name: Run Tests runs-on: ${{ matrix.os }} strategy: matrix: # add windows-latest when it is clear why tests are failing os: [ubuntu-latest, macos-latest] steps: - name: Checkout sources uses: actions/checkout@v1 - name: Install stable toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable override: true - name: Cache cargo registry uses: actions/cache@v1 with: path: ~/.cargo/registry key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} - name: Cache cargo index uses: actions/cache@v1 with: path: ~/.cargo/git key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} - name: Cache cargo build uses: actions/cache@v1 with: path: target key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - name: Run Tests uses: actions-rs/cargo@v1 with: command: test - name: Run Editorconfig Checker uses: actions-rs/cargo@v1 with: command: run