-
Notifications
You must be signed in to change notification settings - Fork 5
60 lines (53 loc) · 1.88 KB
/
Copy pathpytest.yml
File metadata and controls
60 lines (53 loc) · 1.88 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
name: CI
on:
workflow_call:
workflow_dispatch:
push:
branches: [ main ]
paths: [ 'optimi/**', 'tests/**' ]
pull_request:
paths: [ 'optimi/**', 'tests/**' ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Python and uv with caching
uses: astral-sh/setup-uv@v7
with:
version: ">=0.9.18,<0.10.0"
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "pyproject.toml"
- name: Install optimi
run: uv sync --group cpu
- name: Ruff Check
id: ruff
run: |
uv run ruff check --output-format=github .
uv run ruff format --check .
- name: Run Tests
id: pytest
run: |
REPORT="$(mktemp)"
echo "report-path=$REPORT" >> $GITHUB_OUTPUT
uv run pytest -v -m cpu --md=$REPORT
# Modified from https://github.com/pavelzw/pytest-action, MIT License
- name: Add report to summary
run: |
echo "::group::..."
FINAL_REPORT="$(mktemp)"
echo "# Pytest Report" > "$FINAL_REPORT"
echo "<details><summary>Click to expand!</summary>" >> "$FINAL_REPORT"
tail -n+2 "${{ steps.pytest.outputs.report-path }}" >> "$FINAL_REPORT"
echo "</details>" >> "$FINAL_REPORT"
cat "$FINAL_REPORT" >> "$GITHUB_STEP_SUMMARY"
echo "::endgroup::"
echo
echo "====================================================================================="
echo Markdown summaries: "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
echo "====================================================================================="