Add cmake-format to docker and mac runners (#1213)

For #1067
This commit is contained in:
Sergey Kuznetsov
2024-02-26 23:08:31 +00:00
committed by GitHub
parent c94f55b7eb
commit e98e74d768
3 changed files with 11 additions and 41 deletions

View File

@@ -1,36 +0,0 @@
name: Check format
description: Check format using clang-format-17
runs:
using: composite
steps:
- name: Add llvm repo
run: |
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-17 main' | sudo tee -a /etc/apt/sources.list
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
shell: bash
- name: Install packages
run: |
sudo apt update -qq
sudo apt install -y jq clang-format-17
sudo rm /usr/bin/clang-format
sudo ln -s /usr/bin/clang-format-17 /usr/bin/clang-format
shell: bash
- name: Run formatter
continue-on-error: true
id: run_formatter
run: |
./.githooks/pre-commit
shell: bash
- name: Check for differences
id: assert
shell: bash
run: |
git diff --color --exit-code | tee "clang-format.patch"
- name: Fail job
if: ${{ steps.run_formatter.outcome != 'success' }}
shell: bash
run: exit 1

View File

@@ -7,17 +7,22 @@ on:
workflow_dispatch:
jobs:
lint:
check_format:
name: Check format
runs-on: ubuntu-20.04
container:
image: rippleci/clio_ci:latest
steps:
- uses: actions/checkout@v4
- name: Run clang-format
uses: ./.github/actions/clang_format
- name: Run formatters
id: run_formatters
run: |
./.githooks/pre-commit
shell: bash
build:
name: Build
needs: lint
needs: check_format
strategy:
fail-fast: false
matrix:

View File

@@ -31,9 +31,10 @@ RUN apt update -qq \
&& update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-${GCC_VERSION} 100 \
&& update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-${GCC_VERSION} 100 \
&& update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-${GCC_VERSION} 100 \
&& update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${LLVM_TOOLS_VERSION} 100 \
&& apt-get clean && apt remove -y software-properties-common \
&& pip3 install -q --upgrade --no-cache-dir pip \
&& pip3 install -q --no-cache-dir conan==1.62 gcovr
&& pip3 install -q --no-cache-dir conan==1.62 gcovr cmake-format
# Install ccache from source
WORKDIR /tmp