-
Notifications
You must be signed in to change notification settings - Fork 3
53 lines (43 loc) · 1.4 KB
/
build-pull-request.yaml
File metadata and controls
53 lines (43 loc) · 1.4 KB
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
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 }}