-
Notifications
You must be signed in to change notification settings - Fork 17
111 lines (97 loc) · 3.61 KB
/
main.yaml
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
---
name: Continuous integration
on:
push:
pull_request:
env:
HAS_SECRETS: ${{ secrets.HAS_SECRETS }}
jobs:
build:
name: Continuous integration
runs-on: ubuntu-20.04
timeout-minutes: 15
if: "!startsWith(github.event.head_commit.message, '[skip ci] ')"
steps:
- uses: actions/checkout@v2
if: env.HAS_SECRETS != 'HAS_SECRETS'
- uses: actions/checkout@v2
with:
token: ${{ secrets.TOKEN }}
if: env.HAS_SECRETS == 'HAS_SECRETS'
- run: echo "${HOME}/.local/bin" >> ${GITHUB_PATH}
- run: python3 -m pip install --user --requirement=ci/requirements.txt
- name: Checks
run: c2cciutils-checks
# the if the generated files are up to date
- run: ./run-jsonschema-gentypes
- run: jsonschema2md scan_to_paperless/config_schema.json config.md
- run: jsonschema2md scan_to_paperless/process_schema.json process.md
- run: git diff --quiet
- run: git diff
if: failure()
- run: docker build --target=base --tag=sbrunner/scan-to-paperless .
- run: docker build --target=tests --tag=tests .
- run: docker run --rm tests prospector --output=pylint
- name: Init Docker volumes
run: |
docker run --rm --detach --name volumes --volume=tests:/tests --volume=results:/results alpine tail -f /dev/null
docker cp tests/ volumes:/tests/
- name: pytest
run: >
docker run --rm --env=PYTHONPATH=/opt/
--volume=results:/results --volume=tests:/tests
tests bash -c '
cd /tests &&
coverage run --source=scan_to_paperless --module pytest --durations=0 --verbose --color=yes
--profile --profile-svg --junitxml=/results/test-reports/junit.xml . &&
coverage report &&
coverage html --directory=/results/coverage'
- name: Extract data from Docker volumes
run: |
docker cp volumes:/results/ ./
mkdir -p results/
docker cp volumes:/tests/prof/ results/
- uses: actions/upload-artifact@v2
with:
name: results
path: results
if-no-files-found: ignore
retention-days: 5
if: failure()
- uses: actions/upload-artifact@v2
with:
name: Test report
path: results/test-reports
if-no-files-found: ignore
retention-days: 5
if: failure()
- run: docker build --target=all --tag=sbrunner/scan-to-paperless:latest-all .
- run: docker login --username=${{ secrets.DOCKER_USERNAME }} --password=${{ secrets.DOCKER_PASSWORD }}
- name: Init pypi
run: |
echo "[pypi]" > ~/.pypirc
echo "username = ${{ secrets.PYPI_USERNAME }}" >> ~/.pypirc
echo "password = ${{ secrets.PYPI_PASSWORD }}" >> ~/.pypirc
pip install --user wheel twine
if: env.HAS_SECRETS == 'HAS_SECRETS'
- name: Init Git
run: |
git config user.email "<ci@ci.com>"
git config user.name "CI"
if: env.HAS_SECRETS == 'HAS_SECRETS'
- name: Bump version
run: |
python3 -m pip install --user bump-anything
bump minor
git add setup.py
git commit --allow-empty -m "[skip ci] Bump Version"
git push
if: github.ref == 'refs/heads/master'
- name: Publish PyPI
run: |
c2cciutils-publish --type=version_tag --version=$(python3 ./setup.py --version)
if: github.ref == 'refs/heads/master'
- name: Publish Docker
run: |
c2cciutils-publish --group=docker
if: env.HAS_SECRETS == 'HAS_SECRETS'