Skip to content

Commit 4cb02ca

Browse files
committed
update ci
1 parent f4b4c90 commit 4cb02ca

File tree

5 files changed

+513
-82
lines changed

5 files changed

+513
-82
lines changed

.github/workflows/ci.yml

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