-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (59 loc) · 1.96 KB
/
python.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
name: Python CI
on: [push]
env:
PYTHON_SRC: "src"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
environment:
name: release
url: https://pypi.org/p/cenclave-lib-crypto
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"
- name: Package metadata
id: metadata
run: |
echo "PACKAGE_VERSION=$(python -c 'import cenclave_lib_crypto; print(cenclave_lib_crypto.__version__)')" >> $GITHUB_OUTPUT
- name: Code format with black
run: |
python -m black --check $PYTHON_SRC
- name: Import check with isort
run: |
python -m isort --check $PYTHON_SRC
- name: Lint check with pylint
run: |
python -m pylint $PYTHON_SRC
- name: Lint check with pycodestyle
run: |
python -m pycodestyle $PYTHON_SRC
- name: Lint check with pydocstyle
run: |
python -m pydocstyle $PYTHON_SRC
- name: Typecheck with MyPy
run: |
python -m mypy $PYTHON_SRC
- name: Test with pytest
run: |
python -m pytest
- name: Build package
if: ${{ startsWith(github.ref, 'refs/tags') && endsWith(github.ref, steps.metadata.outputs.PACKAGE_VERSION) }}
run: python -m build
- name: Publish package to PyPi
if: ${{ startsWith(github.ref, 'refs/tags') && endsWith(github.ref, steps.metadata.outputs.PACKAGE_VERSION) }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: false