Skip to content

Commit 534a46c

Browse files
committed
ci: add S3 integration test job with MinIO and path filtering
1 parent 126ad26 commit 534a46c

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/rust.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,69 @@ jobs:
107107
env:
108108
RUSTDOCFLAGS: "-D warnings"
109109
run: cargo doc --no-deps --workspace
110+
111+
# S3 integration tests using MinIO (only when S3-related files change)
112+
test-s3-integration:
113+
runs-on: ubuntu-latest
114+
steps:
115+
- uses: actions/checkout@v6
116+
with:
117+
fetch-depth: 0
118+
119+
- name: Check for S3-related changes
120+
id: changes
121+
run: |
122+
BASE_SHA=${{ github.event.pull_request.base.sha || github.event.before || 'HEAD~1' }}
123+
if git diff --name-only "$BASE_SHA" HEAD | grep -qE \
124+
'^spatialbench-cli/src/(s3_writer|runner|output_plan|main)\.rs$|^spatialbench-cli/tests/s3_integration\.rs$|^\.github/workflows/rust\.yml$'; then
125+
echo "s3=true" >> "$GITHUB_OUTPUT"
126+
else
127+
echo "s3=false" >> "$GITHUB_OUTPUT"
128+
fi
129+
130+
- name: Start MinIO
131+
if: steps.changes.outputs.s3 == 'true'
132+
run: |
133+
docker run -d --name minio \
134+
-p 9000:9000 \
135+
-e MINIO_ROOT_USER=minioadmin \
136+
-e MINIO_ROOT_PASSWORD=minioadmin \
137+
minio/minio:latest server /data
138+
# Wait for MinIO to be ready
139+
for i in $(seq 1 30); do
140+
if curl -sf http://localhost:9000/minio/health/live; then
141+
echo "MinIO is ready"
142+
exit 0
143+
fi
144+
sleep 1
145+
done
146+
echo "MinIO failed to start"
147+
docker logs minio
148+
exit 1
149+
150+
- name: Create MinIO test bucket
151+
if: steps.changes.outputs.s3 == 'true'
152+
run: |
153+
curl -sL https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc
154+
chmod +x /usr/local/bin/mc
155+
mc alias set local http://localhost:9000 minioadmin minioadmin
156+
mc mb local/spatialbench-test
157+
158+
- uses: dtolnay/rust-toolchain@stable
159+
if: steps.changes.outputs.s3 == 'true'
160+
161+
- uses: Swatinem/rust-cache@v2
162+
if: steps.changes.outputs.s3 == 'true'
163+
with:
164+
prefix-key: "rust-test-s3-v1"
165+
166+
- name: Run S3 integration tests
167+
if: steps.changes.outputs.s3 == 'true'
168+
env:
169+
AWS_ACCESS_KEY_ID: minioadmin
170+
AWS_SECRET_ACCESS_KEY: minioadmin
171+
AWS_ENDPOINT: http://localhost:9000
172+
AWS_REGION: us-east-1
173+
AWS_ALLOW_HTTP: "true"
174+
S3_TEST_BUCKET: spatialbench-test
175+
run: cargo test -p spatialbench-cli --test s3_integration -- --ignored

0 commit comments

Comments
 (0)