-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy path.gitlab-ci-check-python3-format.yml
More file actions
80 lines (77 loc) · 2.48 KB
/
.gitlab-ci-check-python3-format.yml
File metadata and controls
80 lines (77 loc) · 2.48 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# .gitlab-ci-check-python3-format.yml
#
# This gitlab-ci file runs the Black code formatter https://github.com/psf/black
# on the Python3 code in the repository, and fails the pipeline if the code is
# not formatted according to standard Black's formatting rules.
#
# Add it to the project in hand through Gitlab's include functionality
#
# include:
# - project: 'Northern.tech/Mender/mendertesting'
# file: '.gitlab-ci-check-python3-format.yml'
#
# Some things to consider before including this file. The Black code formatter
# accepts a project-local configuration file
# (https://github.com/psf/black#pyprojecttoml). This enables project specific
# configuration of the Black tool. This is especially handy for ignoring, and/or
# excluding specific directories from being evaluated.
#
# The configuration parameters available match the command-line parameters as listed here:
# https://github.com/psf/black#command-line-options
#
# Example 'pyproject.toml' file:
#
# [tool.black]
# target-version = ['py37']
# include = '\.py$'
# exclude = '''
# (
# /(
# \.eggs # exclude a few common directories
# | \.git
# | \.hg
# | \.mypy_cache
# | \.tox
# | \.venv
# | _build
# | buck-out
# | build
# | dist
# )/
# | foo.py # also separately exclude a file named foo.py in
# # the root of the project
# )
# '''
#
include:
- project: 'Northern.tech/Mender/mendertesting'
file: 'qa-common/retry.yml'
stages:
- test
test:check-python3-formatting:
tags:
- k8s-small
image: registry.gitlab.com/northern.tech/mender/mender-test-containers:python-black-master
stage: test
needs: []
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
before_script:
# Install dependencies
- !reference [.qa-common-network-git-clone-retry, before_script] # requires git
# Rename the branch we're on, so that it's not in the way for the
# subsequent fetch. It's ok if this fails, it just means we're not on any
# branch.
- git branch -m temp-branch || true
# Git trick: Fetch directly into our local branches instead of remote
# branches.
- git fetch -f origin 'refs/heads/*:refs/heads/*'
# Get last remaining tags, if any.
- git fetch --tags origin
- git clone --depth=1 https://github.com/mendersoftware/mendertesting /tmp/mendertesting
script:
# Check that the Python code is correctly formatted
- env /tmp/mendertesting/check_python_code_format