-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
40 lines (33 loc) · 1.33 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
stages:
- codecheck
# WORKFLOW RULES
# ------------------------------------------------------------------------------------------------------
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"'
when: never
- if: '$CI_COMMIT_BRANCH'
# ------------------------------------------------------------------------------------------------------
# TEMPLATES
# ------------------------------------------------------------------------------------------------------
.base_template:
image: python:3.7-slim-buster
tags:
- build
- internet
# --------------------------------------------------------------------------------------------------
# JOBS
# ------------------------------------------------------------------------------------------------------
# CODE CHECK BY PRE-COMMIT HOOKS
pre-commit_hooks_MR:
stage: codecheck
extends: .base_template
before_script:
- apt-get update && apt-get install -y -q git
- python -m pip install pre-commit
script:
- git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA | xargs pre-commit run --files
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# ------------------------------------------------------------------------------------------------------