Skip to content

Commit 13c6abe

Browse files
committed
update ci
1 parent 1ee21b7 commit 13c6abe

File tree

5 files changed

+517
-82
lines changed

5 files changed

+517
-82
lines changed

.github/workflows/ci.yml

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
name: MinIO Rust Library CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
env:
10+
RUST_LOG: debug
11+
CARGO_TERM_COLOR: always
12+
13+
jobs:
14+
# Run once - same code for both variants
15+
check-format:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Check format
20+
run: |
21+
cargo fmt --all -- --check
22+
23+
# Run once - same code for both variants
24+
clippy:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: clippy
29+
run: cargo clippy --all-targets --all-features --workspace -- -D warnings
30+
31+
# Run once - same code for both variants
32+
build:
33+
runs-on: ubuntu-latest
34+
timeout-minutes: 5
35+
steps:
36+
- uses: actions/checkout@v4
37+
- name: Build
38+
run: |
39+
cargo --version
40+
cargo build --bins --examples --tests --benches --verbose
41+
42+
# Test against AIStor MinIO
43+
test-aistor-multi-thread:
44+
runs-on: ubuntu-latest
45+
needs: [check-format, clippy, build]
46+
steps:
47+
- uses: actions/checkout@v4
48+
- name: Validate AIStor license secret
49+
run: |
50+
if [ -z "${{ secrets.AISTOR_LICENSE }}" ]; then
51+
echo "❌ ERROR: AISTOR_LICENSE secret is not set or is empty"
52+
echo "Please configure the AISTOR_LICENSE secret in GitHub repository settings:"
53+
echo " Settings -> Secrets and variables -> Actions -> New repository secret"
54+
exit 1
55+
fi
56+
echo "✅ AISTOR_LICENSE secret is configured"
57+
- name: Set AIStor license
58+
run: |
59+
echo "MINIO_LICENSE=${{ secrets.AISTOR_LICENSE }}" >> $GITHUB_ENV
60+
- name: Start AIStor MinIO server
61+
env:
62+
MINIO_CI_CD: true
63+
MINIO_ROOT_USER: minioadmin # TODO: Change to ${{ secrets.AISTOR_USER }} when secret is set
64+
MINIO_ROOT_PASSWORD: minioadmin # TODO: Change to ${{ secrets.AISTOR_PASSWORD }} when secret is set
65+
MINIO_NOTIFY_WEBHOOK_ENABLE_miniojavatest: on
66+
MINIO_NOTIFY_WEBHOOK_ENDPOINT_miniojavatest: http://example.org/
67+
run: |
68+
wget --quiet https://dl.minio.io/aistor/minio/release/linux-amd64/minio
69+
chmod +x minio
70+
echo "AIStor MinIO Server Version:"
71+
./minio --version
72+
mkdir -p /tmp/certs
73+
cp ./tests/public.crt ./tests/private.key /tmp/certs/
74+
75+
# Start server and redirect output to log file
76+
./minio server /tmp/test-xl/{1...4}/ --certs-dir /tmp/certs/ > /tmp/minio.log 2>&1 &
77+
MINIO_PID=$!
78+
echo "MinIO started with PID: $MINIO_PID"
79+
80+
# Wait for server to start
81+
sleep 5
82+
83+
# Check if process is still running
84+
if ! ps -p $MINIO_PID > /dev/null; then
85+
echo "❌ MinIO server process died"
86+
echo "=== MinIO Server Log ==="
87+
cat /tmp/minio.log
88+
exit 1
89+
fi
90+
91+
# Check for FATAL errors in log
92+
if grep -q "FATAL" /tmp/minio.log; then
93+
echo "❌ MinIO server encountered FATAL error"
94+
echo "=== MinIO Server Log ==="
95+
cat /tmp/minio.log
96+
exit 1
97+
fi
98+
99+
# Additional wait for server to be fully ready
100+
sleep 5
101+
102+
# Final check
103+
if ! ps -p $MINIO_PID > /dev/null; then
104+
echo "❌ MinIO server process died during startup"
105+
echo "=== MinIO Server Log ==="
106+
cat /tmp/minio.log
107+
exit 1
108+
fi
109+
110+
echo "✅ MinIO server started successfully"
111+
echo "=== MinIO Server Log (startup) ==="
112+
head -20 /tmp/minio.log
113+
- name: Run tests (multi-thread)
114+
run: |
115+
export SERVER_ENDPOINT=localhost:9000
116+
export ACCESS_KEY=minioadmin # TODO: Change to ${{ secrets.AISTOR_USER }} when secret is set
117+
export SECRET_KEY=minioadmin # TODO: Change to ${{ secrets.AISTOR_PASSWORD }} when secret is set
118+
export ENABLE_HTTPS=1
119+
export MINIO_SSL_CERT_FILE=./tests/public.crt
120+
MINIO_TEST_TOKIO_RUNTIME_FLAVOR="multi_thread" cargo test -- --nocapture
121+
122+
test-aistor-current-thread:
123+
if: false # Temporarily disabled
124+
runs-on: ubuntu-latest
125+
needs: [check-format, clippy, build]
126+
steps:
127+
- uses: actions/checkout@v4
128+
- name: Validate AIStor license secret
129+
run: |
130+
if [ -z "${{ secrets.AISTOR_LICENSE }}" ]; then
131+
echo "❌ ERROR: AISTOR_LICENSE secret is not set or is empty"
132+
echo "Please configure the AISTOR_LICENSE secret in GitHub repository settings:"
133+
echo " Settings -> Secrets and variables -> Actions -> New repository secret"
134+
exit 1
135+
fi
136+
echo "✅ AISTOR_LICENSE secret is configured"
137+
- name: Set AIStor license
138+
run: |
139+
echo "MINIO_LICENSE=${{ secrets.AISTOR_LICENSE }}" >> $GITHUB_ENV
140+
- name: Start AIStor MinIO server
141+
env:
142+
MINIO_CI_CD: true
143+
MINIO_ROOT_USER: minioadmin # TODO: Change to ${{ secrets.AISTOR_USER }} when secret is set
144+
MINIO_ROOT_PASSWORD: minioadmin # TODO: Change to ${{ secrets.AISTOR_PASSWORD }} when secret is set
145+
MINIO_NOTIFY_WEBHOOK_ENABLE_miniojavatest: on
146+
MINIO_NOTIFY_WEBHOOK_ENDPOINT_miniojavatest: http://example.org/
147+
run: |
148+
wget --quiet https://dl.minio.io/aistor/minio/release/linux-amd64/minio
149+
chmod +x minio
150+
echo "AIStor MinIO Server Version:"
151+
./minio --version
152+
mkdir -p /tmp/certs
153+
cp ./tests/public.crt ./tests/private.key /tmp/certs/
154+
155+
# Start server and redirect output to log file
156+
./minio server /tmp/test-xl/{1...4}/ --certs-dir /tmp/certs/ > /tmp/minio.log 2>&1 &
157+
MINIO_PID=$!
158+
echo "MinIO started with PID: $MINIO_PID"
159+
160+
# Wait for server to start
161+
sleep 5
162+
163+
# Check if process is still running
164+
if ! ps -p $MINIO_PID > /dev/null; then
165+
echo "❌ MinIO server process died"
166+
echo "=== MinIO Server Log ==="
167+
cat /tmp/minio.log
168+
exit 1
169+
fi
170+
171+
# Check for FATAL errors in log
172+
if grep -q "FATAL" /tmp/minio.log; then
173+
echo "❌ MinIO server encountered FATAL error"
174+
echo "=== MinIO Server Log ==="
175+
cat /tmp/minio.log
176+
exit 1
177+
fi
178+
179+
# Additional wait for server to be fully ready
180+
sleep 5
181+
182+
# Final check
183+
if ! ps -p $MINIO_PID > /dev/null; then
184+
echo "❌ MinIO server process died during startup"
185+
echo "=== MinIO Server Log ==="
186+
cat /tmp/minio.log
187+
exit 1
188+
fi
189+
190+
echo "✅ MinIO server started successfully"
191+
echo "=== MinIO Server Log (startup) ==="
192+
head -20 /tmp/minio.log
193+
- name: Run tests (current-thread)
194+
run: |
195+
export SERVER_ENDPOINT=localhost:9000
196+
export ACCESS_KEY=minioadmin # TODO: Change to ${{ secrets.AISTOR_USER }} when secret is set
197+
export SECRET_KEY=minioadmin # TODO: Change to ${{ secrets.AISTOR_PASSWORD }} when secret is set
198+
export ENABLE_HTTPS=1
199+
export MINIO_SSL_CERT_FILE=./tests/public.crt
200+
MINIO_TEST_TOKIO_RUNTIME_FLAVOR="current_thread" cargo test -- --nocapture
201+
202+
# Test against OSS MinIO
203+
test-oss-multi-thread:
204+
if: false # Temporarily disabled
205+
runs-on: ubuntu-latest
206+
needs: [check-format, clippy, build]
207+
steps:
208+
- uses: actions/checkout@v4
209+
- name: Start OSS MinIO server
210+
run: |
211+
wget --quiet https://dl.min.io/server/minio/release/linux-amd64/minio
212+
chmod +x minio
213+
echo "OSS MinIO Server Version:"
214+
./minio --version
215+
mkdir -p /tmp/certs
216+
cp ./tests/public.crt ./tests/private.key /tmp/certs/
217+
MINIO_CI_CD=true \
218+
MINIO_NOTIFY_WEBHOOK_ENABLE_miniojavatest=on \
219+
MINIO_NOTIFY_WEBHOOK_ENDPOINT_miniojavatest=http://example.org/ \
220+
./minio server /tmp/test-xl/{1...4}/ --certs-dir /tmp/certs/ &
221+
sleep 10
222+
- name: Run tests (multi-thread)
223+
run: |
224+
export SERVER_ENDPOINT=localhost:9000
225+
export ACCESS_KEY=minioadmin
226+
export SECRET_KEY=minioadmin
227+
export ENABLE_HTTPS=1
228+
export MINIO_SSL_CERT_FILE=./tests/public.crt
229+
MINIO_TEST_TOKIO_RUNTIME_FLAVOR="multi_thread" cargo test -- --nocapture

.github/workflows/deployer.yml

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: Build Container
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
# This ensures that previous jobs for the PR are canceled when the PR is
8+
# updated.
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.head_ref }}
11+
cancel-in-progress: true
12+
13+
env:
14+
REGISTRY_IMAGE: registry.min.dev/aistor/minio-rs
15+
16+
jobs:
17+
prep:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Prepare
23+
id: prep
24+
run: |
25+
TIMESTAMP=$(date '+%Y-%m-%dT%H-%M-%SZ')
26+
SHORT_SHA=${GITHUB_SHA:0:7}
27+
echo "tag=RELEASE.${TIMESTAMP}" >> $GITHUB_OUTPUT
28+
echo "tagged_image=RELEASE.${TIMESTAMP}" >> $GITHUB_OUTPUT
29+
echo "latest_image=edge" >> $GITHUB_OUTPUT
30+
echo "short_sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
31+
outputs:
32+
tag: ${{ steps.prep.outputs.tag }}
33+
tagged_image: ${{ steps.prep.outputs.tagged_image }}
34+
latest_image: ${{ steps.prep.outputs.latest_image }}
35+
short_sha: ${{ steps.prep.outputs.short_sha }}
36+
37+
build:
38+
runs-on: ubuntu-latest
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
platform:
43+
- linux/amd64
44+
- linux/arm64
45+
needs: prep
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
50+
- name: Docker meta
51+
id: meta
52+
uses: docker/metadata-action@v5
53+
with:
54+
images: ${{ env.REGISTRY_IMAGE }}
55+
56+
- name: Set up QEMU
57+
uses: docker/setup-qemu-action@v3
58+
59+
- name: Set up Docker Buildx
60+
uses: docker/setup-buildx-action@v3
61+
62+
- name: Login to Registry
63+
uses: docker/login-action@v3
64+
with:
65+
registry: ${{ secrets.REGISTRY_URL }}
66+
username: ${{ secrets.REGISTRY_USERNAME }}
67+
password: ${{ secrets.REGISTRY_PASSWORD }}
68+
69+
- name: Build and push by digest
70+
id: build
71+
uses: docker/build-push-action@v5
72+
with:
73+
context: .
74+
file: ./Dockerfile
75+
build-args: |
76+
RELEASE=${{ needs.prep.outputs.tag }}
77+
platforms: ${{ matrix.platform }}
78+
labels: ${{ steps.meta.outputs.labels }}
79+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
80+
cache-from: type=gha
81+
cache-to: type=gha,mode=max
82+
83+
- name: Export digest
84+
run: |
85+
mkdir -p /tmp/digests
86+
digest="${{ steps.build.outputs.digest }}"
87+
touch "/tmp/digests/${digest#sha256:}"
88+
89+
- name: Upload digest
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: digests-${{ strategy.job-index }}
93+
path: /tmp/digests/*
94+
if-no-files-found: error
95+
retention-days: 1
96+
97+
merge:
98+
runs-on: ubuntu-latest
99+
needs:
100+
- prep
101+
- build
102+
steps:
103+
- name: Download digests
104+
uses: actions/download-artifact@v4
105+
with:
106+
pattern: digests-*
107+
merge-multiple: true
108+
path: /tmp/digests
109+
110+
- name: Set up Docker Buildx
111+
uses: docker/setup-buildx-action@v3
112+
113+
- name: Docker meta
114+
id: meta
115+
uses: docker/metadata-action@v5
116+
with:
117+
images: ${{ env.REGISTRY_IMAGE }}
118+
tags: |
119+
type=raw,value=${{ needs.prep.outputs.tagged_image }}
120+
type=raw,value=${{ needs.prep.outputs.short_sha }}
121+
type=raw,value=edge
122+
type=raw,value=latest
123+
124+
- name: Login to Registry
125+
uses: docker/login-action@v3
126+
with:
127+
registry: ${{ secrets.REGISTRY_URL }}
128+
username: ${{ secrets.REGISTRY_USERNAME }}
129+
password: ${{ secrets.REGISTRY_PASSWORD }}
130+
131+
- name: Create manifest list and push
132+
working-directory: /tmp/digests
133+
run: |
134+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
135+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
136+
137+
- name: Inspect image
138+
run: |
139+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ needs.prep.outputs.tagged_image }}
140+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ needs.prep.outputs.short_sha }}
141+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:edge
142+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest

0 commit comments

Comments
 (0)