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