-
Notifications
You must be signed in to change notification settings - Fork 1
114 lines (96 loc) · 2.93 KB
/
main.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
name: Python Architecture Linter
on: [push]
jobs:
lint-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9]
poetry-version: [1.1.6]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Cache poetry
id: cache-poetry
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry
key: cache-poetry
- name: Install Project Dependencies
run: |
poetry install
- name: Lint with black
run: |
poetry run black . --check
- name: Cache mypy
id: cache-mypy
uses: actions/cache@v2
with:
path: .mypy_cache
key: cache-mypy
- name: Lint with mypy
run: |
poetry run mypy .
- name: Lint with flake8 --ignore=E501
run: |
poetry run flake8 . --count --show-source --statistics --ignore=E501
- name: Lint with isort
run: |
poetry run isort . --check
- name: Test with pytest
run: |
poetry run coverage run -m pytest -x --tb=short -q --cov-report term-missing --cov=. --cov-report xml
poetry run coverage report
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Check poetry lock file
run: |
pip install poetry-lock-check==0.1.0
python -m poetry_lock_check check-lock
- name: Cache pants
id: cache-pants
uses: actions/cache@v2
with:
path: ~/.cache/pants
key: cache-pants
- name: Verify packages can be built
run: |
PANTS_SHA=3272cf81eda9ad57373e6b136ea49fdca15652c0 ./pants package ::
package-and-release:
runs-on: ubuntu-latest
needs: lint-and-test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Cache pants
id: cache-pants
uses: actions/cache@v2
with:
path: ~/.cache/pants
key: cache-pants
- name: Build packages
run: |
PANTS_SHA=3272cf81eda9ad57373e6b136ea49fdca15652c0 ./pants package ::
- name: Deploy packages
run: |
pip install twine
TWINE_USERNAME="__token__" \
TWINE_PASSWORD="${{ secrets.PYPI_API_TOKEN }}" \
twine upload dist/* --skip-existing --verbose