diff --git a/.github/workflows/build-pull-request.yaml b/.github/workflows/build-pull-request.yaml new file mode 100644 index 0000000..451b223 --- /dev/null +++ b/.github/workflows/build-pull-request.yaml @@ -0,0 +1,53 @@ +name: Build Pull Request + +on: + pull_request: + branches: + - '**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + build-n-test: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + python-version: [3.12, 3.13, 3.14] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: pip + + - name: Upgrade pip and install dependencies + run: | + python -m pip install --upgrade pip + pip install . + pip install pytest pytest-cov mypy types-requests + + - name: Check types + run: | + mypy src + + - name: Run tests + run: | + pytest -v --cov=src --cov-report=term-missing | tee coverage.txt + tail -n 10 coverage.txt > coverage_summary.txt + + - name: Post test coverage as PR comment + if: matrix.python-version == '3.14' + run: | + body=$(printf "### Test Coverage Summary\n\`\`\`\n%s\n\`\`\`" "$(cat coverage_summary.txt)") + gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \ + -f body="$body" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 2a431db..986ee1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,3 +19,7 @@ dependencies = [ [tool.setuptools.packages.find] where = ["src"] + +[[tool.mypy.overrides]] +module = "stomp.*" +ignore_missing_imports = true diff --git a/src/swf_common_lib/__init__.py b/src/swf_common_lib/__init__.py new file mode 100644 index 0000000..e69de29