Files
managarr-tree-widget/.github/workflows/rust.yml
2020-10-31 04:33:20 +01:00

91 lines
2.4 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 registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-lint-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run clippy
run: cargo clippy --verbose --all-targets --all-features -- -D warnings
- 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 registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-test-target-${{ 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 registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ matrix.config.triple }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ matrix.config.triple }}-cargo-release-target-${{ hashFiles('**/Cargo.lock') }}
- name: Build release
run: cargo build --release --verbose --all-targets --target ${{ matrix.config.triple }}