Skip to content

Commit de7b997

Browse files
committed
CI workflow
1 parent eaf785b commit de7b997

2 files changed

Lines changed: 473 additions & 0 deletions

File tree

.github/workflows/integration.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Integration Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
concurrency:
8+
group: integration-${{ github.head_ref || github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
# -----------------------------------------------------------------------
13+
# Unit tests (no external services)
14+
# -----------------------------------------------------------------------
15+
unit:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
python-version: ["3.13"]
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install pyfuse + dev deps
28+
run: |
29+
pip install -e ".[redis,rabbitmq]"
30+
pip install pytest pytest-asyncio
31+
32+
- name: Run unit tests
33+
run: pytest tests/ --ignore=tests/test_e2e.py -x -q
34+
35+
# -----------------------------------------------------------------------
36+
# End-to-end matrix
37+
# -----------------------------------------------------------------------
38+
e2e:
39+
runs-on: ubuntu-latest
40+
needs: unit
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
backend:
45+
- name: redis
46+
url: redis://localhost:6379
47+
extras: redis
48+
- name: rabbitmq
49+
url: amqp://localhost
50+
extras: rabbitmq
51+
signing: [false, true]
52+
sandbox: [false, true]
53+
54+
name: "e2e · ${{ matrix.backend.name }} · sign=${{ matrix.signing }} · sandbox=${{ matrix.sandbox }}"
55+
56+
services:
57+
redis:
58+
image: redis:7
59+
ports:
60+
- 6379:6379
61+
options: >-
62+
--health-cmd "redis-cli ping"
63+
--health-interval 5s
64+
--health-timeout 3s
65+
--health-retries 5
66+
rabbitmq:
67+
image: rabbitmq:3
68+
ports:
69+
- 5672:5672
70+
options: >-
71+
--health-cmd "rabbitmq-diagnostics -q ping"
72+
--health-interval 5s
73+
--health-timeout 5s
74+
--health-retries 10
75+
76+
steps:
77+
- uses: actions/checkout@v4
78+
- uses: actions/setup-python@v5
79+
with:
80+
python-version: "3.13"
81+
82+
# --- Install --------------------------------------------------------
83+
- name: Install pyfuse + backend extras
84+
run: |
85+
pip install -e ".[${{ matrix.backend.extras }}]"
86+
pip install pytest pytest-asyncio pytest-timeout
87+
88+
# --- Sandbox setup --------------------------------------------------
89+
- name: Build sandbox Docker image
90+
if: matrix.sandbox
91+
run: bash scripts/setup_sandbox_docker.sh
92+
93+
# --- Signing setup --------------------------------------------------
94+
- name: Generate signing token
95+
if: matrix.signing
96+
run: |
97+
TOKEN=$(python -c "from pyfuse.core.token import generate_token; print(generate_token())")
98+
echo "PYFUSE_SIGNING_TOKEN=$TOKEN" >> "$GITHUB_ENV"
99+
100+
# --- Run e2e tests --------------------------------------------------
101+
- name: Run end-to-end tests
102+
env:
103+
PYFUSE_TEST_BACKEND: ${{ matrix.backend.url }}
104+
PYFUSE_TEST_SIGNING: ${{ matrix.signing && '1' || '0' }}
105+
PYFUSE_TEST_SANDBOX: ${{ matrix.sandbox && '1' || '0' }}
106+
run: pytest tests/test_e2e.py -x -v --timeout=120
107+
108+
# --- Dump worker logs on failure ------------------------------------
109+
- name: Show worker stderr on failure
110+
if: failure()
111+
run: |
112+
echo "=== Worker process logs ==="
113+
# Collected by the test fixtures via subprocess
114+
cat /tmp/pyfuse-worker-*.log 2>/dev/null || echo "(no log files)"
115+
116+
# -----------------------------------------------------------------------
117+
# Mypy type checking
118+
# -----------------------------------------------------------------------
119+
typecheck:
120+
runs-on: ubuntu-latest
121+
steps:
122+
- uses: actions/checkout@v4
123+
- uses: actions/setup-python@v5
124+
with:
125+
python-version: "3.13"
126+
127+
- name: Install pyfuse + dev deps
128+
run: |
129+
pip install -e ".[redis,rabbitmq]"
130+
pip install mypy pytest pytest-asyncio
131+
132+
- name: Run mypy
133+
run: mypy pyfuse/

0 commit comments

Comments
 (0)