Repository navigation
107 lines (91 loc) · 3.43 KB
/
Copy pathpython-client-ci.yaml
File metadata and controls
107 lines (91 loc) · 3.43 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
name: Python client CI
on:
workflow_call:
pull_request:
paths:
- ".github/workflows/python-client-ci.yaml"
- "clients/python/**"
- "clients/wire_vectors.json"
- "clients/error_guides.json"
push:
branches:
- main
paths:
- ".github/workflows/python-client-ci.yaml"
- "clients/python/**"
- "clients/wire_vectors.json"
- "clients/error_guides.json"
permissions:
contents: read
jobs:
test:
name: Python client tests
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
# The suite publishes dict payloads, which default to msgpack, so the
# optional msgpack extra must be present. The msgpack-absent path is covered
# separately by test_optional_msgpack.py, which monkeypatches the import
# rather than relying on msgpack actually being uninstalled here. The tls-pin
# extra (cryptography) is needed to path-validate a CA-fingerprint pin; its
# absent path is covered by a monkeypatched test the same way.
- name: Sync dependencies
working-directory: clients/python
run: uv sync --dev --extra msgpack --extra tls-pin
- name: Type check
working-directory: clients/python
run: uv run mypy
- name: Run tests
working-directory: clients/python
run: uv run pytest -q
examples:
name: Examples against a real broker
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
# The examples publish plain dicts, which default to msgpack encoding, so the
# optional msgpack extra must be present here too.
- name: Sync dependencies
working-directory: clients/python
run: uv sync --dev --extra msgpack
# Reuse the published server image instead of building from source: client CI
# runs against the latest-main broker, which is what client-only changes want
# and is far faster than a Rust build.
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
- name: Start broker container
run: |
image="ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/fibril-server:main"
# Host networking so the client connects over real loopback. The broker
# only accepts password auth from a loopback peer (cleartext), and Docker
# port-mapping would make the connection non-loopback and 401.
docker run -d --name fibril-server --network host "$image"
- name: Wait for broker health
run: |
for _ in $(seq 1 60); do
if curl --fail --silent http://127.0.0.1:8081/healthz; then
echo "broker healthy"; exit 0
fi
sleep 1
done
echo "broker did not become healthy"; docker logs fibril-server; exit 1
- name: Run examples
env:
FIBRIL_EXTERNAL_BROKER: "1"
FIBRIL_ADDR: "127.0.0.1:9876"
run: clients/python/examples/run-all.sh
- name: Broker logs
if: always()
run: docker logs fibril-server || true
- name: Stop broker container
if: always()
run: docker rm -f fibril-server || true