diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index cc99b64d7..6632632d5 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -1,10 +1,8 @@ name: Build hanzo-node binaries - on: push: tags: - - "v[0-9]+.[0-9]+.[0-9]+" - + - v[0-9]+.[0-9]+.[0-9]+ jobs: build-binaries: name: Build binary @@ -12,155 +10,107 @@ jobs: fail-fast: false matrix: include: - # Linux - - arch: x86_64-unknown-linux-gnu - os: ubuntu-22.04 - target: x86_64-unknown-linux-gnu - - arch: aarch64-unknown-linux-gnu - os: ubuntu-22.04 - target: aarch64-unknown-linux-gnu - cross: true - # macOS - - arch: aarch64-apple-darwin - os: macos-14 - target: aarch64-apple-darwin - - arch: x86_64-apple-darwin - os: macos-14 - target: x86_64-apple-darwin - cross_mac: true - # Windows - - arch: x86_64-pc-windows-msvc - os: windows-2022 - target: x86_64-pc-windows-msvc + - arch: x86_64-unknown-linux-gnu + os: ubuntu-22.04 + target: x86_64-unknown-linux-gnu + - arch: aarch64-unknown-linux-gnu + os: ubuntu-22.04 + target: aarch64-unknown-linux-gnu + cross: true + - arch: aarch64-apple-darwin + os: macos-14 + target: aarch64-apple-darwin + - arch: x86_64-apple-darwin + os: macos-14 + target: x86_64-apple-darwin + cross_mac: true + - arch: x86_64-pc-windows-msvc + os: windows-2022 + target: x86_64-pc-windows-msvc runs-on: ${{ matrix.os }} steps: - - name: Checkout sources - uses: actions/checkout@v4 - - - name: Configure rust-lld linker for Windows - if: matrix.os == 'windows-2022' - run: | - if (-Not (Test-Path ".cargo")) { mkdir .cargo } - echo '[target.x86_64-pc-windows-msvc]' > .cargo/config.toml - echo 'linker = "rust-lld"' >> .cargo/config.toml - - - name: Install protobuf compiler (Linux) - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y protobuf-compiler - - - name: Install cross-compilation tools (Linux ARM64) - if: matrix.cross == true - run: | - sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu - rustup target add aarch64-unknown-linux-gnu - - - name: Install protobuf compiler (macOS) - if: runner.os == 'macOS' - run: brew install protobuf - - - name: Install cross-compilation target (macOS x64) - if: matrix.cross_mac == true - run: rustup target add x86_64-apple-darwin - - - name: Cache cargo assets - id: cache - uses: actions/cache@v4 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ matrix.arch }}-build-cargo-v2 - restore-keys: | - ${{ matrix.arch }}-build-cargo- - - - - name: Configure cross-compilation (Linux ARM64) - if: matrix.cross == true - run: | - mkdir -p .cargo - echo '' >> .cargo/config.toml - echo '[target.aarch64-unknown-linux-gnu]' >> .cargo/config.toml - echo 'linker = "aarch64-linux-gnu-gcc"' >> .cargo/config.toml - - - name: Build - env: - AI_MODEL_CATALOG_BUILD: 1 - run: cargo build --release --bin hanzo-node --target ${{ matrix.target }} - - - name: Move binary to expected location - shell: bash - run: | - mkdir -p target/release - if [ -f "target/${{ matrix.target }}/release/hanzo-node${{ matrix.arch == 'x86_64-pc-windows-msvc' && '.exe' || '' }}" ]; then - cp "target/${{ matrix.target }}/release/hanzo-node${{ matrix.arch == 'x86_64-pc-windows-msvc' && '.exe' || '' }}" target/release/ - fi - - - name: Prepare bundle files - env: - ZIP_FILE_NAME: ${{ github.ref_name }}.zip - EXTENSION: ${{ matrix.arch == 'x86_64-pc-windows-msvc' && '.exe' || '' }} - run: | - mkdir files-to-r2 - cp target/release/hanzo-node${{ env.EXTENSION }} files-to-r2/hanzo-node${{ env.EXTENSION }} - cp -r target/release/hanzo-tools-runner-resources files-to-r2/ - cd ./files-to-r2 - 7z a -tzip ${{ env.ZIP_FILE_NAME}} . -sdel - cp ${{ env.ZIP_FILE_NAME}} latest.zip - - - name: Upload bundle to R2 bucket - continue-on-error: true - uses: shallwefootball/s3-upload-action@master - with: - endpoint: https://94a3e3f299092abb1feda2a7481ea845.r2.cloudflarestorage.com - aws_key_id: ${{ secrets.R2_ACCESS_KEY_ID }} - aws_secret_access_key: ${{ secrets.R2_SECRET_ACCESS_KEY }} - aws_bucket: hanzoai - source_dir: files-to-r2 - destination_dir: ./hanzo-node/binaries/production/${{ matrix.arch }}/ - - - name: Upload bundle to release - uses: svenstaro/upload-release-action@v2 - env: - EXTENSION: ${{ matrix.arch == 'x86_64-pc-windows-msvc' && '.exe' || '' }} - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: files-to-r2/${{ github.ref_name }}.zip - asset_name: hanzo-node-${{ matrix.arch }}.zip - tag: ${{ github.ref }} - overwrite: true - build-docker-image: - name: Build and push Docker image to Docker Hub - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Download tools from store to pre-install folder - run: | - ./scripts/update_tools.sh - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: ./docker/Dockerfile - push: true - build-args: | - BUILD_TYPE=release - AI_MODEL_CATALOG_BUILD=1 - tags: | - hanzoai/hanzo-node:${{ github.ref_name }} - hanzoai/hanzo-node:release-latest + - name: Checkout sources + uses: actions/checkout@v4 + - name: Configure rust-lld linker for Windows + if: matrix.os == 'windows-2022' + run: | + if (-Not (Test-Path ".cargo")) { mkdir .cargo } + echo '[target.x86_64-pc-windows-msvc]' > .cargo/config.toml + echo 'linker = "rust-lld"' >> .cargo/config.toml + - name: Install protobuf compiler (Linux) + if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install -y protobuf-compiler + - name: Install cross-compilation tools (Linux ARM64) + if: matrix.cross == true + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + rustup target add aarch64-unknown-linux-gnu + - name: Install protobuf compiler (macOS) + if: runner.os == 'macOS' + run: brew install protobuf + - name: Install cross-compilation target (macOS x64) + if: matrix.cross_mac == true + run: rustup target add x86_64-apple-darwin + - name: Cache cargo assets + id: cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ matrix.arch }}-build-cargo-v2 + restore-keys: | + ${{ matrix.arch }}-build-cargo- + - name: Configure cross-compilation (Linux ARM64) + if: matrix.cross == true + run: | + mkdir -p .cargo + echo '' >> .cargo/config.toml + echo '[target.aarch64-unknown-linux-gnu]' >> .cargo/config.toml + echo 'linker = "aarch64-linux-gnu-gcc"' >> .cargo/config.toml + - name: Build + env: + AI_MODEL_CATALOG_BUILD: 1 + run: cargo build --release --bin hanzo-node --target ${{ matrix.target }} + - name: Move binary to expected location + shell: bash + run: | + mkdir -p target/release + if [ -f "target/${{ matrix.target }}/release/hanzo-node${{ matrix.arch == 'x86_64-pc-windows-msvc' && '.exe' || '' }}" ]; then + cp "target/${{ matrix.target }}/release/hanzo-node${{ matrix.arch == 'x86_64-pc-windows-msvc' && '.exe' || '' }}" target/release/ + fi + - name: Prepare bundle files + env: + ZIP_FILE_NAME: ${{ github.ref_name }}.zip + EXTENSION: ${{ matrix.arch == 'x86_64-pc-windows-msvc' && '.exe' || '' }} + run: | + mkdir files-to-r2 + cp target/release/hanzo-node${{ env.EXTENSION }} files-to-r2/hanzo-node${{ env.EXTENSION }} + cp -r target/release/hanzo-tools-runner-resources files-to-r2/ + cd ./files-to-r2 + 7z a -tzip ${{ env.ZIP_FILE_NAME}} . -sdel + cp ${{ env.ZIP_FILE_NAME}} latest.zip + - name: Upload bundle to R2 bucket + continue-on-error: true + uses: shallwefootball/s3-upload-action@master + with: + endpoint: https://94a3e3f299092abb1feda2a7481ea845.r2.cloudflarestorage.com + aws_key_id: ${{ secrets.R2_ACCESS_KEY_ID }} + aws_secret_access_key: ${{ secrets.R2_SECRET_ACCESS_KEY }} + aws_bucket: hanzoai + source_dir: files-to-r2 + destination_dir: ./hanzo-node/binaries/production/${{ matrix.arch }}/ + - name: Upload bundle to release + uses: svenstaro/upload-release-action@v2 + env: + EXTENSION: ${{ matrix.arch == 'x86_64-pc-windows-msvc' && '.exe' || '' }} + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: files-to-r2/${{ github.ref_name }}.zip + asset_name: hanzo-node-${{ matrix.arch }}.zip + tag: ${{ github.ref }} + overwrite: true diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml deleted file mode 100644 index 21ad81f68..000000000 --- a/.github/workflows/build-docker.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: Build Docker Image - -on: - workflow_dispatch: - inputs: - build_type: - description: 'Build type (debug/release)' - required: true - default: 'debug' - type: choice - options: - - debug - - release - tag: - description: 'Docker image tag (e.g. v0.9.10)' - required: true - type: string - default: 'latest' - -jobs: - build-docker-image: - runs-on: ubuntu-latest - name: Build Docker image - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Download tools from store to pre-install folder - run: | - ./scripts/update_tools.sh - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: ./docker/Dockerfile - push: true - build-args: | - BUILD_TYPE=${{ inputs.build_type }} - tags: | - hanzoai/hanzo-node:${{ inputs.tag }} - hanzoai/hanzo-node:${{ inputs.build_type }}-latest diff --git a/.github/workflows/deploy-libp2p-relayer.yml b/.github/workflows/deploy-libp2p-relayer.yml deleted file mode 100644 index 47b51d42d..000000000 --- a/.github/workflows/deploy-libp2p-relayer.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Deploy LibP2P Relayer - -on: - workflow_dispatch: - inputs: - build_type: - description: 'Build type (debug/release)' - required: true - default: 'release' - type: choice - options: - - debug - - release - tag: - description: 'Docker image tag (e.g. v0.9.10)' - required: true - type: string - default: 'latest' - -jobs: - build-and-deploy: - runs-on: ubuntu-latest - name: Build and Deploy LibP2P Relayer - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Log in to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: . - file: ./hanzo-libs/hanzo-libp2p-relayer/Dockerfile - push: true - build-args: | - BUILD_TYPE=${{ inputs.build_type }} - tags: | - hanzoai/hanzo-libp2p-relayer:${{ inputs.tag }} - hanzoai/hanzo-libp2p-relayer:${{ inputs.build_type }}-latest - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Summary - run: | - echo "🚀 Deployment completed successfully!" - echo "📦 Image: hanzoai/hanzo-libp2p-relayer:${{ inputs.tag }}" \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..f419f4478 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,17 @@ +name: Docker +on: + workflow_dispatch: + push: + branches: [main, dev, test] + tags: ['v*'] + +permissions: + contents: read + packages: write + +jobs: + docker: + uses: hanzoai/.github/.github/workflows/docker-build.yml@main + with: + image: ghcr.io/zooai/node + secrets: inherit diff --git a/.github/workflows/workflow-sanity.yml b/.github/workflows/workflow-sanity.yml new file mode 100644 index 000000000..7ea88e7ae --- /dev/null +++ b/.github/workflows/workflow-sanity.yml @@ -0,0 +1,9 @@ +name: Workflow Sanity +on: + pull_request: + push: + branches: [main] + +jobs: + sanity: + uses: hanzoai/.github/.github/workflows/workflow-sanity.yml@main