[pull] trunk from spiceai:trunk #620
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build_and_release_cuda | |
| on: | |
| pull_request: | |
| branches: | |
| - trunk | |
| paths: | |
| - 'crates/llms/Cargo.toml' | |
| push: | |
| tags: | |
| - v* | |
| paths-ignore: | |
| - '**/*.md' | |
| - 'docs/**' | |
| - 'README.md' | |
| - 'Makefile' | |
| - 'CONTRIBUTING.md' | |
| - 'SECURITY.md' | |
| - 'LICENSE' | |
| - '.github/**' | |
| - 'version.txt' | |
| - '.schema/**' | |
| - '.vscode/**' | |
| - 'deploy/**' | |
| - 'install/**' | |
| - 'media/**' | |
| - 'monitoring/**' | |
| - 'acknowledgements.md' | |
| - 'Dockerfile*' | |
| workflow_dispatch: | |
| inputs: | |
| platform_option: | |
| description: 'Which platform do you want to run on? (Default is ALL)' | |
| required: false | |
| type: choice | |
| options: | |
| - 'all' | |
| - 'Linux x64' | |
| default: 'all' | |
| compute_cap: | |
| description: 'Which CUDA compute capability to build for? (Default is ALL)' | |
| required: false | |
| type: choice | |
| options: | |
| - 'all' | |
| - '80' | |
| - '86' | |
| - '87' | |
| - '89' | |
| - '90' | |
| default: 'all' | |
| profile_option: | |
| description: 'Which Rust build profile to use? (Default is release)' | |
| required: false | |
| type: choice | |
| options: | |
| - 'release' | |
| - 'release-lto' | |
| default: 'release' | |
| jobs: | |
| setup-matrix: | |
| name: Setup CUDA matrix | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| matrix: ${{ steps.setup-matrix.outputs.result }} | |
| steps: | |
| - name: Set up matrix | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| id: setup-matrix | |
| with: | |
| script: | | |
| const isTaggedRelease = context.ref.startsWith('refs/tags/v'); | |
| const runner = isTaggedRelease ? "ubuntu-24.04-16core" : "spiceai-dev-large-runners"; | |
| const matrix = [ | |
| { | |
| compute_cap: "80", | |
| runner: runner, | |
| target_os: "linux", | |
| target_arch: "x86_64" | |
| }, | |
| { | |
| compute_cap: "86", | |
| runner: runner, | |
| target_os: "linux", | |
| target_arch: "x86_64" | |
| }, | |
| { | |
| compute_cap: "87", | |
| runner: runner, | |
| target_os: "linux", | |
| target_arch: "x86_64" | |
| }, | |
| { | |
| compute_cap: "89", | |
| runner: runner, | |
| target_os: "linux", | |
| target_arch: "x86_64" | |
| }, | |
| { | |
| compute_cap: "90", | |
| runner: runner, | |
| target_os: "linux", | |
| target_arch: "x86_64" | |
| } | |
| ]; | |
| // If running via workflow_dispatch, filter based on input | |
| if (context.eventName === 'workflow_dispatch') { | |
| const platform_option = context.payload.inputs.platform_option; | |
| const compute_cap = context.payload.inputs.compute_cap; | |
| let filtered = matrix; | |
| // Filter by platform if specified | |
| if (platform_option !== 'all') { | |
| filtered = filtered.filter(m => m.target_os === 'linux'); | |
| } | |
| // Filter by compute capability if specified | |
| if (compute_cap !== 'all') { | |
| filtered = filtered.filter(m => m.compute_cap === compute_cap); | |
| } | |
| return filtered; | |
| } | |
| // For `on.pull_request`, only build 90 compute capability on Linux. | |
| if (context.eventName === 'pull_request') { | |
| return matrix.filter(m => m.compute_cap === "90" && m.target_os === "linux"); | |
| } | |
| return matrix; | |
| build: | |
| name: Build CUDA ${{ matrix.target.compute_cap }} binaries | |
| runs-on: ${{ matrix.target.runner }} | |
| needs: setup-matrix | |
| env: | |
| RUST_PROFILE: ${{ github.event.inputs.profile_option || 'release' }} | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| CARGO_NET_GIT_FETCH_WITH_CLI: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| - name: Set REL_VERSION from version.txt | |
| run: python3 ./.github/scripts/get_release_version.py | |
| - name: Set up Rust | |
| uses: ./.github/actions/setup-rust | |
| - name: Set up wget | |
| if: matrix.target.target_os == 'linux' | |
| run: sudo apt-get update && sudo apt-get install wget -y | |
| - name: Set up make | |
| if: matrix.target.target_os == 'linux' | |
| uses: ./.github/actions/setup-make | |
| with: | |
| os: ${{ matrix.target.target_os }} | |
| - name: Set up cc | |
| if: matrix.target.target_os == 'linux' | |
| uses: ./.github/actions/setup-cc | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run Spiced CUDA Build | |
| uses: ./.github/actions/spiced-cuda-build | |
| with: | |
| cuda-version: '12.6.0' | |
| cuda-compute-capability: ${{ matrix.target.compute_cap }} | |
| artifact-tag: ${{ matrix.target.target_os }}_${{ matrix.target.target_arch }} | |
| target_os: ${{ matrix.target.target_os }} | |
| rust-profile: ${{ env.RUST_PROFILE }} | |
| publish-minio: | |
| name: Publish linux-x86_64 CUDA binaries to Minio | |
| runs-on: spiceai-dev-runners | |
| needs: build | |
| env: | |
| ARTIFACT_DIR: ./release | |
| MINIO_ENDPOINT: ${{ secrets.MINIO_ENDPOINT }} | |
| MINIO_ACCESS_KEY: ${{ secrets.MINIO_ACCESS_KEY }} | |
| MINIO_SECRET_KEY: ${{ secrets.MINIO_SECRET_KEY }} | |
| COMMIT_SHA: ${{ github.sha }} | |
| RUST_PROFILE: ${{ github.event.inputs.profile_option || 'release' }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| - name: Create artifact directory | |
| run: mkdir -p ${{ env.ARTIFACT_DIR }} | |
| # Download all Linux CUDA artifacts | |
| - name: Download Linux CUDA artifacts | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| continue-on-error: true | |
| with: | |
| pattern: spiced_cuda_*_linux_x86_64 | |
| path: ${{ env.ARTIFACT_DIR }} | |
| merge-multiple: true | |
| - name: Upload artifacts to Minio | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install wget -y | |
| sudo wget https://dl.min.io/client/mc/release/linux-amd64/mc -O /usr/local/bin/mc | |
| sudo chmod +x /usr/local/bin/mc | |
| mc alias set spice-minio ${{ env.MINIO_ENDPOINT }} ${{ env.MINIO_ACCESS_KEY }} ${{ env.MINIO_SECRET_KEY }} | |
| # Upload any CUDA artifacts that were successfully built | |
| for file in ${{ env.ARTIFACT_DIR }}/spiced_cuda_*_linux_x86_64.tar.gz; do | |
| if [ -f "$file" ]; then | |
| echo "Uploading $file to Minio..." | |
| mc cp "$file" spice-minio/artifacts/spiced/linux-x86_64/${{ env.COMMIT_SHA }}/ | |
| fi | |
| done | |
| publish: | |
| name: Publish CUDA binaries | |
| needs: build | |
| if: startswith(github.ref, 'refs/tags/v') && github.event_name != 'pull_request' | |
| env: | |
| ARTIFACT_DIR: ./release | |
| RUST_PROFILE: ${{ github.event.inputs.profile_option || 'release' }} | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 | |
| - name: Create artifact directory | |
| run: mkdir -p ${{ env.ARTIFACT_DIR }} | |
| - name: Set REL_VERSION from version.txt | |
| run: python3 ./.github/scripts/get_release_version.py | |
| # Download all CUDA artifacts for this platform | |
| - name: Download CUDA artifacts | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| continue-on-error: true | |
| with: | |
| path: ${{ env.ARTIFACT_DIR }} | |
| merge-multiple: true | |
| - name: List artifacts | |
| run: ls -l ${{ env.ARTIFACT_DIR }} | |
| - name: Publish CUDA binaries to GitHub | |
| run: | | |
| # Parse repository to get owner and repo names | |
| OWNER_NAME="${GITHUB_REPOSITORY%%/*}" | |
| REPO_NAME="${GITHUB_REPOSITORY#*/}" | |
| export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
| # First check if we have any files to upload | |
| if [ -z "$(ls -A ${ARTIFACT_DIR})" ]; then | |
| echo "No artifacts found in ${ARTIFACT_DIR}" | |
| exit 1 | |
| fi | |
| # Create an array of actual files (no globs) | |
| RELEASE_ARTIFACTS=() | |
| for file in ${ARTIFACT_DIR}/*; do | |
| if [ -f "$file" ]; then | |
| RELEASE_ARTIFACTS+=("$file") | |
| fi | |
| done | |
| # Delete existing release artifact | |
| python ./.github/scripts/github_release.py delete \ | |
| --owner $OWNER_NAME --repo $REPO_NAME \ | |
| --tag "v${{ env.REL_VERSION }}" \ | |
| "${RELEASE_ARTIFACTS[@]}" | |
| if [ "$LATEST_RELEASE" = "true" ]; then | |
| export RELEASE_BODY=`cat ./docs/release_notes/v${{ env.REL_VERSION }}.md` | |
| else | |
| export RELEASE_BODY="This is the release candidate ${{ env.REL_VERSION }}" | |
| fi | |
| echo "Uploading Spice.ai CUDA Binaries to GitHub Release" | |
| python ./.github/scripts/github_release.py upload \ | |
| --owner $OWNER_NAME --repo $REPO_NAME \ | |
| --tag "v${{ env.REL_VERSION }}" \ | |
| --release-name "v${{ env.REL_VERSION }}" \ | |
| --body "${RELEASE_BODY}" \ | |
| --prerelease "$PRE_RELEASE" \ | |
| "${RELEASE_ARTIFACTS[@]}" |