Skip to content

Commit 36bcfa9

Browse files
committed
New CI flow
1 parent 41da02c commit 36bcfa9

File tree

4 files changed

+57
-38
lines changed

4 files changed

+57
-38
lines changed

.github/workflows/build_and_test_python.yml renamed to .github/workflows/ci.yml

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
name: Python tests
1+
name: CI
2+
run-name: "${{ github.event_name == 'workflow_dispatch' && format('CI: {0}', github.ref_name) || '' }}"
23

34
on:
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

1220
jobs:
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
@@ -70,4 +85,32 @@ jobs:
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+
uses: JRubics/[email protected]
115+
with:
116+
pypi_token: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/python-publish.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,6 @@ ignore_errors = true
8080

8181
[tool.ruff]
8282
output-format = "github"
83+
84+
[tool.mypy]
85+
files = ["./src", "./tests"]

src/saic_ismart_client_ng/net/crypto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def encrypt_request(
7474
request_path = str(original_request_url).replace(base_uri, "/")
7575
request_body = original_request_content
7676
new_content = original_request_content
77-
if request_body and "multipart" not in original_content_type:
77+
if request_body and (not original_content_type or "multipart" not in original_content_type):
7878
modified_content_type = normalize_content_type(original_content_type)
7979
request_content = request_body.strip()
8080
if request_content:

0 commit comments

Comments
 (0)