Skip to content

Commit 2db59d7

Browse files
authored
Add docker image and Github action. (#617)
Apply style changes from black test.
1 parent 05dec7e commit 2db59d7

23 files changed

+586
-263
lines changed

.dockerignore

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# ignore all by default
2+
*
3+
4+
# explicitly allow certain code files, build files config files, and documentation
5+
!*.py
6+
!atlassian/**.py
7+
!docs/**.py
8+
!**.md
9+
!**.rst
10+
!*.txt
11+
!*.cfg
12+
!**/requirements.txt
13+
14+
# explicitly allow tests
15+
!doc/examples
16+
!tests
17+
18+
# always ignore these files
19+
**/*.pyc

.gitbugtraq

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# .gitbugtraq for Git GUIs (e.g. SmartGit) to show links to the Github issue tracker.
2+
[bugtraq]
3+
url = https://github.com/atlassian-api/atlassian-python-api/issues/%BUGID%
4+
loglinkregex = "#\\d+"
5+
logregex = \\d+

.github/workflows/test.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Test
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
14+
run-docker:
15+
16+
runs-on: ubuntu-18.04
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: ['3.4', '3.5', '3.6', '3.7', '3.8']
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Run Docker
26+
run: |
27+
make docker-qa PYTHON_VERSION=${{matrix.python-version}}
28+

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ install: pip install tox-travis
1717
before_script:
1818
- .travis/bump_version ./ minor > atlassian/VERSION
1919
script:
20-
- tox
20+
- make qa

CONTRIBUTING.rst

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Getting Started
1616
* Start up related product:
1717
- Standalone product atlas-run-standalone_
1818
- For cloud product, just do registration
19+
* Run the quality checks with `make qa` or if you have docker installed with `make docker-qa`
1920
* Send pull request
2021

2122
.. _Fork: https://help.github.com/articles/fork-a-repo/

Dockerfile.qa

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM ubuntu:18.04
2+
3+
ARG PYTHON_VERSION
4+
5+
RUN \
6+
apt update && \
7+
apt-get install -y make gcc-5 libkrb5-dev python$PYTHON_VERSION python3-pip && \
8+
apt-get clean
9+
10+
WORKDIR /atlassian-python-api
11+
COPY requirements.txt .
12+
COPY requirements-dev.txt .
13+
14+
ENV PYTHON_VERSION=PYTHON_VERSION
15+
16+
RUN \
17+
python3 -m pip install --no-cache-dir --upgrade pip && \
18+
python3 -m pip install --no-cache-dir -r requirements-dev.txt
19+
20+
CMD python3 -m pip install -e . && \
21+
make qa PYTHON_VERSION=$PYTHON_VERSION

Makefile

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This Makefile helps perform some developer tasks, like linting or testing.
2+
# Run `make` or `make help` to see a list of tasks.
3+
# Based on GCOVR project (https://github.com/gcovr/gcovr).
4+
5+
PYTHON_VERSION ?= 3.7
6+
7+
8+
QA_CONTAINER ?= atlassian-python-api-qa-$(PYTHON_VERSION)
9+
TEST_OPTS ?=
10+
11+
.PHONY: help setup-dev qa lint test doc docker-qa docker-qa-build
12+
13+
help:
14+
@echo "select one of the following targets:"
15+
@echo " help print this message"
16+
@echo " setup-dev prepare a development environment"
17+
@echo " qa run all QA tasks"
18+
@echo " test run the tests"
19+
@echo " docker-qa run qa in the docker container"
20+
@echo " docker-qa-build"
21+
@echo " build the qa docker container"
22+
@echo ""
23+
@echo "environment variables:"
24+
@echo " TEST_OPTS additional flags for pytest [current: $(TEST_OPTS)]"
25+
@echo " QA_CONTAINER"
26+
@echo " tag for the qa docker container [current: $(QA_CONTAINER)]"
27+
28+
setup-dev:
29+
python3 -m pip install --upgrade pip pytest
30+
python3 -m pip install -r requirements-dev.txt
31+
32+
qa: tox
33+
34+
tox:
35+
tox
36+
37+
docker-qa: export TEST_OPTS := $(TEST_OPTS)
38+
39+
docker-qa: | docker-qa-build
40+
docker run --rm -e TEST_OPTS -v `pwd`:/atlassian-python-api $(QA_CONTAINER)
41+
42+
docker-qa-build: Dockerfile.qa requirements.txt requirements-dev.txt
43+
docker build \
44+
--tag $(QA_CONTAINER) \
45+
--build-arg PYTHON_VERSION=$(PYTHON_VERSION) \
46+
--file $< .

0 commit comments

Comments
 (0)