Move lint ci to github

This commit is contained in:
Pavan Kumar Sunkara 2020-10-09 20:48:19 +02:00
parent 7df091775c
commit b27cd6e171
2 changed files with 47 additions and 10 deletions

View file

@ -8,7 +8,7 @@ on:
jobs:
ci:
name: CI
needs: [test, test-release]
needs: [test, test-release, lint]
runs-on: ubuntu-latest
steps:
- name: Done
@ -65,6 +65,7 @@ jobs:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
@ -138,3 +139,48 @@ jobs:
- name: Cleanup cache
if: steps.cache.outputs.cache-hit != 'true'
run: cargo cache -a
lint:
name: Linting (fmt + clippy)
runs-on: ubuntu-latest
steps:
- name: Install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Checkout
uses: actions/checkout@v2
- name: Ready cache
run: sudo chown -R $(whoami):$(id -ng) ~/.cargo/
- name: Cache cargo
uses: actions/cache@v1
id: cache
with:
path: ~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Clippy for almost no features
uses: actions-rs/cargo@v1
with:
command: clippy
args: --no-default-features --features "std cargo" -p clap:3.0.0-beta.2
- name: Clippy for all features
uses: actions-rs/cargo@v1
with:
command: clippy
args: --features "yaml unstable" -- -D warnings
- name: Format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Install cargo-cache
uses: actions-rs/install@v0.1
if: steps.cache.outputs.cache-hit != 'true'
with:
crate: cargo-cache
use-tool-cache: true
- name: Cleanup cache
if: steps.cache.outputs.cache-hit != 'true'
run: cargo cache -a

View file

@ -35,15 +35,6 @@ jobs:
script:
- cargo test --no-default-features --features "std cargo" -p clap:3.0.0-beta.2
- cargo test --features "yaml unstable doc"
- name: Linting (fmt + clippy)
before_script:
- rustup component add clippy
- rustup component add rustfmt
script:
- echo "Checking codebase with Clippy release `cargo clippy --version`."
- cargo clippy --lib --features "yaml unstable" -- -D warnings
- cargo clippy --tests --examples --features "yaml unstable" -- -D warnings
- cargo fmt -- --check
- name: Coverage
addons:
apt: