napi-rs/.github/workflows/lint.yaml
2022-04-01 14:33:34 +08:00

61 lines
1.2 KiB
YAML

name: Lint
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: Lint SourceCode
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
cache: 'yarn'
- name: Install
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: default
override: true
components: rustfmt, clippy
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: lint-cargo-cache
- name: Cache NPM dependencies
uses: actions/cache@v3
with:
path: .yarn/cache
key: lint-yarn-cache
- name: 'Install dependencies'
run: yarn install --immutable --mode=skip-build
- name: 'Lint JS/TS'
run: yarn lint
- name: Cargo fmt
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy
- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache