Repository navigation
85 lines (80 loc) · 2.99 KB
/
Copy pathtest.yml
File metadata and controls
85 lines (80 loc) · 2.99 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
name: test
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
test:
name: test (${{ matrix.name }})
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- name: python-minimum
python-version: "3.11"
uv-args: --resolution lowest-direct
- name: python-3.12
python-version: "3.12"
uv-args: --locked
- name: python-3.13
python-version: "3.13"
uv-args: --locked
- name: python-latest
python-version: "3.14"
uv-args: --upgrade
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
version-file: uv.lock
python-version: ${{ matrix.python-version }}
cache-suffix: test-${{ matrix.name }}
- run: uv run ${{ matrix.uv-args }} --all-extras pytest
package:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
version-file: uv.lock
cache-suffix: package
- name: Build the sdist and a wheel from it
run: uv build
- run: uv run --locked --only-group ci twine check --strict dist/*
- name: Check the wheel outside the checkout
working-directory: ${{ runner.temp }}
run: |
wheel=$(echo "$GITHUB_WORKSPACE"/dist/*.whl)
uv venv venv
export VIRTUAL_ENV="$PWD/venv" PATH="$PWD/venv/bin:$PATH"
uv pip install "$wheel"
uv pip check
python -c "import pathlib, synthient; assert pathlib.Path(synthient.__file__).with_name('py.typed').exists(); print(synthient.__file__, synthient.__version__)"
if python -c "import synthient.grpcschema" 2> import-error.txt; then
echo "::error::synthient.grpcschema imported without the grpc extra installed"
exit 1
fi
if ! grep -q "synthient\[grpc\]" import-error.txt; then
cat import-error.txt
echo "::error::the grpcschema import error does not mention synthient[grpc]"
exit 1
fi
uv pip install "$wheel[grpc]"
uv pip check
python -c "import synthient.grpcschema"
uv export --locked --project "$GITHUB_WORKSPACE" --no-emit-project --no-hashes --output-file constraints.txt
uv pip install pyright --constraint constraints.txt
pyright --verifytypes synthient --ignoreexternal