-
Notifications
You must be signed in to change notification settings - Fork 17
/
config.yml
121 lines (120 loc) · 4.28 KB
/
config.yml
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6
environment:
PATH: /usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/home/circleci/.local/bin
steps:
- checkout
- setup_remote_docker
- run: docker build --target=base --tag=sbrunner/scan-to-paperless .
- run: docker build --target=tests --tag=tests .
- run:
name: pylint
command: docker run --rm tests pylint process
when: always
- run:
name: pyflakes
command: docker run --rm tests python3 -m pyflakes .
when: always
- run:
name: bandit
command: docker run --rm tests bandit -r process
when: always
- run:
name: mypy
command: docker run --rm tests mypy -- process
when: always
- run:
name: codespell
command: docker run --rm tests codespell --check-filenames --skip=./Deskew/*,*.pyc,*.png
when: always
- run:
name: Init Docker volumes
command: |
docker run --rm --detach --name volumes --volume=tests:/tests --volume=results:/results alpine tail -f /dev/null
docker cp tests/ volumes:/tests/
when: always
- run:
name: pytest
command: >
docker run --rm --env=PYTHONPATH=/opt/
--volume=results:/results --volume=tests:/tests
tests bash -c '
mv /opt/process /opt/process.py &&
cd /tests &&
coverage run --source=process --module pytest --durations=0 --verbose --color=yes
--profile --profile-svg --junitxml=/results/test-reports/junit.xml . &&
coverage report &&
coverage html --directory=/results/coverage'
no_output_timeout: 20m
- run:
name: Extract data from Docker volumes
command: |
docker cp volumes:/results/ ./
mkdir -p results/
docker cp volumes:/tests/prof/ results/
when: always
- store_artifacts:
path: results
destination: results
- store_test_results:
path: results/test-reports
- run: docker build --target=all --tag=sbrunner/scan-to-paperless:all .
- run: docker login --username $DOCKER_USER --password $DOCKER_PASS
- deploy:
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]
then
docker push sbrunner/scan-to-paperless
docker push sbrunner/scan-to-paperless:all
fi
- deploy:
command: |
if [ "${CIRCLE_BRANCH}" == "test" ]
then
docker tag sbrunner/scan-to-paperless sbrunner/scan-to-paperless:test
docker tag sbrunner/scan-to-paperless:all sbrunner/scan-to-paperless:test-all
docker push sbrunner/scan-to-paperless:test
docker push sbrunner/scan-to-paperless:test-all
fi
- run:
name: Init Git
command: |
git remote add push https://${GITHUB_TOKEN}@github.com/sbrunner/scan-to-paperless
git config credential.helper 'cache --timeout=120'
git config user.email "<ci@ci.com>"
git config user.name "CI"
- run:
name: Init pypi
command: |
echo "[pypi]" > ~/.pypirc
echo "username = ${PYPI_USER}" >> ~/.pypirc
echo "password = ${PYPI_PASS}" >> ~/.pypirc
pip install --user wheel twine
- deploy:
command: |
if [ "${CIRCLE_BRANCH}" == "test" ]
then
python setup.py egg_info --tag-date --tag-build dev sdist bdist_wheel
twine upload dist/*
fi
- deploy:
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]
then
python setup.py egg_info --no-date sdist bdist_wheel
twine upload dist/*
fi
- run:
name: Bump version
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]
then
pip install --user bump-anything
bump minor
git add setup.py
git commit --allow-empty -m "[skip ci] Bump Version"
git push push ${CIRCLE_BRANCH}
fi