1- name : Python tests
1+ name : CI
2+ run-name : " ${{ github.event_name == 'workflow_dispatch' && format('CI: {0}', github.ref_name) || '' }}"
23
34on :
45 push :
56 branches :
67 - ' *'
78 pull_request :
8- types : [ opened, synchronize, reopened ]
9- branches :
10- - ' *'
9+ release :
10+ types : [ published ]
11+ workflow_dispatch :
12+
13+ concurrency :
14+ group : ${{ github.workflow }}-${{ (github.event_name == 'release' && github.run_id) || github.event.pull_request.number || github.ref }}
15+ cancel-in-progress : true
16+
17+ permissions :
18+ contents : read
1119
1220jobs :
1321 build :
1422
1523 runs-on : ubuntu-latest
24+
1625 strategy :
26+ fail-fast : false
1727 matrix :
18- python-version : [ "3.11", "3.12" ]
28+ python-version : [ "3.11", "3.12", "3.13" ]
1929
2030 steps :
2131 - name : Checkout code
@@ -44,17 +54,22 @@ jobs:
4454 run : |
4555 poetry install --no-interaction --no-root
4656
47- - name : Install library
57+ - name : Install as a library
4858 run : poetry install --no-interaction
4959
50- - name : Run tests with coverage
60+ - name : Run mypy
5161 run : |
52- poetry run pytest tests --cov --junit-xml=junit/test-results-${{ matrix.python-version }}.xml
62+ poetry run mypy src
63+ # Temporary until we fix all typing issues
64+ continue-on-error : true
5365
5466 - name : Lint with Ruff
5567 run : |
5668 poetry run ruff check .
57- continue-on-error : true
69+
70+ - name : Run tests with coverage
71+ run : |
72+ poetry run pytest tests --cov --junit-xml=junit/test-results-${{ matrix.python-version }}.xml
5873
5974 - name : Surface failing tests
6075 uses : pmeier/pytest-results-action@main
7085
7186 # (Optional) Fail the workflow if no JUnit XML was found.
7287 fail-on-empty : true
73- if : ${{ always() }}
88+ if : ${{ always() }}
89+
90+ release :
91+ name : Release to PyPi
92+ if : ${{ github.event_name == 'release' }}
93+ runs-on : ubuntu-latest
94+ needs :
95+ - build
96+
97+ environment :
98+ name : release
99+ url : https://pypi.org/p/saic_ismart_client_ng
100+
101+ permissions :
102+ contents : read
103+
104+ steps :
105+ - name : Check out code from GitHub
106+ uses : actions/checkout@v4
107+
108+ - name : Set up Python
109+ uses : actions/setup-python@v5
110+ with :
111+ python-version : ' 3.11'
112+
113+ - name : Build and publish to pypi
114+ 115+ with :
116+ pypi_token : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments