70 lines
2.0 KiB
YAML
70 lines
2.0 KiB
YAML
name: cuda build
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "*.md"
|
|
- "LICENSE"
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- ".github/workflows/**"
|
|
- ".github/actions/**"
|
|
- "docs/**"
|
|
- "*.md"
|
|
- "LICENSE"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build-matrix:
|
|
name: cuda=${{ matrix.cuda_tag }} sm=${{ matrix.sm }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
cuda_tag: ["12.9.0", "13.0.0"]
|
|
sm: ["86", "89", "120"]
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build with cuda-builder image
|
|
id: build
|
|
env:
|
|
CUDA_TAG: ${{ matrix.cuda_tag }}
|
|
SM: ${{ matrix.sm }}
|
|
GITHUB_SHA: ${{ github.sha }}
|
|
run: |
|
|
set -eux
|
|
SHORT_TAG="$(echo "${CUDA_TAG}" | sed -E 's/^([0-9]+\.[0-9]+).*/\1/')"
|
|
BIN="quantus-miner-cuda-${SHORT_TAG}-sm-${SM}"
|
|
mkdir -p .cargo-cache target
|
|
docker run --rm \
|
|
-e CUDA_ARCH=sm_${SM} \
|
|
-e CARGO_TERM_COLOR=always \
|
|
-e GITHUB_SHA="${GITHUB_SHA}" \
|
|
-v "${PWD}:/workspace" \
|
|
-v "${PWD}/.cargo-cache:/opt/cargo/registry" \
|
|
-v "${PWD}/target:/workspace/target" \
|
|
ghcr.io/quantus-network/cuda-builder:${CUDA_TAG} \
|
|
bash -lc 'cd /workspace && echo "CUDA version:" && nvcc --version && cargo build -p miner-cli --features cuda --release && strip target/release/quantus-miner || true'
|
|
install -m 0755 ./target/release/quantus-miner "./${BIN}"
|
|
echo "bin_path=./${BIN}" >> "$GITHUB_OUTPUT"
|
|
echo "short_tag=${SHORT_TAG}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ format('quantus-miner-cuda-{0}-sm-{1}', steps.build.outputs.short_tag, matrix.sm) }}
|
|
path: ${{ steps.build.outputs.bin_path }}
|
|
if-no-files-found: error
|
|
retention-days: 3
|