|
| 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 |
0 commit comments