Debian Codegraph @

.github/workflows/ci.yaml

raw
1 name: ci
2
3 on:
4 pull_request:
5 push:
6 branches: [main]
7 tags: ['*']
8
9 jobs:
10 black:
11 runs-on: ubuntu-latest
12 steps:
13 - uses: actions/checkout@v3
14 - uses: actions/setup-python@v4
15 with:
16 python-version: '3.10'
17 - run: pip install poetry
18 - run: poetry install
19 - run: poetry run black --check .
20
21 build:
22 runs-on: ubuntu-latest
23 steps:
24 - uses: actions/checkout@v3
25 - uses: actions/setup-python@v4
26 with:
27 python-version: '3.10'
28 - run: pip install poetry
29 - run: poetry build
30 - uses: actions/upload-artifact@v3
31 with:
32 name: dist
33 path: dist/
34
35 flake8:
36 runs-on: ubuntu-latest
37 steps:
38 - uses: actions/checkout@v3
39 - uses: actions/setup-python@v4
40 with:
41 python-version: '3.10'
42 - run: pip install poetry
43 - run: poetry install
44 - run: poetry run flake8
45
46 mypy:
47 runs-on: ubuntu-latest
48 steps:
49 - uses: actions/checkout@v3
50 - uses: actions/setup-python@v4
51 with:
52 python-version: '3.10'
53 - run: pip install poetry
54 - run: poetry install
55 - run: poetry run mypy .
56
57 pytest:
58 runs-on: ubuntu-latest
59 strategy:
60 matrix:
61 python-version:
62 - '3.7'
63 - '3.8'
64 - '3.9'
65 - '3.10'
66 steps:
67 - uses: actions/checkout@v3
68 - uses: actions/setup-python@v4
69 with:
70 python-version: ${{ matrix.python-version }}
71 - run: pip install poetry
72 - run: poetry install
73 - run: poetry run pytest --cov --cov-report=xml
74 - uses: codecov/codecov-action@v3
75 if: ${{ matrix.python-version == '3.10' }}
76
77 publish:
78 runs-on: ubuntu-latest
79 needs: [black, build, flake8, mypy, pytest]
80 if: startsWith(github.ref, 'refs/tags/')
81 steps:
82 - uses: actions/download-artifact@v3
83 with:
84 name: dist
85 path: dist/
86 - uses: pypa/gh-action-pypi-publish@release/v1
87 with:
88 user: __token__
89 password: ${{ secrets.PYPI_API_TOKEN }}