-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
46 lines (43 loc) · 1.51 KB
/
.gitlab-ci.yml
File metadata and controls
46 lines (43 loc) · 1.51 KB
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
41
42
43
44
45
46
stages: # List of stages for jobs, and their order of execution
- check
vale-linting:
image:
name: jdkato/vale:latest
entrypoint: [""]
stage: check
allow_failure: true
before_script:
- apk update && apk add git
script:
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab-ee.dev.ifm/syntron/support/csr/formatting-tools.git ${CI_PROJECT_DIR}/formatting-tools
- cd ${CI_PROJECT_DIR}/formatting-tools
- vale --minAlertLevel error ../ovp8xx ../README.md
pre-commit:
tags:
- shared_docker
image: python:3.9
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
variables:
PRE_COMMIT_TARGET_BRANCH: "${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}"
- variables:
PRE_COMMIT_TARGET_BRANCH: "${CI_DEFAULT_BRANCH}"
stage: check
before_script:
- python3.9 -m venv venv
- . venv/bin/activate
- pip install --upgrade pip
- pip install -r ci-requirements.txt
script:
- echo PRE_COMMIT_TARGET_BRANCH ${PRE_COMMIT_TARGET_BRANCH}
- echo CI_DEFAULT_BRANCH ${CI_DEFAULT_BRANCH}
- echo CI_MERGE_REQUEST_TARGET_BRANCH_NAME ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
- git fetch --unshallow origin "${PRE_COMMIT_TARGET_BRANCH}" >/dev/null
- MERGE_BASE=$(git merge-base "origin/${PRE_COMMIT_TARGET_BRANCH}" HEAD)
- echo "Merge base:" $MERGE_BASE
- pre-commit run --show-diff-on-failure --from-ref $MERGE_BASE --to-ref HEAD --hook-stage manual | tee tidy.txt
artifacts:
paths:
- tidy.txt
expire_in: 1 week
when: always