Files
kumomta/.github/workflows/fmt.yml
T
2023-02-15 09:56:04 -07:00

47 lines
1.2 KiB
YAML

name: Check code formatting
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Install Rust"
uses: actions-rs/toolchain@v1
with:
profile: "minimal"
toolchain: "nightly"
default: true
override: true
components: "rustfmt"
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true"
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-mdbook-${{ hashFiles('.github/workflows/fmt.yml') }}
- name: Rust formatting
run: |
source $HOME/.cargo/env
cargo +nightly fmt --all -- --check
- name: Install stylua
run: |
source $HOME/.cargo/env
(test -x ~/.cargo/bin/stylua || (cd && cargo install stylua --features lua54 --vers "^0.16" --locked))
- name: Lua formatting
run: |
source $HOME/.cargo/env
stylua --check --config-path stylua.toml .