-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (116 loc) · 4.06 KB
/
integration.yml
File metadata and controls
133 lines (116 loc) · 4.06 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Integration Tests
on:
push:
branches: [main]
concurrency:
group: integration-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
# -----------------------------------------------------------------------
# Unit tests (no external services)
# -----------------------------------------------------------------------
unit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install offwork + dev deps
run: |
pip install -e ".[redis,rabbitmq]"
pip install pytest pytest-asyncio
- name: Run unit tests
run: pytest tests/ --ignore=tests/test_e2e.py -v
# -----------------------------------------------------------------------
# End-to-end matrix
# -----------------------------------------------------------------------
e2e:
runs-on: ubuntu-latest
needs: unit
strategy:
fail-fast: false
matrix:
backend:
- name: redis
url: redis://localhost:6379
extras: redis
- name: rabbitmq
url: amqp://localhost
extras: rabbitmq
signing: [false, true]
sandbox: [false, true]
name: "e2e · ${{ matrix.backend.name }} · sign=${{ matrix.signing }} · sandbox=${{ matrix.sandbox }}"
services:
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 5
rabbitmq:
image: rabbitmq:3
ports:
- 5672:5672
options: >-
--health-cmd "rabbitmq-diagnostics -q ping"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
# --- Install --------------------------------------------------------
- name: Install offwork + backend extras
run: |
pip install -e ".[${{ matrix.backend.extras }}]"
pip install pytest pytest-asyncio pytest-timeout
# --- Sandbox setup --------------------------------------------------
- name: Build sandbox Docker image
if: matrix.sandbox
run: bash helpers/setup_sandbox_docker.sh
# --- Signing setup --------------------------------------------------
- name: Generate signing token
if: matrix.signing
run: |
TOKEN=$(python -c "from offwork.core.token import generate_token; print(generate_token())")
echo "OFFWORK_SIGNING_TOKEN=$TOKEN" >> "$GITHUB_ENV"
# --- Run e2e tests --------------------------------------------------
- name: Run end-to-end tests
env:
OFFWORK_TEST_BACKEND: ${{ matrix.backend.url }}
OFFWORK_TEST_SIGNING: ${{ matrix.signing && '1' || '0' }}
OFFWORK_TEST_SANDBOX: ${{ matrix.sandbox && '1' || '0' }}
run: pytest tests/test_e2e.py -x -v --timeout=120
# --- Dump worker logs on failure ------------------------------------
- name: Show worker stderr on failure
if: failure()
run: |
echo "=== Worker process logs ==="
# Collected by the test fixtures via subprocess
cat /tmp/offwork-worker-*.log 2>/dev/null || echo "(no log files)"
# -----------------------------------------------------------------------
# Mypy type checking
# -----------------------------------------------------------------------
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install offwork + dev deps
run: |
pip install -e ".[redis,rabbitmq,ws]"
pip install mypy pytest pytest-asyncio
- name: Run mypy
run: mypy offwork/