Skip to content

Clang Format

Clang Format #1

Workflow file for this run

# ##############################################################################
# OASIS: Open Algebra Software for Inferring Solutions
#
# clang-format.yml
# ##############################################################################
name: Clang Format
on:
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
format:
runs-on: ubuntu-latest
steps:
# Checks out the repository.
- name: Checkout repository
uses: actions/checkout@v4
# Installs LLVM 17 on the runner.
- name: Install LLVM 17
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17 all
# Commits and pushes changes.
- name: Format, Commit and Push
if: |
github.event_name == 'workflow_dispatch'
run: |
clang-format-17 -i src/**.cpp include/Oasis/**.hpp;
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git commit -am "[Actions] Run clang-format"
git push
# Fails if the workflow hasn't been run in the contributor's fork.
- name: Reject if not formatted
if: |
github.event_name == 'pull_request'
run: clang-format-17 -n -Werror src/**.cpp include/Oasis/**.hpp;