continuwuity/.forgejo/workflows/formatting.yml
Jade Ellis f14725a51b
ci: Check formatting
Also moves rustup installation to a seperate workflow and
enables caching.
The sccache action required a github.com api token, so we set
all that up too.
2025-05-20 21:31:41 +01:00

44 lines
1.1 KiB
YAML

name: Rust Formatting
on:
push:
pull_request:
jobs:
format:
name: Format
runs-on: ubuntu-latest
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install rust
uses: ./.forgejo/actions/rust-toolchain
with:
toolchain: "nightly"
components: "rustfmt"
- uses: https://github.com/actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
github-api-url: https://api.github.com
owner: ${{ vars.GH_APP_OWNER }}
repositories: ""
- name: Install sccache
uses: ./.forgejo/actions/sccache
with:
token: ${{ steps.app-token.outputs.token }}
- name: Check formatting
run: |
cargo +nightly fmt --all -- --check
- name: Show sccache stats
run: sccache --show-stats