|
| 1 | +name: Build and Release Bento Components |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'bento-v*' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: 'Version to release (e.g., bento-v1.0.0)' |
| 11 | + required: true |
| 12 | + default: 'bento-v1.0.0' |
| 13 | + dry_run: |
| 14 | + description: 'Dry run (build only, no release)' |
| 15 | + required: false |
| 16 | + default: 'false' |
| 17 | + |
| 18 | +env: |
| 19 | + RISC0_TOOLCHAIN_VERSION: 1.88.0 |
| 20 | + RISC0_CRATE_VERSION: "2.3.1" |
| 21 | + RUST_VERSION: "1.88.0" |
| 22 | + |
| 23 | +jobs: |
| 24 | + build-bento: |
| 25 | + name: Build Bento Components |
| 26 | + runs-on: ubuntu-latest |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + target: |
| 30 | + - x86_64-unknown-linux-gnu |
| 31 | + include: |
| 32 | + - target: x86_64-unknown-linux-gnu |
| 33 | + os: linux |
| 34 | + arch: x64 |
| 35 | + artifact_name: linux-amd64 |
| 36 | + |
| 37 | + steps: |
| 38 | + - name: Checkout code |
| 39 | + uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + submodules: recursive |
| 42 | + fetch-depth: 0 |
| 43 | + |
| 44 | + - name: Install deps |
| 45 | + run: | |
| 46 | + # Add NVIDIA repository and install drivers |
| 47 | + wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb |
| 48 | + sudo dpkg -i cuda-keyring_1.1-1_all.deb |
| 49 | + sudo apt-get update |
| 50 | + sudo apt-get install -y build-essential libssl-dev cuda-toolkit-13-0 nvidia-open |
| 51 | +
|
| 52 | + # Debug PATH and verify tools |
| 53 | + echo "=== PATH Debug ===" |
| 54 | + echo "PATH: $PATH" |
| 55 | + echo "=== Tool Locations ===" |
| 56 | + which gcc || echo "gcc not found" |
| 57 | + which cc || echo "cc not found" |
| 58 | + which nvcc || echo "nvcc not found" |
| 59 | + echo "=== CUDA Paths ===" |
| 60 | + ls -la /usr/local/cuda/bin/ || echo "CUDA bin not found" |
| 61 | + ls -la /usr/bin/gcc || echo "System gcc not found" |
| 62 | +
|
| 63 | +
|
| 64 | + - name: setup sccache + s3 |
| 65 | + uses: ./.github/actions/sccache |
| 66 | + |
| 67 | + - name: Setup Rust toolchain |
| 68 | + uses: actions-rs/toolchain@v1 |
| 69 | + with: |
| 70 | + toolchain: ${{ env.RUST_VERSION }} |
| 71 | + target: ${{ matrix.target }} |
| 72 | + override: true |
| 73 | + profile: minimal |
| 74 | + |
| 75 | + - name: Install RISC0 toolchain |
| 76 | + uses: risc0/risc0/.github/actions/rustup@352dea62857ba57331053cd0986a12c1a4708732 |
| 77 | + with: |
| 78 | + toolchain: ${{ env.RISC0_TOOLCHAIN_VERSION }} |
| 79 | + |
| 80 | + - name: Install cargo risczero |
| 81 | + uses: ./.github/actions/bininstall-risc0 |
| 82 | + with: |
| 83 | + risczero-version: ${{ env.RISC0_CRATE_VERSION }} |
| 84 | + toolchain-version: ${{ env.RISC0_TOOLCHAIN_VERSION }} |
| 85 | + |
| 86 | + - name: Cache Rust dependencies |
| 87 | + uses: actions/cache@v4 |
| 88 | + with: |
| 89 | + path: | |
| 90 | + ~/.cargo/registry |
| 91 | + ~/.cargo/git |
| 92 | + bento/target |
| 93 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 94 | + restore-keys: | |
| 95 | + ${{ runner.os }}-cargo- |
| 96 | +
|
| 97 | + - name: Build Bento Components Bundle |
| 98 | + working-directory: bento |
| 99 | + env: |
| 100 | + CUDA_PATH: /usr/local/cuda |
| 101 | + CUDA_HOME: /usr/local/cuda |
| 102 | + PATH: /usr/local/cuda/bin:/usr/bin:/usr/local/bin:/home/runner/.cargo/bin:$PATH |
| 103 | + LD_LIBRARY_PATH: /usr/local/cuda/lib64:$LD_LIBRARY_PATH |
| 104 | + NVCC_FLAGS: "--generate-code arch=compute_86,code=sm_86 --generate-code arch=compute_89,code=sm_89 --generate-code arch=compute_120,code=sm_120" |
| 105 | + SCCACHE_CUDA: "1" |
| 106 | + SCCACHE_CUDA_COMPILER: "nvcc" |
| 107 | + SCCACHE_CUDA_INCLUDE: "/usr/local/cuda/include" |
| 108 | + SCCACHE_CUDA_LIB: "/usr/local/cuda/lib64" |
| 109 | + run: | |
| 110 | + # Build all components |
| 111 | + cargo build --release --target ${{ matrix.target }} -F cuda --bin agent |
| 112 | + cargo build --release --target ${{ matrix.target }} --bin rest_api |
| 113 | + cargo build --release --target ${{ matrix.target }} --bin bento_cli |
| 114 | +
|
| 115 | + # Create bundle directory in workspace root |
| 116 | + mkdir -p ../binaries/${{ matrix.artifact_name }}/bento-bundle |
| 117 | +
|
| 118 | + # Copy all components to bundle |
| 119 | + cp target/${{ matrix.target }}/release/agent ../binaries/${{ matrix.artifact_name }}/bento-bundle/bento-agent |
| 120 | + cp target/${{ matrix.target }}/release/rest_api ../binaries/${{ matrix.artifact_name }}/bento-bundle/bento-rest-api |
| 121 | + cp target/${{ matrix.target }}/release/bento_cli ../binaries/${{ matrix.artifact_name }}/bento-bundle/bento-cli |
| 122 | +
|
| 123 | + # Create bundle archive |
| 124 | + cd ../binaries/${{ matrix.artifact_name }} |
| 125 | + tar -czf bento-bundle-${{ matrix.artifact_name }}.tar.gz bento-bundle/ |
| 126 | + rm -rf bento-bundle/ |
| 127 | +
|
| 128 | + - name: sccache stats |
| 129 | + run: sccache --show-stats |
| 130 | + |
| 131 | + - name: Create checksums |
| 132 | + working-directory: binaries/${{ matrix.artifact_name }} |
| 133 | + run: | |
| 134 | + sha256sum bento-bundle-${{ matrix.artifact_name }}.tar.gz > bento-bundle-${{ matrix.artifact_name }}.tar.gz.sha256 |
| 135 | +
|
| 136 | + - name: Upload artifacts |
| 137 | + uses: actions/upload-artifact@v4 |
| 138 | + with: |
| 139 | + name: bento-binaries-${{ matrix.artifact_name }} |
| 140 | + path: binaries/${{ matrix.artifact_name }} |
| 141 | + retention-days: 30 |
| 142 | + |
| 143 | + create-release: |
| 144 | + name: Create GitHub Release |
| 145 | + needs: build-bento |
| 146 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/bento-v') && github.event.inputs.dry_run != 'true' |
| 147 | + runs-on: ubuntu-latest |
| 148 | + permissions: |
| 149 | + contents: write |
| 150 | + id-token: write |
| 151 | + |
| 152 | + steps: |
| 153 | + - name: Checkout code |
| 154 | + uses: actions/checkout@v4 |
| 155 | + with: |
| 156 | + fetch-depth: 0 |
| 157 | + |
| 158 | + - name: Download all artifacts |
| 159 | + uses: actions/download-artifact@v4 |
| 160 | + with: |
| 161 | + path: artifacts |
| 162 | + |
| 163 | + - name: Prepare release assets |
| 164 | + run: | |
| 165 | + mkdir -p release-assets |
| 166 | + for artifact in artifacts/bento-binaries-*; do |
| 167 | + if [ -d "$artifact" ]; then |
| 168 | + cp -r "$artifact"/* release-assets/ |
| 169 | + fi |
| 170 | + done |
| 171 | + ls -la release-assets/ |
| 172 | +
|
| 173 | + - name: Extract version from tag |
| 174 | + id: get_version |
| 175 | + run: | |
| 176 | + VERSION=${GITHUB_REF#refs/tags/} |
| 177 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 178 | + echo "release_name=Bento Release $VERSION" >> $GITHUB_OUTPUT |
| 179 | +
|
| 180 | + - name: Create Release |
| 181 | + id: create_release |
| 182 | + uses: actions/create-release@v1 |
| 183 | + env: |
| 184 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 185 | + with: |
| 186 | + tag_name: ${{ steps.get_version.outputs.version }} |
| 187 | + release_name: ${{ steps.get_version.outputs.release_name }} |
| 188 | + body: | |
| 189 | + ## Bento Components Release |
| 190 | +
|
| 191 | + This release includes a complete bundle of Bento components: |
| 192 | + - **Bento Agent**: Workflow execution agent (with CUDA support) |
| 193 | + - **Bento REST API**: REST API server |
| 194 | + - **Bento Client**: Client library |
| 195 | +
|
| 196 | + ### Supported Platforms |
| 197 | + - Linux AMD64 |
| 198 | +
|
| 199 | + ### Installation |
| 200 | + Download the appropriate bundle for your platform and extract: |
| 201 | + ```bash |
| 202 | + # Download and extract |
| 203 | + tar -xzf bento-bundle-linux-amd64.tar.gz |
| 204 | + cd bento-bundle |
| 205 | +
|
| 206 | + # Make executables |
| 207 | + chmod +x bento-agent |
| 208 | + chmod +x bento-rest-api |
| 209 | + chmod +x bento-client |
| 210 | + ``` |
| 211 | +
|
| 212 | + ### Usage |
| 213 | + ```bash |
| 214 | + # Run agent |
| 215 | + ./bento-agent --help |
| 216 | +
|
| 217 | + # Run REST API |
| 218 | + ./bento-rest-api --help |
| 219 | +
|
| 220 | + # Run client |
| 221 | + ./bento-client --help |
| 222 | + ``` |
| 223 | +
|
| 224 | + ### Verification |
| 225 | + Verify the integrity of downloaded bundles using the provided SHA256 checksums. |
| 226 | + draft: false |
| 227 | + prerelease: false |
| 228 | + |
| 229 | + - name: Upload Bento Bundle (Linux AMD64) |
| 230 | + uses: actions/upload-release-asset@v1 |
| 231 | + env: |
| 232 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 233 | + with: |
| 234 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 235 | + asset_path: ./release-assets/bento-bundle-linux-amd64.tar.gz |
| 236 | + asset_name: bento-bundle-linux-amd64.tar.gz |
| 237 | + asset_content_type: application/gzip |
| 238 | + |
| 239 | + - name: Upload SHA256 checksums |
| 240 | + uses: actions/upload-release-asset@v1 |
| 241 | + env: |
| 242 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 243 | + with: |
| 244 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 245 | + asset_path: ./release-assets/bento-bundle-linux-amd64.tar.gz.sha256 |
| 246 | + asset_name: bento-bundle-linux-amd64.tar.gz.sha256 |
| 247 | + asset_content_type: text/plain |
0 commit comments