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,11 +20,19 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
default:
image: "registry.fedoraproject.org/fedora"
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
# For now start from a standard Fedora image and install everything each time.
before_script:
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.
@ -43,8 +51,6 @@ before_script:
- make
- make install
- popd
build_vulkan_wsi_layer:
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