mirror of https://github.com/astral-sh/ruff
Add CI
This commit is contained in:
parent
0adcdd995d
commit
e28f333f23
|
|
@ -0,0 +1,54 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, release]
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
merge_group:
|
||||||
|
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
# Cancel previous workflows if they are the same workflow on same ref (branch/tags)
|
||||||
|
# with the same event (push/pull_request) even they are in progress.
|
||||||
|
# This setting will help reduce the number of duplicated workflows.
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,ssl,jit
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
rust_tests:
|
||||||
|
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }}
|
||||||
|
env:
|
||||||
|
RUST_BACKTRACE: full
|
||||||
|
name: Run rust tests
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest]
|
||||||
|
fail-fast: false
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
- name: Set up the Mac environment
|
||||||
|
run: brew install autoconf automake libtool
|
||||||
|
if: runner.os == 'macOS'
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
|
- name: run tests
|
||||||
|
run: cargo test --all --all-features
|
||||||
|
|
||||||
|
lint:
|
||||||
|
name: Check Rust code with rustfmt and clippy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
components: rustfmt, clippy
|
||||||
|
- name: run rustfmt
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
- name: run clippy
|
||||||
|
run: cargo clippy --all --all-features -- -Dwarnings
|
||||||
Loading…
Reference in New Issue