-
Notifications
You must be signed in to change notification settings - Fork 2
91 lines (86 loc) · 2.25 KB
/
ci.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
name: CI
on:
push:
branches:
- master
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:
branches:
- master
permissions:
contents: read
jobs:
test:
name: Tests and Linters
runs-on: ubuntu-22.04
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: make install
- name: Run linters
run: make lint
- name: Run mypy
run: make mypy
- name: Run tests
run: make test
license:
name: License compliance check
runs-on: ubuntu-22.04
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Dump all package's dependencies
run: |
make install-pip
make install-package
pip freeze > requirements.dump.txt
- name: Check Python deps licenses
id: license_check_report
uses: pilosus/action-pip-license-checker@v2
with:
requirements: 'requirements.dump.txt'
fail: 'StrongCopyleft,NetworkCopyleft,Other,Error'
totals: true
headers: true
- name: Print report
if: ${{ always() }}
run: echo "${{ steps.license_check_report.outputs.report }}"
publish:
name: Publish a package on PyPI
runs-on: ubuntu-22.04
needs: [test, license]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
make install-pip
make install-deps
- name: Build the package
run: make build
- name: Publish on PyPI
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: make push