-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (105 loc) · 3.84 KB
/
build.yaml
File metadata and controls
124 lines (105 loc) · 3.84 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
name: Build
on:
push:
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-and-test:
name: Build and Test
permissions:
contents: read
issues: read
checks: write
pull-requests: write
strategy:
fail-fast: true
matrix:
python-version: ['3.12']
runs-on: ['ubuntu-latest']
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "**/uv.lock"
- name: Install dependencies
run: uv sync --all-groups --all-extras --frozen
- name: Run prek
uses: j178/prek-action@v1
continue-on-error: true
env:
SKIP: uv-lock
- name: Build dependencies
run: uv build
- name: Upload dist
uses: actions/upload-artifact@v7
with:
name: ${{ github.event.repository.name }}-${{ runner.os }}-${{ matrix.python-version }}-${{ github.sha }}
path: dist/
if: ${{ always() }}
- name: Run tests
run: |
uv run pytest -c pyproject.toml \
--cov-config=pyproject.toml \
--cov-report=html \
--cov-report=xml:coverage-${{ runner.os }}-${{ matrix.python-version }}.xml \
--junitxml=junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml \
--benchmark-disable
# MishaKav/pytest-coverage-comment
- name: Coverage summary report
uses: irongut/CodeCoverageSummary@v1.3.0
with:
filename: coverage-${{ runner.os }}-${{ matrix.python-version }}.xml
badge: true
format: "markdown"
output: "both"
if: ${{ always() }}
- name: Upload test coverage
uses: actions/upload-artifact@v7
with:
name: pytest-coverage-${{ runner.os }}-${{ matrix.python-version }}
path: code-coverage-results.md
if: ${{ always() }}
- name: Read code coverage file
id: coverage-file
uses: juliangruber/read-file-action@v1
with:
path: code-coverage-results.md
if: ${{ always() && github.event_name == 'pull_request' && github.event.workflow_run.conclusion != 'skipped' && runner.os == 'Linux' }}
- name: Add coverage PR comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: Code Coverage ${{ runner.os }} ${{ matrix.python-version }}
message: |
## Code Coverage ${{ runner.os }} ${{ matrix.python-version }}
${{ steps.coverage-file.outputs.content }}
Results for commit ${{ github.sha }}.
if: ${{ always() && github.event_name == 'pull_request' && github.event.workflow_run.conclusion != 'skipped' && runner.os == 'Linux' }}
- name: Upload test results
uses: actions/upload-artifact@v7
with:
name: pytest-results-${{ runner.os }}-${{ matrix.python-version }}
path: junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml
if: ${{ always() }}
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
check_name: Test Results ${{ runner.os }} ${{ matrix.python-version }}
report_individual_runs: true
files: junit/test-results-${{ runner.os }}-${{ matrix.python-version }}.xml
if: ${{ always() && github.event_name == 'pull_request' && github.event.workflow_run.conclusion != 'skipped' && runner.os == 'Linux' }}