File size: 1,544 Bytes
2c17839
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# This Makefile helps perform some developer tasks, like linting or testing.
# Run `make` or `make help` to see a list of tasks.
# Based on GCOVR project (https://github.com/gcovr/gcovr).

PYTHON_VERSION ?= 3.7

QA_CONTAINER ?= atlassian-python-api-qa-$(PYTHON_VERSION)
TEST_OPTS ?=

LINTING_TARGETS := atlassian/ examples/ tests/

.PHONY: help setup-dev qa lint test doc docker-qa docker-qa-build

help:
	@echo "select one of the following targets:"
	@echo "  help       print this message"
	@echo "  setup-dev  prepare a development environment"
	@echo "  qa         run all QA tasks"
	@echo "  test       run the tests"
	@echo "  docker-qa  run qa in the docker container"
	@echo "  docker-qa-build"
	@echo "             build the qa docker container"
	@echo ""
	@echo "environment variables:"
	@echo "  TEST_OPTS  additional flags for pytest [current: $(TEST_OPTS)]"
	@echo "  QA_CONTAINER"
	@echo "             tag for the qa docker container [current: $(QA_CONTAINER)]"

setup-dev:
	python3 -m pip install --upgrade pip pytest
	python3 -m pip install -r requirements-dev.txt

qa: tox

tox: export PYTHONDONTWRITEBYTECODE := 1

tox:
	tox

docker-qa: export TEST_OPTS := $(TEST_OPTS)
docker-qa: export PYTHONDONTWRITEBYTECODE := 1

docker-qa: | docker-qa-build
	docker run --rm -e TEST_OPTS -e PYTHONDONTWRITEBYTECODE -v `pwd`:/atlassian-python-api $(QA_CONTAINER)

docker-qa-build: Dockerfile.qa requirements.txt requirements-dev.txt
	docker build \
		--tag $(QA_CONTAINER) \
		--build-arg PYTHON_VERSION=$(PYTHON_VERSION) \
		--file $< .