Repository navigation
112 lines (104 loc) · 3.36 KB
/
Copy pathtesting.yml
File metadata and controls
112 lines (104 loc) · 3.36 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
name: Testing
on:
push:
branches:
- main
- release/*
paths-ignore:
- '**.md'
pull_request:
branches:
- main
- release/*
paths-ignore:
- '**.md'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: testing-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Test ${{ matrix.os }} / Python ${{ matrix.python }}
strategy:
matrix:
python: [ '3.12', '3.13' ]
os: [ 'windows-latest', 'ubuntu-latest' ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout codes
uses: actions/checkout@v4
- name: Set up uv and Python ${{ matrix.python }}
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python }}
activate-environment: true
- name: Install dependencies
run: |
uv sync --group dev --locked
uv pip install pytest-cov
- name: Test with pytest
run: uv run python -m pytest --cov=polaris --cov-report=xml
- name: Upload coverage reports to Codecov
if: matrix.python == '3.12' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
package:
name: Build and verify wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up uv and Python
uses: astral-sh/setup-uv@v6
with:
python-version: '3.12'
- name: Verify lockfile
run: uv lock --check
- name: Build distributions
run: uv build
- name: Create clean wheel environment
run: uv venv "$RUNNER_TEMP/polaris-wheel-venv" --python 3.12
- name: Install wheel with dependencies
run: |
uv pip install --python "$RUNNER_TEMP/polaris-wheel-venv/bin/python" \
dist/*.whl \
"pytest>=8.3,<9" \
"pytest-asyncio>=0.24,<0.25"
- name: Verify installed distribution
working-directory: ${{ runner.temp }}
run: |
"$RUNNER_TEMP/polaris-wheel-venv/bin/python" - <<'PY'
import sys
from importlib.metadata import version
from pathlib import Path
import polaris
from polaris import Configuration, ConsumerAPI, SkillAPI, ProviderAPI, SDKContext, SDKError
assert version("polaris-python") == polaris.__version__
assert Path(polaris.__file__).resolve().is_relative_to(Path(sys.prefix).resolve())
config = Configuration()
config.set_default()
assert config.get_global().get_server_connector().get_protocol() == "grpc"
assert all(
hasattr(polaris, name)
for name in (
"Configuration",
"ConsumerAPI",
"SkillAPI",
"ProviderAPI",
"SDKContext",
"SDKError",
)
)
print(f"verified polaris-python {polaris.__version__} from {polaris.__file__}")
PY
- name: Run tests against installed wheel
run: |
"$RUNNER_TEMP/polaris-wheel-venv/bin/python" -m pytest tests -q -m "not e2e"
- name: Upload wheel and sdist
uses: actions/upload-artifact@v4
with:
name: polaris-python-dist
path: dist/
retention-days: 14