-
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (124 loc) · 4.07 KB
/
ci.yml
File metadata and controls
138 lines (124 loc) · 4.07 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
134
135
136
137
138
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
test:
name: Python ${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v5
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install (with Celery + Django adapters)
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,celery,django]"
- name: Run tests
run: pytest
lint:
name: Static analysis (ruff + mypy)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install (dev + all adapters for type context)
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,celery,django,redis,amqp,sqs]"
- name: Ruff
run: ruff check src tests
- name: Mypy
run: mypy
integration:
name: Broker integration (Redis · RabbitMQ · SQS)
runs-on: ubuntu-latest
services:
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
rabbitmq:
image: rabbitmq:3
ports:
- 5672:5672
options: >-
--health-cmd "rabbitmq-diagnostics -q ping"
--health-interval 10s
--health-timeout 5s
--health-retries 15
# Free, SQS-compatible broker for the SqsTransport round-trip. The native
# image is shell-less, so readiness is polled by a TCP-probe step below.
elasticmq:
image: softwaremill/elasticmq-native:1.6.11
ports:
- 9324:9324
steps:
- uses: actions/checkout@v5
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install (all adapters — full coverage with brokers)
run: |
python -m pip install --upgrade pip
pip install -e ".[redis,amqp,sqs,celery,django,dev]"
- name: Wait for ElasticMQ
run: |
for i in $(seq 1 30); do
if (echo > /dev/tcp/localhost/9324) >/dev/null 2>&1; then
echo "ElasticMQ port 9324 open"; exit 0
fi
sleep 2
done
echo "ElasticMQ did not open port 9324"; exit 1
- name: Run full suite with coverage gate (>=90%)
env:
BABELQUEUE_TEST_REDIS: redis://localhost:6379/0
BABELQUEUE_TEST_AMQP: amqp://guest:guest@localhost:5672/
SQS_ENDPOINT: http://localhost:9324
AWS_REGION: us-east-1
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
run: pytest --cov=babelqueue --cov-report=term-missing --cov-fail-under=90
conformance:
name: Conformance suite in sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Verify vendored conformance matches the canonical suite
run: |
git clone --depth 1 https://github.com/BabelQueue/conformance.git "$RUNNER_TEMP/conformance"
diff -ru "$RUNNER_TEMP/conformance/manifest.json" "tests/conformance/manifest.json"
diff -ru "$RUNNER_TEMP/conformance/fixtures" "tests/conformance/fixtures"
diff -ru "$RUNNER_TEMP/conformance/schema" "tests/conformance/schema"
echo "Vendored conformance is in sync with the canonical suite."
ci-green:
name: CI green
runs-on: ubuntu-latest
needs: [test, lint, integration, conformance]
if: ${{ always() }}
steps:
- name: Fail if any required job did not pass
run: |
if ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}; then
echo "A required job failed or was cancelled."
exit 1
fi