Commit c8c6af11 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Add pre-commit pipeline template

parent 467dde19
Loading
Loading
Loading
Loading
+3 −17
Original line number Diff line number Diff line
@@ -11,6 +11,9 @@ workflow:
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
  - if: $CI_COMMIT_BRANCH

include:
- local: pipeline-templates/pre-commit.yml


.python:
  image: python:3.9
@@ -25,23 +28,6 @@ workflow:
  - pip install "pip>=21.3"


Quality Gate:
  stage: .pre
  image: docker.kodo.org.uk/ci-images/pre-commit:latest
  variables:
    PRE_COMMIT_HOME: $CI_PROJECT_DIR/cache/pre-commit
  cache:
    key: $CI_JOB_IMAGE
    paths: [cache]
  rules:
  - if: $CI_PIPELINE_SOURCE == "push"
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
  script:
  - source .gitlab-ci.pre-commit-run.bash
  - pre_commit_run --hook-stage=commit
  - pre_commit_run --hook-stage=push


Build Package:
  stage: build
  extends: [.python]
+13 −0
Original line number Diff line number Diff line
Push Checks:
  stage: .pre
  image: docker.kodo.org.uk/ci-images/pre-commit:2.20.0
  rules:
  - if: $CI_PIPELINE_SOURCE == "push"
  variables:
    PRE_COMMIT_HOME: $CI_PROJECT_DIR/cache/pre-commit
  cache:
    key: $CI_JOB_IMAGE
    paths: [cache]
  script:
  - pre-commit-run --hook-stage=commit
  - pre-commit-run --hook-stage=push