89 lines
2.1 KiB
YAML
89 lines
2.1 KiB
YAML
name: Rust
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: 'Log versions'
|
|
run: |
|
|
rustc --version
|
|
cargo --version
|
|
- name: Cache cargo
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Run clippy
|
|
run: cargo clippy --verbose --all-targets --all-features -- -D warnings -D clippy::pedantic
|
|
- name: Check format
|
|
run: cargo fmt -- --check --verbose
|
|
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: 'Log versions'
|
|
run: |
|
|
rustc --version
|
|
cargo --version
|
|
- name: Cache cargo
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Build
|
|
run: cargo build --verbose --all-targets
|
|
|
|
- name: Run tests
|
|
run: cargo test --verbose --all-targets
|
|
|
|
release:
|
|
name: Release ${{ matrix.config.triple }}
|
|
runs-on: ${{ matrix.config.os }}
|
|
strategy:
|
|
matrix:
|
|
config:
|
|
- os: ubuntu-latest
|
|
triple: x86_64-unknown-linux-gnu
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Log versions
|
|
run: |
|
|
rustc --version
|
|
cargo --version
|
|
|
|
- name: Add Target
|
|
run: rustup target add ${{ matrix.config.triple }}
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ matrix.config.triple }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Build release
|
|
run: cargo build --release --verbose --all-targets --target ${{ matrix.config.triple }}
|
|
|
|
- name: inspect target dir
|
|
if: runner.os == 'Linux' || runner.os == 'macOS'
|
|
run: ls -al target/*/release
|