mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 10:35:50 +00:00
Update clang-format workflow
This commit is contained in:
43
.github/workflows/clang-format.yml
vendored
43
.github/workflows/clang-format.yml
vendored
@@ -4,34 +4,23 @@ on: [push, pull_request]
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
env:
|
env:
|
||||||
CLANG_VERSION: 10
|
CLANG_VERSION: 18
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
# - name: Install clang-format
|
- name: Install clang-format
|
||||||
# run: |
|
|
||||||
# codename=$( lsb_release --codename --short )
|
|
||||||
# sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null <<EOF
|
|
||||||
# deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
|
||||||
# deb-src http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
|
||||||
# EOF
|
|
||||||
# wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add
|
|
||||||
# sudo apt-get update -y
|
|
||||||
# sudo apt-get install -y clang-format-${CLANG_VERSION}
|
|
||||||
|
|
||||||
# Temporary fix until this commit is merged
|
|
||||||
# https://github.com/XRPLF/rippled/commit/552377c76f55b403a1c876df873a23d780fcc81c
|
|
||||||
- name: Download and install clang-format
|
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update -y
|
codename=$( lsb_release --codename --short )
|
||||||
sudo apt-get install -y libtinfo5
|
sudo tee /etc/apt/sources.list.d/llvm.list >/dev/null <<EOF
|
||||||
curl -LO https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.1/clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
|
deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||||
tar -xf clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
|
deb-src http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${CLANG_VERSION} main
|
||||||
sudo mv clang+llvm-10.0.1-x86_64-linux-gnu-ubuntu-16.04 /opt/clang-10
|
EOF
|
||||||
sudo ln -s /opt/clang-10/bin/clang-format /usr/local/bin/clang-format-10
|
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add
|
||||||
- name: Format sources
|
sudo apt-get update
|
||||||
run: find include src -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.ipp' \) -exec clang-format-${CLANG_VERSION} -i {} +
|
sudo apt-get install clang-format-${CLANG_VERSION}
|
||||||
|
- name: Format first-party sources
|
||||||
|
run: find include src -type f \( -name '*.cpp' -o -name '*.hpp' -o -name '*.h' -o -name '*.ipp' \) -exec clang-format-${CLANG_VERSION} -i {} +
|
||||||
- name: Check for differences
|
- name: Check for differences
|
||||||
id: assert
|
id: assert
|
||||||
run: |
|
run: |
|
||||||
@@ -39,7 +28,7 @@ jobs:
|
|||||||
git diff --exit-code | tee "clang-format.patch"
|
git diff --exit-code | tee "clang-format.patch"
|
||||||
- name: Upload patch
|
- name: Upload patch
|
||||||
if: failure() && steps.assert.outcome == 'failure'
|
if: failure() && steps.assert.outcome == 'failure'
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v3
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
name: clang-format.patch
|
name: clang-format.patch
|
||||||
@@ -61,7 +50,7 @@ jobs:
|
|||||||
To fix it, you can do one of two things:
|
To fix it, you can do one of two things:
|
||||||
1. Download and apply the patch generated as an artifact of this
|
1. Download and apply the patch generated as an artifact of this
|
||||||
job to your repo, commit, and push.
|
job to your repo, commit, and push.
|
||||||
2. Run 'git-clang-format --extensions c,cpp,h,cxx,ipp dev'
|
2. Run 'git-clang-format --extensions cpp,h,hpp,ipp develop'
|
||||||
in your repo, commit, and push.
|
in your repo, commit, and push.
|
||||||
run: |
|
run: |
|
||||||
echo "${PREAMBLE}"
|
echo "${PREAMBLE}"
|
||||||
|
|||||||
Reference in New Issue
Block a user