-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (77 loc) · 2.04 KB
/
ci.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
name: CI
on:
push:
branches: [master]
tags: [v*]
pull_request:
branches: [master]
pull_request_target:
branches: [master]
schedule:
- cron: 0 4 * * *
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
if: |
(github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') ||
(github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]')
strategy:
matrix:
py_version: ['3.8', '3.9', '3.10', '3.11']
steps:
- name: Checkout commit
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.py_version }}
- name: Cache packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-py-${{ matrix.py_version }}-${{ hashFiles('setup.py')
}}-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: make setup
- name: Lint
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
make lint
env:
CI_LINT_RUN: 1
- name: Run tests
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
file: .coverage.xml
flags: py${{ matrix.py_version }}
name: codecov
deploy:
name: Release client
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout commit
uses: actions/checkout@v4
- name: Install python
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install twine build
- name: Make dist
run: |
python -m build
- name: PyPI upload
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_NON_INTERACTIVE: 1
run: |
twine upload dist/*