-
Notifications
You must be signed in to change notification settings - Fork 10
/
tox.ini
86 lines (80 loc) · 2.86 KB
/
tox.ini
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
81
82
83
84
85
86
[tox]
skipsdist = true
toxworkdir = {toxinidir}/build/.tox
envlist = test
# This is the default test environment; see
# https://tox.readthedocs.io/en/latest/config.html#generating-environments-conditional-settings
# for how we use it for multiple environments; at the moment, these are:
#
# <no env specified>: run noisy linting and tests
# ci: As above, but with settings suitable for jenkins
# lint: run quiet linting and stop
[testenv]
skip_install = true
allowlist_externals =
poetryw
mkdir
passenv =
SSH_AUTH_SOCK
setenv =
BUILD_DIR = {toxinidir}/build/{envname}
RUFF_OPTS =
FLAKE8_OPTS = --count --show-source --statistics
AUTOFLAKE_OPTS = --exclude build --recursive --remove-all-unused-imports
POETRY_OPTS = -v
PYTEST_OPTS =
# Linting should be quiet and fast
lint: RUFF_OPTS = --quiet --fast
lint: FLAKE8_OPTS =
lint: POETRY_OPTS = --quiet --no-root
commands_pre =
./poetryw install {env:POETRY_OPTS}
commands =
ruff {env:RUFF_OPTS} check --diff .
autoflake {env:AUTOFLAKE_OPTS} --check .
isort --check --diff .
flake8 {env:FLAKE8_OPTS}
!lint: mkdir -p {env:BUILD_DIR}
!lint: pytest --verbose {env:PYTEST_OPTS} {posargs} tests
# The format environment should fix any errors detected by the lint
# environment
[testenv:format]
commands =
ruff check --fix .
autoflake {env:AUTOFLAKE_OPTS} --in-place .
isort .
# docker-build and docker-push environments; docker-push requires
# RELEASE_VERSION (x.y.z), DOCKER_REGISTRY, DOCKER_REGISTRY_CREDS_USR and
# DOCKER_REGISTR_CREDS_PSW to be set
[testenv:docker-{build,push}]
skip_install = true
allowlist_externals =
docker
passenv =
SSH_AUTH_SOCK
RELEASE_VERSION
DOCKER_REGISTRY
DOCKER_REGISTRY_CREDS_USR
DOCKER_REGISTRY_CREDS_PSW
setenv =
DOCKER_BUILDKIT=1
DOCKER_PROJECT=datastax/hunter
commands =
docker buildx build --tag {env:DOCKER_PROJECT}:latest --ssh=default .
push: docker image tag {env:DOCKER_PROJECT}:latest {env:DOCKER_PROJECT}:{env:RELEASE_VERSION}
push: docker image tag {env:DOCKER_PROJECT}:{env:RELEASE_VERSION} {env:DOCKER_REGISTRY}/{env:DOCKER_PROJECT}:{env:RELEASE_VERSION}
push: docker image tag {env:DOCKER_PROJECT}:latest {env:DOCKER_REGISTRY}/{env:DOCKER_PROJECT}:latest
push: docker login -u {env:DOCKER_REGISTRY_CREDS_USR} -p {env:DOCKER_REGISTRY_CREDS_PSW} {env:DOCKER_REGISTRY}
push: docker image push {env:DOCKER_REGISTRY}/{env:DOCKER_PROJECT}:{env:RELEASE_VERSION}
push: docker image push {env:DOCKER_REGISTRY}/{env:DOCKER_PROJECT}:latest
[pytest]
# Ensure we do not include BUILD_DIR by explicitly specifying where to search for tests
testpaths =
tests
[flake8]
extend_exclude = build
extend_ignore =
# Black compatibility; see https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
E203
# Let black determine whether a line is too long
E501