mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-04-27 10:39:25 -04:00
106 lines
2.3 KiB
YAML
106 lines
2.3 KiB
YAML
name: Style
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
- ready_for_review
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
style:
|
|
name: Check Formatting
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' || !github.event.pull_request.draft
|
|
|
|
steps:
|
|
- name: Checkout the repo
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
components: rustfmt
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Cargo fmt
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: fmt
|
|
args: -- --check
|
|
|
|
pre-commit-styles:
|
|
name: Check Style
|
|
if: github.event_name == 'push' || !github.event.pull_request.draft
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Actions Repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
components: clippy
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Setup Python Env
|
|
uses: actions/setup-python@v2
|
|
|
|
- name: Check Styles with pre-commit
|
|
uses: pre-commit/action@v2.0.3
|
|
with:
|
|
# only run `commit`-hooks, excludes typos, clippy, etc
|
|
extra_args: --show-diff-on-failure --hook-stage commit
|
|
|
|
typos:
|
|
name: Spell Check with Typos
|
|
needs: [style]
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' || !github.event.pull_request.draft
|
|
|
|
steps:
|
|
- name: Checkout Actions Repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Check the spelling of the files in our repo
|
|
uses: crate-ci/typos@master
|
|
|
|
clippy:
|
|
name: Run clippy
|
|
needs: [style]
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' || !github.event.pull_request.draft
|
|
|
|
steps:
|
|
- name: Checkout the repo
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
components: clippy
|
|
profile: minimal
|
|
override: true
|
|
|
|
- name: Load cache
|
|
uses: Swatinem/rust-cache@v1
|
|
|
|
- name: Clippy
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: run
|
|
args: -p xtask -- ci clippy
|