diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index f74f07ecb..f185d3343 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,11 +1,24 @@ FROM ubuntu:22.04 +ARG ARCH +ARG GO_VERSION=1.23.10 + WORKDIR /workspaces -RUN apt-get update -y \ - && apt-get install -y vim git wget build-essential cmake net-tools tcpdump +RUN apt-get update -y && \ + apt-get install -y --no-install-recommends \ + vim \ + git \ + wget \ + build-essential \ + cmake \ + net-tools \ + tcpdump \ + && rm -rf /var/lib/apt/lists/* -RUN apt-get install -y libibverbs-dev \ +RUN apt-get update -y && \ + apt-get install -y --no-install-recommends \ + libibverbs-dev \ libunwind-dev \ libgoogle-glog-dev \ libgtest-dev \ @@ -20,10 +33,18 @@ RUN apt-get install -y libibverbs-dev \ protobuf-compiler-grpc \ pybind11-dev \ libcurl4-openssl-dev \ - libhiredis-dev + libhiredis-dev \ + && rm -rf /var/lib/apt/lists/* -RUN wget https://go.dev/dl/go1.22.12.linux-amd64.tar.gz \ - && tar -C /usr/local -xzf go1.22.12.linux-amd64.tar.gz +RUN ARCH=$(uname -m) && \ + case $ARCH in \ + x86_64) GO_ARCH="amd64";; \ + aarch64) GO_ARCH="arm64";; \ + *) echo "Unsupported architecture: $ARCH" >&2; exit 1;; \ + esac && \ + wget "https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz" \ + && tar -C /usr/local -xzf "go${GO_VERSION}.linux-${GO_ARCH}.tar.gz" \ + && rm "go${GO_VERSION}.linux-${GO_ARCH}.tar.gz" RUN git clone https://github.com/alibaba/yalantinglibs.git \ && cd yalantinglibs \ @@ -31,9 +52,11 @@ RUN git clone https://github.com/alibaba/yalantinglibs.git \ && cd build \ && cmake .. -DBUILD_EXAMPLES=OFF -DBUILD_BENCHMARK=OFF -DBUILD_UNIT_TESTS=OFF \ && cmake --build . -j$(nproc) \ - && cmake --install . + && cmake --install . \ + && cd /workspaces \ + && rm -rf yalantinglibs ENV GOPROXY='https://goproxy.cn' ENV PATH=/usr/local/go/bin:$PATH -CMD ["bash"] +CMD ["bash"] \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad3b17303..be22d5b3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,10 +8,11 @@ on: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.10', '3.12'] + python-version: ['3.10', '3.11', '3.12', '3.13'] + os: [ubuntu-22.04, ubuntu-22.04-arm] env: SCCACHE_GHA_ENABLED: "true" @@ -25,9 +26,21 @@ jobs: - name: Install and start etcd run: | - wget https://github.com/etcd-io/etcd/releases/download/v3.6.1/etcd-v3.6.1-linux-amd64.tar.gz - tar xzf etcd-v3.6.1-linux-amd64.tar.gz - sudo mv etcd-v3.6.1-linux-amd64/etcd* /usr/local/bin/ + ARCH=$(uname -m) + ETCD_ARCH="" + if [ "$ARCH" = "x86_64" ]; then + ETCD_ARCH="amd64" + elif [ "$ARCH" = "aarch64" ]; then + ETCD_ARCH="arm64" + else + echo "Unsupported architecture: $ARCH for etcd" + exit 1 + fi + + ETCD_TAR="etcd-v3.6.1-linux-${ETCD_ARCH}.tar.gz" + wget https://github.com/etcd-io/etcd/releases/download/v3.6.1/${ETCD_TAR} + tar xzf ${ETCD_TAR} + sudo mv etcd-v3.6.1-linux-${ETCD_ARCH}/etcd* /usr/local/bin/ etcd --advertise-client-urls http://127.0.0.1:2379 --listen-client-urls http://127.0.0.1:2379 & sleep 3 # Give etcd time to start etcdctl --endpoints=http://127.0.0.1:2379 endpoint health @@ -40,7 +53,7 @@ jobs: sudo rm -rf /opt/hostedtoolcache/CodeQL - name: Install CUDA Toolkit - uses: Jimver/cuda-toolkit@v0.2.24 + uses: Jimver/cuda-toolkit@v0.2.25 with: cuda: '12.8.1' linux-local-args: '["--toolkit"]' @@ -122,13 +135,23 @@ jobs: PYTHON_VERSION=${{ matrix.python-version }} OUTPUT_DIR=dist-py${{ steps.generate_tag_build.outputs.python_version_tag }} ./scripts/build_wheel.sh shell: bash + - name: Upload Python wheel artifact + uses: actions/upload-artifact@v4 + with: + name: mooncake-wheel-py${{ steps.generate_tag_build.outputs.python_version_tag }}-${{ matrix.os }} # Differentiate by OS + path: mooncake-wheel/dist-py${{ steps.generate_tag_build.outputs.python_version_tag }}/*.whl + test-wheel-ubuntu: - needs: build-flags + # This job now depends on a new job name below or on `build` if `build-flags` is removed/renamed + # Assuming `build` is the primary build job, and its artifacts will be used. + # If `build-flags` is intended to be the source for these artifacts, its name should be fixed. + # For this update, I'm assuming it should depend on 'build'. + needs: build # Changed from 'build-flags' to 'build' as it's the primary build job. strategy: matrix: - ubuntu-version: [ubuntu-22.04, ubuntu-24.04] - python-version: ['3.10', '3.12'] - runs-on: ${{ matrix.ubuntu-version }} + os: [ubuntu-22.04, ubuntu-24.04, ubuntu-22.04-arm] + python-version: ['3.10', '3.11', '3.12', '3.13'] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -146,7 +169,8 @@ jobs: - name: Download wheel artifact uses: actions/download-artifact@v4 with: - name: mooncake-wheel-ubuntu-py${{ steps.generate_tag_test.outputs.python_version_tag }} + # Changed artifact name to match the upload name from the 'build' job + name: mooncake-wheel-py${{ steps.generate_tag_test.outputs.python_version_tag }}-${{ matrix.os }} path: mooncake-wheel/dist - name: Verify wheel file exists @@ -177,10 +201,11 @@ jobs: shell: bash build-flags: - runs-on: ubuntu-22.04 + runs-on: ${{ matrix.os }} strategy: matrix: - python-version: ['3.10', '3.12'] + python-version: ['3.10', '3.11', '3.12', '3.13'] + os: [ubuntu-22.04] env: SCCACHE_GHA_ENABLED: "true" @@ -199,7 +224,7 @@ jobs: sudo rm -rf /opt/hostedtoolcache/CodeQL - name: Install CUDA Toolkit - uses: Jimver/cuda-toolkit@v0.2.24 + uses: Jimver/cuda-toolkit@v0.2.25 with: cuda: '12.8.1' linux-local-args: '["--toolkit"]' @@ -224,6 +249,8 @@ jobs: run: | sudo apt update -y sudo bash -x dependencies.sh -y + echo "/usr/local/go/bin" >> $GITHUB_PATH + export PATH="/usr/local/go/bin:$PATH" shell: bash - name: Build transfer engine only @@ -245,7 +272,7 @@ jobs: cmake .. -DUSE_ETCD=ON -DUSE_REDIS=ON -DUSE_HTTP=ON -DWITH_STORE=ON -DWITH_P2P_STORE=ON -DWITH_METRICS=ON -DBUILD_UNIT_TESTS=ON -DBUILD_EXAMPLES=ON -DENABLE_SCCACHE=ON -DUSE_CUDA=OFF -DUSE_MNNVL=OFF -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/cuda/lib64/stubs" shell: bash # TODO: lack USE_NVMEOF,USE_CUDA,USE_MNNVL - + - name: Build project with all settings are ON run: | cd build @@ -302,24 +329,33 @@ jobs: - name: Upload Python wheel artifact uses: actions/upload-artifact@v4 with: - name: mooncake-wheel-ubuntu-py${{ steps.generate_tag_flags.outputs.python_version_tag }} + name: mooncake-wheel-ubuntu-py${{ steps.generate_tag_flags.outputs.python_version_tag }}-${{ matrix.os }} # Differentiate by OS path: mooncake-wheel/dist-py${{ steps.generate_tag_flags.outputs.python_version_tag }}/*.whl build-docker: - name: Builcd Docker Image - runs-on: ubuntu-22.04 + name: Build Docker Image + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04] # not exists image from Alibaba Cloud AC2 to build for arm64 steps: - uses: actions/checkout@v4 - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - + - name: Build Docker image + # For multi-arch docker builds, buildx is recommended to target multiple platforms + # For simplicity, keeping the direct build command which will build for the runner's architecture. + # If cross-architecture images are needed, "docker buildx build --platform linux/amd64,linux/arm64 ..." would be used. run: docker build -t mooncake-app . spell-check: name: Spell Check with Typos - runs-on: ubuntu-22.04 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-22.04, ubuntu-22.04-arm] # Added ubuntu-22.04-arm to the OS matrix steps: - name: Checkout Actions Repository uses: actions/checkout@v4 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ccd70ea62..62921dcec 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -9,12 +9,13 @@ env: SCCACHE_GHA_ENABLED: "true" jobs: build: - runs-on: ubuntu-22.04 + runs-on: ${{ matrix.os }} # Changed to use a matrix for OS permissions: contents: write strategy: matrix: python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + os: [ubuntu-22.04, ubuntu-22.04-arm] steps: - name: Checkout source uses: actions/checkout@v4 @@ -24,6 +25,14 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: 'mooncake-common/etcd/go.mod' + check-latest: true + + - run: go version # sanity-check + - name: Free up disk space run: | sudo rm -rf /usr/share/dotnet @@ -31,7 +40,7 @@ jobs: sudo rm -rf /opt/hostedtoolcache/CodeQL - name: Install CUDA Toolkit - uses: Jimver/cuda-toolkit@v0.2.24 + uses: Jimver/cuda-toolkit@v0.2.25 with: cuda: '12.8.1' linux-local-args: '["--toolkit"]' @@ -92,7 +101,7 @@ jobs: - name: Upload Python wheel artifact uses: actions/upload-artifact@v4 with: - name: mooncake-wheel-py${{ steps.generate_tag_release.outputs.python_version_tag }} + name: mooncake-wheel-py${{ steps.generate_tag_release.outputs.python_version_tag }}-${{ matrix.os }} path: mooncake-wheel/dist-py${{ steps.generate_tag_release.outputs.python_version_tag }}/*.whl publish-release: diff --git a/dependencies.sh b/dependencies.sh index 1fae4b6e9..824a8b542 100755 --- a/dependencies.sh +++ b/dependencies.sh @@ -23,7 +23,7 @@ NC="\033[0m" # No Color # Configuration REPO_ROOT=`pwd` GITHUB_PROXY=${GITHUB_PROXY:-"https://github.com"} -GOVER=1.23.8 +GOVER=1.24.4 # Function to print section headers print_section() { @@ -252,6 +252,7 @@ fi if ! grep -q "export PATH=\$PATH:/usr/local/go/bin" ~/.bashrc; then echo -e "${YELLOW}Adding Go to your PATH in ~/.bashrc${NC}" echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc + echo 'export GOTOOLCHAIN=local' >> ~/.bashrc echo -e "${YELLOW}Please run 'source ~/.bashrc' or start a new terminal to use Go${NC}" fi diff --git a/mooncake-common/etcd/go.mod b/mooncake-common/etcd/go.mod index d795f0383..bb8e8025a 100644 --- a/mooncake-common/etcd/go.mod +++ b/mooncake-common/etcd/go.mod @@ -1,8 +1,8 @@ module github.com/kvcache-ai/Mooncake/mooncake-common/etcd -go 1.23.0 +go 1.23.10 -toolchain go1.23.7 +toolchain go1.23.10 require go.etcd.io/etcd/client/v3 v3.5.21 diff --git a/mooncake-p2p-store/src/p2pstore/go.mod b/mooncake-p2p-store/src/p2pstore/go.mod index 8d29b5ab8..ab7ddb0be 100644 --- a/mooncake-p2p-store/src/p2pstore/go.mod +++ b/mooncake-p2p-store/src/p2pstore/go.mod @@ -1,6 +1,6 @@ module github.com/kvcache-ai/Mooncake/mooncake-p2p-store/src/p2pstore -go 1.23.0 +go 1.23 toolchain go1.24.1