hoc/.github/workflows/rust.yml

95 lines
2.3 KiB
YAML
Raw Normal View History

2019-09-09 21:39:16 +02:00
name: Rust
2019-11-25 16:53:06 +01:00
on: [push, pull_request]
2019-09-09 21:39:16 +02:00
jobs:
2019-11-25 16:53:06 +01:00
lint:
name: Linting and Formatting Checks
2019-09-09 21:39:16 +02:00
runs-on: ubuntu-latest
2019-11-25 16:53:06 +01:00
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]
2019-09-09 21:39:16 +02:00
steps:
2019-11-25 16:53:06 +01:00
- 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