Skip to content
Snippets Groups Projects
Commit 30fc88a6 authored by Chris Burr's avatar Chris Burr
Browse files

Merge branch 'pre-commit-copyright' into 'master'

Move pre-commit check for copyright notice

See merge request !1178
parents 5bd2d504 0684b2f3
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@
# or submit itself to any jurisdiction. #
###############################################################################
stages:
- check
- test
- docs
- deploy
......@@ -17,56 +17,6 @@ variables:
TARGET_BRANCH: master
NO_LBLOGIN: "1"
check-copyright:
image: gitlab-registry.cern.ch/ci-tools/ci-worker:cc7
stage: check
script:
- curl -o lb-check-copyright "https://gitlab.cern.ch/lhcb-core/LbDevTools/raw/master/LbDevTools/SourceTools.py?inline=false"
- python lb-check-copyright origin/${TARGET_BRANCH} --exclude lhcbproject.yml
allow_failure: true
pre-commit-checks:
image: registry.cern.ch/docker.io/library/python:3.10
stage: check
variables:
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
cache:
paths:
- ${CI_PROJECT_DIR}/.cache
before_script:
- |
python -m venv ${CI_PROJECT_DIR}/.cache/pre-commit-venv
. ${CI_PROJECT_DIR}/.cache/pre-commit-venv/bin/activate
pip install pre-commit
git fetch origin $TARGET_BRANCH
git config user.name "Gitlab CI"
git config user.email "noreply@cern.ch"
script:
- |
if ! pre-commit run --show-diff-on-failure --from-ref FETCH_HEAD --to-ref HEAD ; then
echo ""
echo "Generating patch file..."
git commit -a -m "pre-commit fixes
patch generated by ${CI_JOB_URL}" > /dev/null
git format-patch HEAD~
cat <<EOF
=======================================
You can apply these changes with:
curl ${CI_JOB_URL}/artifacts/raw/0001-pre-commit-fixes.patch | git am
=======================================
EOF
exit 1
fi
artifacts:
paths:
- 0001-pre-commit-fixes.patch
when: on_failure
expire_in: 1 week
.docs-base:
stage: docs
image: gitlab-registry.cern.ch/lhcb-core/lbdocker/centos7-build:latest
......@@ -140,3 +90,7 @@ pages:
paths:
- public
expire_in: 1 hour
include:
- project: 'lhcb-core/dev-tools/ci-utils'
file: 'gitlab-ci-fragments/pre-commit-checks.yaml'
......@@ -35,3 +35,8 @@ repos:
types_or: [python, yaml]
exclude: ".pre-commit-config.yaml"
entry: 'eoslhcb.cern.ch//eos/lhcb/'
- repo: "https://gitlab.cern.ch/lhcb-core/LbDevTools.git"
rev: 2.1.4
hooks:
- id: lb-add-copyright
exclude: "^lhcbproject.yml$"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment