fix(validator): correct weight merging for hotkeys without UIDs #320
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: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main, master] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| RUST_BACKTRACE: short | |
| CARGO_NET_RETRY: 10 | |
| RUSTUP_MAX_RETRIES: 10 | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # All Rust jobs run in parallel, sharing cache from previous runs | |
| build: | |
| name: Build | |
| runs-on: platform-runner | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "platform-ci" | |
| - run: cargo build --release | |
| clippy: | |
| name: Clippy | |
| runs-on: platform-runner | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "platform-ci" | |
| save-if: false | |
| - run: cargo clippy --all-targets --workspace -- -W clippy::all | |
| test: | |
| name: Test | |
| runs-on: platform-runner | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-nextest | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "platform-ci" | |
| save-if: false | |
| - name: Run tests | |
| run: cargo nextest run --workspace -E 'not (test(/live/) | test(/integration/))' | |
| # Coverage runs in a separate job with its own concurrency group | |
| # This prevents coverage deployment from being cancelled by new commits | |
| coverage: | |
| name: Coverage | |
| runs-on: platform-runner | |
| if: github.ref == 'refs/heads/main' | |
| concurrency: | |
| group: coverage-deploy | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: llvm-tools-preview | |
| - uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-nextest,cargo-llvm-cov | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "platform-ci" | |
| save-if: false | |
| - name: Run tests with coverage | |
| run: | | |
| cargo llvm-cov nextest --workspace --json --output-path coverage.json -E 'not (test(/live/) | test(/integration/))' | |
| cargo llvm-cov report --html --output-dir coverage-html | |
| - name: Upload coverage HTML report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-html | |
| path: coverage-html/ | |
| - name: Publish coverage HTML to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./coverage-html | |
| destination_dir: coverage-html | |
| keep_files: true | |
| - name: Generate and deploy coverage badge | |
| run: | | |
| COVERAGE=$(jq '.data[0].totals.lines.percent // 0 | round' coverage.json) | |
| echo "Coverage: $COVERAGE%" | |
| mkdir -p badges | |
| if (( COVERAGE >= 80 )); then COLOR="brightgreen" | |
| elif (( COVERAGE >= 60 )); then COLOR="green" | |
| elif (( COVERAGE >= 40 )); then COLOR="yellow" | |
| else COLOR="red"; fi | |
| curl -s "https://img.shields.io/badge/coverage-${COVERAGE}%25-${COLOR}" > badges/coverage.svg | |
| - name: Deploy coverage badge | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./badges | |
| destination_dir: badges | |
| keep_files: true | |
| # Docker only runs after build, clippy and test pass | |
| docker: | |
| name: Docker | |
| runs-on: platform-runner | |
| needs: [build, clippy, test] | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| if: github.event_name != 'pull_request' | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=sha,prefix= | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| # Release only on tags, after all checks pass | |
| release: | |
| name: Release | |
| runs-on: platform-runner | |
| needs: [build, clippy, test, docker] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "platform-ci" | |
| save-if: false | |
| - run: cargo build --release | |
| - run: | | |
| mkdir -p release | |
| cp target/release/validator-node release/ | |
| cp target/release/csudo release/ | |
| tar -czvf platform-${{ github.ref_name }}-linux-x86_64.tar.gz -C release . | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| files: platform-${{ github.ref_name }}-linux-x86_64.tar.gz | |
| generate_release_notes: true |