Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
256 changes: 103 additions & 153 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
@@ -1,166 +1,116 @@
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
strategy:
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
51 changes: 0 additions & 51 deletions .github/workflows/build-docker.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/deploy-libp2p-relayer.yml

This file was deleted.

17 changes: 17 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading