mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
46 lines
1.7 KiB
YAML
46 lines
1.7 KiB
YAML
name: clang-format
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
clang-format-job:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Set apt mirror
|
|
# GitHub Actions apt proxy is super unstable
|
|
# see https://github.com/actions/runner-images/issues/7048
|
|
run: |
|
|
# make sure there is a `\t` between URL and `priority:*` attributes
|
|
printf 'http://azure.archive.ubuntu.com/ubuntu priority:1\n' | sudo tee /etc/apt/mirrors.txt
|
|
curl http://mirrors.ubuntu.com/mirrors.txt | sudo tee --append /etc/apt/mirrors.txt
|
|
sudo sed -i 's/http:\/\/azure.archive.ubuntu.com\/ubuntu\//mirror+file:\/etc\/apt\/mirrors.txt/' /etc/apt/sources.list
|
|
|
|
- name: Install clang-format 15.0
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install --option="APT::Acquire::Retries=3" clang-format-15
|
|
clang-format-15 --version
|
|
- uses: actions/checkout@v4
|
|
- name: Check format - ApplicationLibCode
|
|
run: |
|
|
cd ApplicationLibCode
|
|
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-15 -i
|
|
git diff
|
|
- name: Check format - ApplicationExeCode
|
|
run: |
|
|
cd ApplicationExeCode
|
|
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | xargs clang-format-15 -i
|
|
git diff
|
|
- name: Check format - AppFwk
|
|
run: |
|
|
cd Fwk/AppFwk
|
|
find -name '*.h' -o -name '*.cpp' -o -name '*.inl' | grep -v gtest | xargs clang-format-15 -i
|
|
git diff
|
|
- uses: peter-evans/create-pull-request@v6
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
commit-message: "Fixes by clang-format"
|
|
title: "Fixes by clang-format"
|
|
branch: clang-format-patches
|
|
branch-suffix: random
|