CI / CD Pipeline
The bohicalog module is built and tested automatically by the CI / CD pipeline. The pipeline is defined in the .gitlab-ci.yml file. The pipeline is triggered by a push to the master branch. The pipeline consists of the following stages:
lint: runs the linter(s) on the code
docs: runs the linter(s) on the documentation
test: runs the unit tests
release: builds the package and publishes it to PyPI
Github Action File
The full test.yml is listed below:
1name: Tests
2
3on:
4 push:
5 branches: [ main, develop ]
6 pull_request:
7 branches: [ main ]
8
9jobs:
10 lint:
11 name: Lint
12 runs-on: ubuntu-latest
13 strategy:
14 matrix:
15 python-version: [ "3.8"]
16 steps:
17 - uses: actions/checkout@v2
18 - name: Set up Python ${{ matrix.python-version }}
19 uses: actions/setup-python@v2
20 with:
21 python-version: ${{ matrix.python-version }}
22 - name: Install dependencies
23 run: |
24 sudo apt-get install graphviz
25 pip install tox
26 - name: Check manifest
27 run: tox run -e manifest
28 #- name: Check code quality with flake8
29 # run: tox run -e flake8
30 - name: Check package metadata with Pyroma
31 run: tox run -e pyroma
32 - name: Check static typing with MyPy
33 run: tox run -e mypy
34 docs:
35 name: Documentation
36 runs-on: ubuntu-latest
37 strategy:
38 matrix:
39 python-version: [ "3.8"]
40 steps:
41 - uses: actions/checkout@v2
42 - name: Set up Python ${{ matrix.python-version }}
43 uses: actions/setup-python@v2
44 with:
45 python-version: ${{ matrix.python-version }}
46 - name: Install dependencies
47 run: |
48 pip install tox
49 sudo apt-get install graphviz
50 - name: Check RST conformity with doc8
51 run: tox run -e doc8
52 - name: Check docstring coverage
53 run: tox run -e docstr-coverage
54 - name: Check documentation build with Sphinx
55 run: tox run -e docs-test
56 env:
57 TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
58 TELEGRAM_BOT_CHAT_ID: ${{ secrets.TELEGRAM_BOT_CHAT_ID }}
59 tests:
60 name: Tests
61 runs-on: ${{ matrix.os }}
62 strategy:
63 matrix:
64 os: [ ubuntu-latest ]
65 python-version: [ "3.8"]
66 steps:
67 - uses: actions/checkout@v2
68 - name: Set up Python ${{ matrix.python-version }}
69 uses: actions/setup-python@v2
70 with:
71 python-version: ${{ matrix.python-version }}
72 - name: Install dependencies
73 run: pip install tox
74 - name: Test with pytest and generate coverage file
75 run:
76 tox run -e py
77 - name: Upload coverage report to codecov
78 uses: codecov/codecov-action@v1
79 if: success()
80 with:
81 file: coverage.xml
82 release:
83 name: Release
84 runs-on: ubuntu-latest
85 needs: [lint, docs, tests]
86 if: github.event_name == 'push' && github.ref == 'refs/heads/main'
87 steps:
88 - uses: actions/checkout@v2
89 - name: Set up Python 3.8
90 uses: actions/setup-python@v2
91 with:
92 python-version: 3.8
93 - name: Install dependencies
94 run: pip install tox
95 - name: Build and publish
96 env:
97 TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
98 TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
99 run: tox run -e release