1
0
Fork 0

Add GH action for tests/clippy

gh-action
Bo Jeanes 2022-08-30 20:27:56 +10:00
parent 46ad4a5c24
commit 8365c25fd0
2 changed files with 112 additions and 1 deletions

111
.github/workflows/ci.yml vendored 100644
View File

@ -0,0 +1,111 @@
# TODO: incorporate some learnings from https://www.infinyon.com/blog/2021/04/github-actions-best-practices/, esp `sccache` stuff
# TODO: dispatch event technique from https://mateuscosta.me/rust-releases-with-github-actions looks handy for triggering another workflow, such as to share logic for building binaries
name: CI
on:
push:
branches:
- '**'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
id: rust-toolchain
with:
toolchain: stable
profile: default
override: true
- name: Install Dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get clean && sudo apt-get update
sudo apt-get install -y pkg-config libudev-dev
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-target-${{ steps.rust-toolchain.outputs.rustc_hash }}-
${{ runner.os }}-cargo-build-target-
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
id: rust-toolchain
with:
toolchain: stable
profile: default
override: true
- name: Install Dependencies
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get clean && sudo apt-get update
sudo apt-get install -y pkg-config libudev-dev
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-${{ steps.rust-toolchain.outputs.rustc_hash }}-
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-index-${{ steps.rust-toolchain.outputs.rustc_hash }}-
${{ runner.os }}-cargo-index-
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-target-${{ steps.rust-toolchain.outputs.rustc_hash }}-
${{ runner.os }}-cargo-build-target-
- name: Check rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: Check clippy warnings
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D clippy::all

View File

@ -194,7 +194,7 @@ where
}
}
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct RegisterParse {
#[serde(default, skip_serializing_if = "IsDefault::is_default")]
pub swap_bytes: Swap,