napi-rs/.github/workflows/lint.yaml

62 lines
1.2 KiB
YAML
Raw Normal View History

2020-07-29 22:04:47 +08:00
name: Lint
2020-08-17 22:36:09 +08:00
on:
push:
2020-12-03 16:30:14 +08:00
branches:
- main
2020-08-17 22:36:09 +08:00
pull_request:
2020-07-29 22:04:47 +08:00
jobs:
lint:
name: Lint SourceCode
runs-on: ubuntu-latest
steps:
2022-04-01 14:29:51 +08:00
- uses: actions/checkout@v3
2020-07-29 22:04:47 +08:00
- name: Setup node
uses: actions/setup-node@v3
2020-07-29 22:04:47 +08:00
with:
2021-11-19 14:58:21 +08:00
node-version: 16
2020-11-10 11:09:25 +08:00
check-latest: true
2021-11-19 14:58:21 +08:00
cache: 'yarn'
2020-07-29 22:04:47 +08:00
- name: Install
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: default
override: true
2020-12-01 14:55:19 +08:00
components: rustfmt, clippy
2020-07-29 22:04:47 +08:00
2022-04-01 14:29:51 +08:00
- name: Cache cargo
uses: actions/cache@v3
2020-07-29 22:04:47 +08:00
with:
2022-04-01 14:29:51 +08:00
path: |
~/.cargo/registry
~/.cargo/git
key: lint-cargo-cache
2020-07-29 22:04:47 +08:00
- name: Cache NPM dependencies
2022-04-01 14:29:51 +08:00
uses: actions/cache@v3
2020-07-29 22:04:47 +08:00
with:
2022-04-01 14:29:51 +08:00
path: .yarn/cache
key: lint-yarn-cache
2020-07-29 22:04:47 +08:00
- name: 'Install dependencies'
2022-04-01 14:29:51 +08:00
run: yarn install --immutable --mode=skip-build
2020-07-29 22:04:47 +08:00
- name: 'Lint JS/TS'
run: yarn lint
2020-12-01 14:55:19 +08:00
- name: Cargo fmt
2020-07-29 22:04:47 +08:00
run: cargo fmt -- --check
2020-12-01 14:55:19 +08:00
- name: Clippy
2021-12-08 12:52:33 +08:00
run: cargo clippy
2020-12-01 14:55:19 +08:00
2020-07-29 22:04:47 +08:00
- name: Clear the cargo caches
run: |
cargo install cargo-cache --no-default-features --features ci-autoclean
cargo-cache