Skip to content

refactor: align pod resource naming across crates (#290) #699

refactor: align pod resource naming across crates (#290)

refactor: align pod resource naming across crates (#290) #699

Workflow file for this run

permissions:
contents: read
name: Release
on:
push:
branches:
- main
workflow_dispatch:
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUSTUP_MAX_RETRIES: 10
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
jobs:
release:
permissions:
# to create release tags (cycjimmy/semantic-release-action)
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
outputs:
published: ${{ github.event_name == 'workflow_dispatch' || steps.semantic.outputs.new_release_published }}
version: ${{ github.event_name == 'workflow_dispatch' && steps.set_tag.outputs.tag || steps.semantic.outputs.new_release_version }}
steps:
- uses: actions/checkout@v6
- name: Set Tag
if: github.event_name == 'workflow_dispatch'
id: set_tag
run: echo "tag=dev-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Semantic Release
if: github.event_name != 'workflow_dispatch'
id: semantic
uses: cycjimmy/[email protected]
with:
semantic_version: 18
extra_plugins: |
@semantic-release/release-notes-generator@^10
@semantic-release/github@^8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
download_tensor_fusion_components:
needs: release
if: needs.release.outputs.published == 'true'
runs-on: ubuntu-latest
steps:
- name: Download tensor-fusion-worker from tensor-fusion-worker
uses: robinraju/release-downloader@v1
with:
repository: "NexusGPU/tensor-fusion-worker"
latest: true
fileName: "tensor-fusion-worker"
token: ${{ secrets.PRIVATE_REPO_TOKEN }}
- name: Download libcuda.so from tensor-fusion-client
uses: robinraju/release-downloader@v1
with:
repository: "NexusGPU/tensor-fusion-client"
latest: true
fileName: "libcuda.so"
token: ${{ secrets.PRIVATE_REPO_TOKEN }}
- name: Download libnvidia-ml.so from tensor-fusion-client
uses: robinraju/release-downloader@v1
with:
repository: "NexusGPU/tensor-fusion-client"
latest: true
fileName: "libnvidia-ml.so"
token: ${{ secrets.PRIVATE_REPO_TOKEN }}
- name: Download libteleport.so from tensor-fusion-client
uses: robinraju/release-downloader@v1
with:
repository: "NexusGPU/tensor-fusion-client"
latest: true
fileName: "libteleport.so"
token: ${{ secrets.PRIVATE_REPO_TOKEN }}
- name: Upload downloaded tensor-fusion components
uses: actions/upload-artifact@v5
with:
name: tensor-fusion-components
path: |
tensor-fusion-worker
libcuda.so
libnvidia-ml.so
libteleport.so
build_libraries:
needs:
- release
if: needs.release.outputs.published == 'true'
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
platform: linux-x64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
platform: linux-arm64
name: build_libraries (${{ matrix.target }})
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Update apt repositories
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get update
- name: Install AArch64 target toolchain
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get install gcc-aarch64-linux-gnu
- name: Install CUDA toolkit
uses: Jimver/[email protected]
with:
sub-packages: '["nvcc", "cudart-dev"]'
method: network
- name: Install Rust toolchain
run: |
rustup update --no-self-update stable
rustup target add ${{ matrix.target }}
- name: Install cross
run: |
if ! (command -v cross &> /dev/null && command -v cross-util &> /dev/null); then
cargo install cross --git https://github.com/cross-rs/cross
else
echo "cross is already installed, skipping installation."
fi
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "build-${{ matrix.target }}"
prefix-key: v1
- name: Build cuda-limiter
run: VERSION=${{ needs.release.outputs.version }} cross build -p cuda-limiter --release --target ${{ matrix.target }}
- name: Build bootstrap program
run: VERSION=${{ needs.release.outputs.version }} cross build -p bootstrap --release --target ${{ matrix.target }}
- name: Upload cuda-limiter artifact
uses: actions/upload-artifact@v5
with:
name: libcuda_limiter-${{ matrix.platform }}
path: target/${{ matrix.target }}/release/libcuda_limiter.so
- name: Upload bootstrap artifact
uses: actions/upload-artifact@v5
with:
name: bootstrap-${{ matrix.platform }}
path: target/${{ matrix.target }}/release/bootstrap
- name: Build add-path
run: VERSION=${{ needs.release.outputs.version }} cross build -p add-path --release --target ${{ matrix.target }}
- name: Upload add-path artifact
uses: actions/upload-artifact@v5
with:
name: libadd_path-${{ matrix.platform }}
path: target/${{ matrix.target }}/release/libadd_path.so
publish_libraries:
needs:
- release
- build_libraries
- download_tensor_fusion_components
if: needs.release.outputs.published == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v6
with:
path: artifacts
pattern: "!*.dockerbuild"
- name: Compress artifacts
run: |
tar -czf libcuda_limiter-x64.tar.gz -C artifacts/libcuda_limiter-linux-x64 libcuda_limiter.so
tar -czf libcuda_limiter-arm64.tar.gz -C artifacts/libcuda_limiter-linux-arm64 libcuda_limiter.so
tar -czf libadd_path-x64.tar.gz -C artifacts/libadd_path-linux-x64 libadd_path.so
tar -czf libadd_path-arm64.tar.gz -C artifacts/libadd_path-linux-arm64 libadd_path.so
tar -czf tensor-fusion-components.tar.gz -C artifacts/tensor-fusion-components .
tar -czf bootstrap-x64.tar.gz -C artifacts/bootstrap-linux-x64 bootstrap
tar -czf bootstrap-arm64.tar.gz -C artifacts/bootstrap-linux-arm64 bootstrap
- name: Add assets to manual release
if: github.event_name == 'workflow_dispatch'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.release.outputs.version }}
files: |
libcuda_limiter-x64.tar.gz
libcuda_limiter-arm64.tar.gz
libadd_path-x64.tar.gz
libadd_path-arm64.tar.gz
tensor-fusion-components.tar.gz
bootstrap-x64.tar.gz
bootstrap-arm64.tar.gz
- name: Add assets to semantic release
if: github.event_name != 'workflow_dispatch'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ needs.release.outputs.version }}
files: |
libcuda_limiter-x64.tar.gz
libcuda_limiter-arm64.tar.gz
libadd_path-x64.tar.gz
libadd_path-arm64.tar.gz
tensor-fusion-components.tar.gz
bootstrap-x64.tar.gz
bootstrap-arm64.tar.gz
publish_hypervisor:
needs:
- release
if: needs.release.outputs.published == 'true'
strategy:
matrix:
include:
- arch: amd64
target: x86_64-unknown-linux-gnu
use_cross: false
cache_strategy: gha
- arch: arm64
target: aarch64-unknown-linux-gnu
use_cross: true
cache_strategy: no-cache
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install rust
uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.target }}
- name: Install protobuf-compiler (native build)
if: '!matrix.use_cross'
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Setup Cross.toml for CI
if: matrix.use_cross
run: |
cat > Cross.toml << 'EOF'
[build.env]
passthrough = [
"VERSION",
]
[build]
pre-build = [
"apt-get update && apt-get install -y protobuf-compiler"
]
EOF
- name: Install cross
if: matrix.use_cross
run: |
if ! (command -v cross &> /dev/null && command -v cross-util &> /dev/null); then
cargo install cross --git https://github.com/cross-rs/cross
else
echo "cross is already installed, skipping installation."
fi
- name: Configure cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: v1
shared-key: "hypervisor-${{ matrix.target }}"
- name: Build hypervisor
run: |
if [ "${{ matrix.use_cross }}" = "true" ]; then
VERSION=${{ needs.release.outputs.version }} cross build -p hypervisor --release --target ${{ matrix.target }}
else
VERSION=${{ needs.release.outputs.version }} cargo build -p hypervisor --release --target ${{ matrix.target }}
fi
- id: meta
uses: docker/metadata-action@v5
with:
images: |
tensorfusion/tensor-fusion-hypervisor
tags: |
type=raw,value=${{ needs.release.outputs.version }}_${{ matrix.arch }}
- name: Setup buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- id: build
uses: docker/build-push-action@v6
with:
context: .
push: true
platforms: linux/${{ matrix.arch }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: ${{ matrix.cache_strategy == 'gha' && 'type=gha' || '' }}
cache-to: ${{ matrix.cache_strategy == 'gha' && 'type=gha,mode=max' || '' }}
no-cache: ${{ matrix.cache_strategy == 'no-cache' }}
build-args: |
BINARY_PATH=target/${{ matrix.target }}/release/hypervisor
merge_images:
needs:
- release
- publish_hypervisor
if: needs.publish_hypervisor.result == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/setup-buildx-action@v3
- name: Create and push manifest for auto release
if: github.event_name != 'workflow_dispatch'
run: |
docker buildx imagetools create \
-t tensorfusion/tensor-fusion-hypervisor:${{ needs.release.outputs.version }} \
-t tensorfusion/tensor-fusion-hypervisor:latest \
tensorfusion/tensor-fusion-hypervisor:${{ needs.release.outputs.version }}_amd64 \
tensorfusion/tensor-fusion-hypervisor:${{ needs.release.outputs.version }}_arm64
- name: Create and push manifest for manual release
if: github.event_name == 'workflow_dispatch'
run: |
docker buildx imagetools create \
-t tensorfusion/tensor-fusion-hypervisor:${{ needs.release.outputs.version }} \
tensorfusion/tensor-fusion-hypervisor:${{ needs.release.outputs.version }}_amd64 \
tensorfusion/tensor-fusion-hypervisor:${{ needs.release.outputs.version }}_arm64
trigger_ngpu_release:
needs:
- publish_libraries
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Trigger ngpu release workflow_dispatch
uses: actions/[email protected]
with:
github-token: ${{ secrets.PRIVATE_REPO_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'NexusGPU',
repo: 'ngpu',
workflow_id: 'release.yml',
ref: 'main'
});