atuin/.github/workflows/rust.yml

98 lines
1.9 KiB
YAML
Raw Normal View History

2021-02-14 16:39:51 +01:00
name: Rust
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
2021-02-14 16:51:14 +01:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install rust
2021-02-14 16:51:14 +01:00
uses: actions-rs/toolchain@v1
with:
toolchain: stable
2021-02-14 16:51:14 +01:00
override: true
2021-02-14 16:39:51 +01:00
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
2021-02-14 16:51:14 +01:00
- name: Run cargo build
run: cargo build --all --release && strip target/release/atuin
2021-02-14 16:51:14 +01:00
test:
2021-02-14 16:39:51 +01:00
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
2021-02-14 16:51:14 +01:00
- name: Install rust
2021-02-14 16:51:14 +01:00
uses: actions-rs/toolchain@v1
with:
toolchain: stable
2021-02-14 16:51:14 +01:00
override: true
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
2021-02-14 16:51:14 +01:00
- name: Run cargo test
run: cargo test --workspace
2021-02-14 16:51:14 +01:00
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install latest rust
2021-02-14 16:51:14 +01:00
uses: actions-rs/toolchain@v1
with:
toolchain: stable
2021-02-14 16:51:14 +01:00
override: true
2021-02-14 16:56:49 +01:00
components: clippy
2021-02-14 16:51:14 +01:00
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
2021-02-14 16:55:30 +01:00
- name: Run clippy
2021-02-14 19:16:53 +01:00
run: cargo clippy -- -D warnings
2021-02-14 16:55:30 +01:00
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install latest rust
2021-02-14 16:55:30 +01:00
uses: actions-rs/toolchain@v1
with:
toolchain: stable
2021-02-14 16:55:30 +01:00
override: true
components: rustfmt
2021-02-14 16:55:30 +01:00
- name: Format
run: cargo fmt -- --check