2021-04-06 10:18:56 +00:00
|
|
|
# This is a basic workflow to help you get started with Actions
|
|
|
|
|
|
|
|
name: format-check
|
|
|
|
|
2024-04-09 02:12:56 +00:00
|
|
|
# Controls when the action will run.
|
2021-04-06 10:18:56 +00:00
|
|
|
on:
|
|
|
|
# Triggers the workflow on push or pull request events but only for the main branch
|
|
|
|
push:
|
|
|
|
branches: [ main ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ main ]
|
|
|
|
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
format-check:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
2022-03-09 11:47:42 +00:00
|
|
|
- name: install nightly rust
|
|
|
|
run: |
|
|
|
|
rm -f ~/.cargo/bin/rustfmt
|
|
|
|
rm -f ~/.cargo/bin/cargo-fmt
|
|
|
|
rustup toolchain install nightly --component rustfmt --component clippy --allow-downgrade
|
|
|
|
|
2024-05-16 17:12:39 +00:00
|
|
|
- name: install clang-format-18
|
2024-04-09 02:12:56 +00:00
|
|
|
run: |
|
|
|
|
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
2024-05-16 16:58:42 +00:00
|
|
|
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main'
|
2024-04-09 02:12:56 +00:00
|
|
|
sudo apt update
|
2024-05-16 16:58:42 +00:00
|
|
|
sudo apt install clang-format-18
|
2024-04-09 02:12:56 +00:00
|
|
|
|
2021-04-06 10:18:56 +00:00
|
|
|
- name: Run format-check
|
2022-03-09 11:47:42 +00:00
|
|
|
run: |
|
2024-05-16 17:12:39 +00:00
|
|
|
make format CLANG_FORMAT=clang-format-18
|
|
|
|
git diff
|
|
|
|
git reset --hard
|
2024-05-16 16:58:42 +00:00
|
|
|
make format-check CLANG_FORMAT=clang-format-18
|
2022-03-09 11:47:42 +00:00
|
|
|
make rustfmt-check
|