-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (58 loc) · 1.97 KB
/
test-and-publish.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
name: Test & Publish
on: [push, pull_request]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install --upgrade pip
- name: Build and install slixmpp-omemo
run: pip install .
- name: Install test dependencies
run: |
pip install --upgrade pytest pytest-asyncio pytest-cov mypy pylint flake8 setuptools
- name: Type-check using mypy
run: mypy --strict --disable-error-code str-bytes-safe --untyped-calls-exclude=slixmpp slixmpp_omemo/ setup.py examples/ tests/
- name: Lint using pylint
run: pylint slixmpp_omemo/ setup.py examples/ tests/
- name: Format-check using Flake8
run: flake8 slixmpp_omemo/ setup.py examples/ tests/
- name: Test using pytest
run: pytest --cov=slixmpp_omemo --cov-report term-missing:skip-covered
build:
name: Build source distribution and wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build source distribution and wheel
run: python3 setup.py sdist bdist_wheel
- uses: actions/upload-artifact@v4
with:
name: dist
path: |
dist/*.tar.gz
dist/*.whl
publish:
needs: [test, build]
runs-on: ubuntu-latest
permissions:
id-token: write
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1