This commit is contained in:
illuzen
2025-12-22 21:25:15 +08:00
committed by GitHub
parent a97d79632e
commit b3cef7bab8
3 changed files with 97 additions and 90 deletions

View File

@@ -45,15 +45,28 @@ jobs:
name: 🛠️ Build & Test
needs: fast-checks
runs-on: ubuntu-latest
strategy:
matrix:
features: ["", "gpu"]
steps:
- uses: actions/checkout@v4
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: compile
run: cargo build --locked --workspace
- name: compile (${{ matrix.features || 'cpu-only' }})
run: |
if [ -n "${{ matrix.features }}" ]; then
cargo build --locked --workspace --features ${{ matrix.features }}
else
cargo build --locked --workspace
fi
timeout-minutes: 90
- name: test
run: cargo test --locked --workspace
- name: test (${{ matrix.features || 'cpu-only' }})
run: |
if [ -n "${{ matrix.features }}" ]; then
cargo test --locked --workspace --features ${{ matrix.features }}
else
cargo test --locked --workspace
fi
timeout-minutes: 15
analysis:
@@ -66,64 +79,24 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- name: clippy
run: cargo clippy --locked --workspace
- name: clippy (all features)
run: cargo clippy --locked --workspace --all-features
timeout-minutes: 30
- name: doc
run: cargo doc --locked --workspace --no-deps
run: cargo doc --locked --workspace --no-deps --all-features
timeout-minutes: 15
# cuda-build:
# name: 🚀 CUDA Build (cuda=${{ matrix.cuda_tag }} sm=${{ matrix.sm }})
# needs: fast-checks
# 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: Check if cuda-builder image exists
# id: check-image
# run: |
# if docker manifest inspect ghcr.io/quantus-network/cuda-builder:${{ matrix.cuda_tag }} >/dev/null 2>&1; then
# echo "exists=true" >> "$GITHUB_OUTPUT"
# echo "✅ CUDA builder image exists for ${{ matrix.cuda_tag }}"
# else
# echo "exists=false" >> "$GITHUB_OUTPUT"
# echo "⚠️ CUDA builder image not found for ${{ matrix.cuda_tag }}, skipping build"
# fi
# - name: Build with cuda-builder image
# if: steps.check-image.outputs.exists == 'true'
# 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
# if: steps.check-image.outputs.exists == 'true'
# 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
benchmark:
name: 🏃 Benchmark
needs: fast-checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: build benchmark binary
run: cargo build -p miner-cli --release --features gpu
timeout-minutes: 60
- name: run cpu benchmark
run: ./target/release/quantus-miner benchmark --cpu-workers 2 --duration 5
timeout-minutes: 10

View File

@@ -8,14 +8,14 @@ on:
workflow_dispatch:
inputs:
target_branch:
description: 'Target branch for the PR (default: main)'
description: "Target branch for the PR (default: main)"
required: false
type: string
default: 'main'
default: "main"
version_type:
description: 'Type of version bump'
description: "Type of version bump"
required: true
default: 'patch'
default: "patch"
type: choice
options:
- patch
@@ -26,7 +26,7 @@ on:
description: 'Custom version string (e.g., 1.2.3). Only used if version_type is "custom".'
required: false
is_draft:
description: 'Is this a draft release?'
description: "Is this a draft release?"
required: true
type: boolean
default: false
@@ -58,12 +58,12 @@ jobs:
run: |
# Get all version tags and sort them by version
latest_semver_tag=$(git tag -l "v[0-9]*.[0-9]*.[0-9]*" | sort -V | tail -n 1)
# If no tags found, use default
if [ -z "$latest_semver_tag" ]; then
latest_semver_tag="v0.0.0"
fi
echo "latest_tag_found=$latest_semver_tag" >> $GITHUB_OUTPUT
echo "Latest semantic version tag found: $latest_semver_tag"
@@ -135,7 +135,7 @@ jobs:
env:
NEW_VERSION: ${{ needs.calculate-next-version.outputs.new_version }}
NEW_TAG: ${{ needs.calculate-next-version.outputs.new_tag }}
GITHUB_TOKEN: ${{ secrets.ADMIN_PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SOURCE_BRANCH: ${{ needs.calculate-next-version.outputs.source_branch }}
TARGET_BRANCH: ${{ github.event.inputs.target_branch }}
run: |
@@ -146,11 +146,11 @@ jobs:
# Create new branch from source branch
git checkout "$SOURCE_BRANCH"
git checkout -b "$branch_name"
# Update version in workspace Cargo.toml (safer than cargo set-version)
echo "Updating workspace Cargo.toml to version: $new_cargo_version"
sed -i -E "s/^version\s*=\s*\"[0-9a-zA-Z.-]+\"/version = \"$new_cargo_version\"/" Cargo.toml
# Regenerate Cargo.lock with precise updates for our packages only
cargo update -p miner-cli --precise "$new_cargo_version"
cargo update -p miner-service --precise "$new_cargo_version"
@@ -158,16 +158,15 @@ jobs:
cargo update -p metrics --precise "$new_cargo_version"
cargo update -p miner-telemetry --precise "$new_cargo_version"
cargo update -p engine-cpu --precise "$new_cargo_version"
cargo update -p engine-gpu-cuda --precise "$new_cargo_version"
cargo update -p engine-gpu-opencl --precise "$new_cargo_version"
cargo update -p engine-gpu --precise "$new_cargo_version"
# Verify everything compiles correctly
cargo check --workspace
# Commit changes
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git add Cargo.toml Cargo.lock
git commit -m "bump version to $NEW_VERSION"
git push origin "$branch_name"

View File

@@ -38,18 +38,18 @@ jobs:
echo "Error: Could not extract version from PR title: ${{ github.event.pull_request.title }}"
exit 1
fi
VERSION=${VERSION_TAG#v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=$VERSION_TAG" >> $GITHUB_OUTPUT
# Check if this is a draft release
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'draft-release') }}" == "true" ]]; then
echo "is_draft=true" >> $GITHUB_OUTPUT
else
echo "is_draft=false" >> $GITHUB_OUTPUT
fi
echo "Extracted version: $VERSION"
echo "Extracted tag: $VERSION_TAG"
@@ -66,32 +66,69 @@ jobs:
strategy:
matrix:
include:
# Linux builds
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary_name: quantus-miner
asset_name: quantus-miner-linux-x86_64
features: ""
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary_name: quantus-miner
asset_name: quantus-miner-linux-x86_64-gpu
features: "gpu"
# Windows builds
- os: windows-latest
target: x86_64-pc-windows-msvc
binary_name: quantus-miner.exe
asset_name: quantus-miner-windows-x86_64.exe
features: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
binary_name: quantus-miner.exe
asset_name: quantus-miner-windows-x86_64-gpu.exe
features: "gpu"
# macOS builds (Intel)
- os: macos-13
target: x86_64-apple-darwin
binary_name: quantus-miner
asset_name: quantus-miner-macos-x86_64
features: ""
- os: macos-13
target: x86_64-apple-darwin
binary_name: quantus-miner
asset_name: quantus-miner-macos-x86_64-gpu
features: "gpu"
# macOS builds (Apple Silicon)
- os: macos-latest
target: aarch64-apple-darwin
binary_name: quantus-miner
asset_name: quantus-miner-macos-aarch64
features: ""
- os: macos-latest
target: aarch64-apple-darwin
binary_name: quantus-miner
asset_name: quantus-miner-macos-aarch64-gpu
features: "gpu"
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.create-tag.outputs.tag }}
- name: setup rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- name: build binary
run: cargo build --release --locked --target ${{ matrix.target }}
run: |
if [[ -n "${{ matrix.features }}" ]]; then
cargo build --release --locked --target ${{ matrix.target }} --features ${{ matrix.features }}
else
cargo build --release --locked --target ${{ matrix.target }}
fi
- name: prepare binary
shell: bash
run: |
@@ -102,7 +139,7 @@ jobs:
cp ${{ matrix.binary_name }} ${{ matrix.asset_name }}
strip ${{ matrix.asset_name }}
fi
- name: upload binary artifact
uses: actions/upload-artifact@v4
with:
@@ -116,12 +153,12 @@ jobs:
- uses: actions/checkout@v4
with:
ref: ${{ needs.create-tag.outputs.tag }}
- name: download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -134,12 +171,10 @@ jobs:
else
DRAFT_FLAG=""
fi
# Create release with all artifacts
gh release create "$TAG" \
--title "Release $TAG" \
--generate-notes \
$DRAFT_FLAG \
artifacts/quantus-miner-linux-x86_64/quantus-miner-linux-x86_64 \
artifacts/quantus-miner-windows-x86_64.exe/quantus-miner-windows-x86_64.exe \
artifacts/quantus-miner-macos-aarch64/quantus-miner-macos-aarch64
artifacts/*/quantus-miner-*