-
Notifications
You must be signed in to change notification settings - Fork 1
162 lines (131 loc) · 4.21 KB
/
ci.yml
File metadata and controls
162 lines (131 loc) · 4.21 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
jobs:
# Format check - runs quickly, fail fast
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all --check --manifest-path Cargo.toml
- name: Clippy
run: cargo clippy --workspace --all-targets --manifest-path Cargo.toml -- -D warnings
# Build and test matrix
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- name: Build
run: cargo build --workspace --release --manifest-path Cargo.toml --exclude ruststack-py
- name: Run tests
run: cargo test --workspace --all-targets --manifest-path Cargo.toml --exclude ruststack-py
- name: Run doc tests
run: cargo test --workspace --doc --manifest-path Cargo.toml --exclude ruststack-py
# Integration tests with boto3
integration:
name: Integration Tests
runs-on: ubuntu-latest
needs: [fmt]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Build release binary
run: cargo build --release --manifest-path Cargo.toml
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Python dependencies
run: |
pip install boto3 requests pytest
- name: Start RustStack server
run: |
./target/release/ruststack --port 4566 &
echo "Waiting for server to start..."
for i in {1..30}; do
if curl -s http://localhost:4566/health > /dev/null 2>&1; then
echo "Server is ready!"
break
fi
sleep 1
done
- name: Run integration tests
run: |
pytest tests/integration/test_docker.py -v
env:
AWS_ENDPOINT_URL: http://localhost:4566
AWS_ACCESS_KEY_ID: test
AWS_SECRET_ACCESS_KEY: test
AWS_DEFAULT_REGION: us-east-1
- name: Stop RustStack server
if: always()
run: pkill ruststack || true
# All checks passed
ci-success:
name: CI Success
runs-on: ubuntu-latest
needs: [fmt, test, integration, python-bindings]
if: always()
steps:
- name: Check all jobs passed
run: |
if [[ "${{ needs.fmt.result }}" != "success" ]] || \
[[ "${{ needs.test.result }}" != "success" ]] || \
[[ "${{ needs.integration.result }}" != "success" ]] || \
[[ "${{ needs.python-bindings.result }}" != "success" ]]; then
echo "One or more jobs failed"
exit 1
fi
echo "All CI jobs passed!"
# Build Python bindings
python-bindings:
name: Python Bindings
runs-on: ubuntu-latest
env:
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.14'
- name: Install maturin
run: pip install maturin
- name: Build Python bindings
run: |
maturin build --release --interpreter python3 --manifest-path ruststack-py/Cargo.toml --out dist
- name: Install and test bindings
run: |
pip install --find-links dist ruststack-py
python -c "import ruststack_py; print('Python bindings imported successfully!')"