|
| 1 | +name: 'CI Test on ASCEND Platform' |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main" ] |
| 8 | + types: [opened, synchronize, reopened, labeled] |
| 9 | + |
| 10 | +jobs: |
| 11 | + build-and-test: |
| 12 | + if: github.repository == 'kvcache-ai/Mooncake' |
| 13 | + runs-on: self-hosted |
| 14 | + |
| 15 | + container: |
| 16 | + image: localhost:5000/mooncake-hixl-ci:v5 |
| 17 | + options: --privileged --user 0:0 --device /dev/davinci0 --device /dev/davinci1 --device /dev/davinci2 --device /dev/davinci3 |
| 18 | + --device /dev/davinci4 --device /dev/davinci5 --device /dev/davinci6 --device /dev/davinci7 |
| 19 | + --device /dev/davinci_manager --device /dev/devmm_svm --device /dev/hisi_hdc --ulimit nproc=65535:65535 |
| 20 | + env: |
| 21 | + GITHUB_ACTIONS: "true" |
| 22 | + LD_PRELOAD: "/usr/lib64/libjemalloc.so.2:" |
| 23 | + volumes: |
| 24 | + - /usr/local/dcmi:/usr/local/dcmi |
| 25 | + - /usr/local/Ascend/driver/:/usr/local/Ascend/driver/ |
| 26 | + - /etc/ascend_install.info:/etc/ascend_install.info |
| 27 | + - /etc/hccn.conf:/etc/hccn.conf |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Checkout code |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + fetch-depth: 1 |
| 34 | + persist-credentials: false |
| 35 | + |
| 36 | + - name: Configure CMake |
| 37 | + shell: bash |
| 38 | + run: | |
| 39 | + source /usr/local/Ascend/cann-9.0.0/set_env.sh |
| 40 | + pwd |
| 41 | + if ! git submodule update --init --recursive; then |
| 42 | + if [ ! -d "extern/pybind11" ] || [ -z "$(ls -A 'extern/pybind11' 2>/dev/null)" ]; then |
| 43 | + echo "git submodule update failed, try to cp pybind11..." |
| 44 | + if [ -d "../pybind11" ]; then |
| 45 | + cp -r ../pybind11 extern/ |
| 46 | + else |
| 47 | + echo "Error: ../pybind11 does not exist. Cannot copy pybind11." |
| 48 | + exit 1 |
| 49 | + fi |
| 50 | + else |
| 51 | + echo "Detected that extern/pybind11 already exists, continuing execution...." |
| 52 | + fi |
| 53 | + fi |
| 54 | + echo "Configuring CMake..." |
| 55 | + rm -rf build |
| 56 | + mkdir -p build |
| 57 | + cd build |
| 58 | +
|
| 59 | + cmake .. \ |
| 60 | + -DUSE_ASCEND_DIRECT=ON \ |
| 61 | + -DBUILD_EXAMPLES=OFF \ |
| 62 | + -DBUILD_UNIT_TESTS=OFF |
| 63 | +
|
| 64 | + - name: Build |
| 65 | + shell: bash |
| 66 | + run: | |
| 67 | + source /usr/local/Ascend/cann-9.0.0/set_env.sh |
| 68 | + echo "Building..." |
| 69 | + cd build |
| 70 | + make -j8 |
| 71 | + make install -j8 |
| 72 | + echo "Mooncake installed successfully." |
| 73 | +
|
| 74 | + - name: Run Hixl Mooncake Store Test |
| 75 | + shell: bash |
| 76 | + run: | |
| 77 | + source /usr/local/Ascend/cann-9.0.0/set_env.sh |
| 78 | + set -e |
| 79 | + export ASCEND_PROCESS_LOG_PATH=/tmp/hixl-test-log/ |
| 80 | + export ASCEND_GLOBAL_LOG_LEVEL=3 |
| 81 | + echo "=== Cloning Hixl repository ===" |
| 82 | + cd .. |
| 83 | + rm -rf hixl |
| 84 | + git clone https://gitcode.com/cann/hixl.git |
| 85 | + cd hixl/examples/third_parties/mooncake_store/python/ |
| 86 | +
|
| 87 | + export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH} |
| 88 | + echo "=== Starting Mooncake Master ===" |
| 89 | +
|
| 90 | + # Find mooncake_master binary |
| 91 | + MOONCAKE_MASTER=$(find /usr/local/bin /usr/bin -name "mooncake_master" -type f 2>/dev/null | head -1) |
| 92 | + if [ -z "$MOONCAKE_MASTER" ]; then |
| 93 | + # Try finding in build directory |
| 94 | + MOONCAKE_MASTER=$(find $GITHUB_WORKSPACE/build -name "mooncake_master" -type f 2>/dev/null | head -1) |
| 95 | + fi |
| 96 | +
|
| 97 | + if [ -z "$MOONCAKE_MASTER" ]; then |
| 98 | + echo "Error: mooncake_master binary not found" |
| 99 | + exit 1 |
| 100 | + fi |
| 101 | +
|
| 102 | + echo "Found mooncake_master at: $MOONCAKE_MASTER" |
| 103 | +
|
| 104 | + # Start Mooncake master in background |
| 105 | + $MOONCAKE_MASTER \ |
| 106 | + --enable_http_metadata_server=true \ |
| 107 | + --http_metadata_server_host=0.0.0.0 \ |
| 108 | + --http_metadata_server_port=8080 \ |
| 109 | + > /tmp/mooncake_master.log 2>&1 & |
| 110 | + MASTER_PID=$! |
| 111 | + echo "Mooncake Master started with PID: $MASTER_PID" |
| 112 | +
|
| 113 | + # Wait for master to be ready |
| 114 | + echo "Waiting for Mooncake Master to initialize..." |
| 115 | + sleep 5 |
| 116 | +
|
| 117 | + # Check if master is running |
| 118 | + if ! kill -0 $MASTER_PID 2>/dev/null; then |
| 119 | + echo "Error: Mooncake Master failed to start" |
| 120 | + cat /tmp/mooncake_master.log |
| 121 | + exit 1 |
| 122 | + fi |
| 123 | +
|
| 124 | + echo "Mooncake Master is running" |
| 125 | + echo "=== Running Hixl Mooncake Store Tests ===" |
| 126 | + # List of test cases to run |
| 127 | + TEST_CASES=( |
| 128 | + "batch_put_get_sample.py" |
| 129 | + "batch_put_get_multi_buffers_sample.py" |
| 130 | + ) |
| 131 | +
|
| 132 | + # Track test results |
| 133 | + FAILED_TESTS=() |
| 134 | + PASSED_TESTS=() |
| 135 | +
|
| 136 | + # Run each test case |
| 137 | + export ASCEND_BUFFER_POOL=4:8 |
| 138 | + for test_case in "${TEST_CASES[@]}"; do |
| 139 | + echo "" |
| 140 | + echo "=========================================" |
| 141 | + echo "Running test: $test_case" |
| 142 | + echo "=========================================" |
| 143 | +
|
| 144 | + if [ ! -f "$test_case" ]; then |
| 145 | + echo "Warning: Test file $test_case not found, skipping..." |
| 146 | + continue |
| 147 | + fi |
| 148 | + # Run the test with run.sh |
| 149 | + python3 $test_case \ |
| 150 | + --device_id=0 \ |
| 151 | + --rank=0 \ |
| 152 | + 2>&1 | tee "/tmp/hixl_test_${test_case%.py}.log" |
| 153 | +
|
| 154 | + TEST_RESULT=${PIPESTATUS[0]} |
| 155 | +
|
| 156 | + if [ $TEST_RESULT -eq 0 ]; then |
| 157 | + echo "✓ $test_case PASSED" |
| 158 | + PASSED_TESTS+=("$test_case") |
| 159 | + else |
| 160 | + echo "✗ $test_case FAILED with exit code: $TEST_RESULT" |
| 161 | + FAILED_TESTS+=("$test_case") |
| 162 | + fi |
| 163 | + done |
| 164 | +
|
| 165 | + echo "" |
| 166 | + echo "=========================================" |
| 167 | + echo "Test Summary" |
| 168 | + echo "=========================================" |
| 169 | + echo "Passed tests: ${#PASSED_TESTS[@]}" |
| 170 | + for test in "${PASSED_TESTS[@]}"; do |
| 171 | + echo " ✓ $test" |
| 172 | + done |
| 173 | +
|
| 174 | + echo "" |
| 175 | + echo "Failed tests: ${#FAILED_TESTS[@]}" |
| 176 | + for test in "${FAILED_TESTS[@]}"; do |
| 177 | + echo " ✗ $test" |
| 178 | + done |
| 179 | +
|
| 180 | + # Cleanup: Stop Mooncake Master |
| 181 | + echo "" |
| 182 | + echo "Stopping Mooncake Master..." |
| 183 | + kill $MASTER_PID 2>/dev/null || true |
| 184 | + wait $MASTER_PID 2>/dev/null || true |
| 185 | +
|
| 186 | + # Exit with error if any tests failed |
| 187 | + if [ ${#FAILED_TESTS[@]} -gt 0 ]; then |
| 188 | + echo "" |
| 189 | + echo "Some tests failed!" |
| 190 | + exit 1 |
| 191 | + fi |
| 192 | +
|
| 193 | + echo "" |
| 194 | + echo "All Hixl Mooncake Store tests completed successfully!" |
| 195 | + |
| 196 | +
|
| 197 | + - name: Test Summary |
| 198 | + if: always() |
| 199 | + shell: bash |
| 200 | + run: | |
| 201 | + echo "CI Test completed" |
| 202 | +
|
| 203 | + - name: Upload Test Logs |
| 204 | + if: always() |
| 205 | + uses: actions/upload-artifact@v4 |
| 206 | + with: |
| 207 | + name: test-logs-${{ github.run_number }} |
| 208 | + path: | |
| 209 | + /tmp/hixl-test-log/* |
| 210 | + retention-days: 30 |
| 211 | + if-no-files-found: warn |
0 commit comments