-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (63 loc) · 2.31 KB
/
tests.yml
File metadata and controls
73 lines (63 loc) · 2.31 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
name: Tests
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: test (${{ matrix.os }}, ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install with dev extra
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
- name: Run ruff
run: python -m ruff check src/ tests/
- name: Guard — ANTHROPIC_API_KEY must NOT be set for default suite
run: |
if [ -n "${ANTHROPIC_API_KEY:-}" ]; then
echo "::error::ANTHROPIC_API_KEY is set in the default test environment."
echo "This can cause non-'live'-marked tests to leak real API calls."
echo "Either unset the key, or mark the test with @pytest.mark.live."
exit 1
fi
shell: bash
- name: Run tests (with coverage on ubuntu x py3.11)
run: |
if [ "${{ matrix.os }}" = "ubuntu-latest" ] && [ "${{ matrix.python-version }}" = "3.11" ]; then
python -m pytest tests/ -v --tb=short --cov --cov-report=term-missing --cov-report=xml
else
python -m pytest tests/ -v --tb=short
fi
shell: bash
- name: Upload coverage artifact
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: actions/upload-artifact@v4
with:
name: coverage-attune-author
path: coverage.xml
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
with:
files: ./coverage.xml
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}