Skip to content

Commit 4fe8b0e

Browse files
authored
ci: add pull request build workflow for the project (#21)
* ci: add pull request build workflow for the project * ci: add mypy type checking step to pull request workflow Installs mypy and runs static type checks on the src directory during PR builds. Ensures type consistency is validated in CI. * ci: install types-requests and ignore missing stomp types in mypy config Adds types-requests to the PR build workflow to resolve missing stubs. Updates pyproject.toml to silence mypy errors for stomp imports. * fix: add missing __init__.py to mark swf_common_lib as a package * ci: add pytest coverage and post as PR comment Extends the pull request build to run pytest with coverage reporting.
1 parent ae78fc7 commit 4fe8b0e

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build Pull Request
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build-n-test:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: [3.12, 3.13, 3.14]
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
cache: pip
30+
31+
- name: Upgrade pip and install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install .
35+
pip install pytest pytest-cov mypy types-requests
36+
37+
- name: Check types
38+
run: |
39+
mypy src
40+
41+
- name: Run tests
42+
run: |
43+
pytest -v --cov=src --cov-report=term-missing | tee coverage.txt
44+
tail -n 10 coverage.txt > coverage_summary.txt
45+
46+
- name: Post test coverage as PR comment
47+
if: matrix.python-version == '3.14'
48+
run: |
49+
body=$(printf "### Test Coverage Summary\n\`\`\`\n%s\n\`\`\`" "$(cat coverage_summary.txt)")
50+
gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
51+
-f body="$body"
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,7 @@ dependencies = [
1919

2020
[tool.setuptools.packages.find]
2121
where = ["src"]
22+
23+
[[tool.mypy.overrides]]
24+
module = "stomp.*"
25+
ignore_missing_imports = true

0 commit comments

Comments
 (0)