-
Notifications
You must be signed in to change notification settings - Fork 83
106 lines (83 loc) · 2.63 KB
/
test.yml
File metadata and controls
106 lines (83 loc) · 2.63 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
name: test
on:
pull_request:
branches:
- "**"
types:
- edited
- opened
- ready_for_review
- review_requested
- synchronize
push:
branches:
- main
workflow_call:
workflow_dispatch:
jobs:
rust:
name: rust
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Install llvm-cov tools
run: |
cargo install cargo-llvm-cov
rustup component add llvm-tools
- name: Set up coverage environment
run: |
cargo llvm-cov show-env --sh | sed "s/^export //" | sed "s/['\"]//g" >> "$GITHUB_ENV"
- name: Build
run: cargo build --package paddler
- name: Run unit tests
run: make test.unit
- name: Validate test coverage
run: |
LLVM_PROFDATA=$(find ~/.rustup -name llvm-profdata | head -1)
LLVM_COV=$(find ~/.rustup -name llvm-cov | head -1)
"$LLVM_PROFDATA" merge -sparse target/paddler-*.profraw -o target/merged.profdata
OBJECTS=$(find target/debug/deps \
-name "agent_*" -o -name "balancer_*" -o -name "chat_template*" \
-o -name "paddler-*" \
-o -name "paddler_client-*" \
-o -name "paddler_types-*" \
| grep -v '\.d$' | grep -v '\.o$' | sort -u | sed 's/^/-object=/')
COVERAGE=$("$LLVM_COV" export target/debug/paddler $OBJECTS \
--instr-profile=target/merged.profdata \
--ignore-filename-regex='\.cargo|rustc' \
--format=text --summary-only \
| jq '.data[0].totals.lines.percent')
echo "Line coverage: ${COVERAGE}%"
THRESHOLD=40
if (( $(echo "$COVERAGE < $THRESHOLD" | bc -l) )); then
echo "Coverage ${COVERAGE}% is below threshold ${THRESHOLD}%"
exit 1
fi
python:
name: python (${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.13"]
defaults:
run:
working-directory: paddler_client_python
steps:
- name: checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: pip install poetry
- name: Install dependencies
run: poetry install
- name: Run ruff
run: poetry run ruff check
- name: Run mypy
run: poetry run mypy paddler_client/
- name: Run tests
run: poetry run pytest tests/ -v