Add Pre-commit config and add to CI pipeline

This commit is contained in:
Ben Davis 2022-08-25 10:24:47 +00:00 committed by Matteo Franchin
parent 8444165b25
commit 962472c729
2 changed files with 40 additions and 24 deletions

View file

@ -1,4 +1,4 @@
# Copyright (c) 2019 Arm Limited.
# Copyright (c) 2019, 2022 Arm Limited.
#
# SPDX-License-Identifier: MIT
#
@ -20,31 +20,37 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
default:
image: "registry.fedoraproject.org/fedora"
# For now start from a standard Fedora image and install everything each time.
before_script:
- pwd
- uname -a
# Install necessary packages.
# Oddly the exit status of the command below is nonzero even on success, just ignore it.
- yes | dnf install make cmake gcc g++ python git libxcb-devel libxkbcommon-devel wayland-devel libXrandr-devel || true
# Check out and set-up the Vulkan Loader.
- mkdir /build
- pushd /build
- git clone --depth=1 https://github.com/KhronosGroup/Vulkan-Loader.git
- cd Vulkan-Loader
- mkdir build
- cd build/
- ../scripts/update_deps.py
# Build the Vulkan loader.
- cmake -C helper.cmake ..
- make
- make install
- popd
pre-commit:
image: python:3.10.6
rules:
- if: $CI_MERGE_REQUEST_DIFF_BASE_SHA
script:
- pip install pre-commit
- echo Using $CI_MERGE_REQUEST_DIFF_BASE_SHA as Pre-commit base
- pre-commit run --show-diff-on-failure --from-ref $CI_MERGE_REQUEST_DIFF_BASE_SHA --to-ref HEAD
build_vulkan_wsi_layer:
# For now start from a standard Fedora image and install everything each time.
image: "registry.fedoraproject.org/fedora"
before_script:
- pwd
- uname -a
# Install necessary packages.
# Oddly the exit status of the command below is nonzero even on success, just ignore it.
- yes | dnf install make cmake gcc g++ python git libxcb-devel libxkbcommon-devel wayland-devel libXrandr-devel || true
# Check out and set-up the Vulkan Loader.
- mkdir /build
- pushd /build
- git clone --depth=1 https://github.com/KhronosGroup/Vulkan-Loader.git
- cd Vulkan-Loader
- mkdir build
- cd build/
- ../scripts/update_deps.py
# Build the Vulkan loader.
- cmake -C helper.cmake ..
- make
- make install
- popd
script:
- pwd
- mkdir build

10
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,10 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
minimum_pre_commit_version: 2.9.0
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v10.0.1
hooks:
- id: clang-format