Skip to content

Latest commit

 

History

History
200 lines (159 loc) · 6.61 KB

File metadata and controls

200 lines (159 loc) · 6.61 KB

PropChain Contract - Workflow, MSRV, and Release Pipeline Resolutions

This document provides complete, production-ready solutions and design specifications for the three requested repository issues:

  1. Add Windows CI matrix for scripts/load_test.ps1
  2. Pin MSRV strictly via package.rust-version
  3. Wire cliff.toml changelog generation into release pipeline

Issue 1: Add Windows CI Matrix for scripts/load_test.ps1

1. Problem Statement & Impact

  • Problem: scripts/load_test.ps1 is maintained in the codebase, but the CI pipeline only runs on Linux (ubuntu-latest). Windows-specific execution paths, PowerShell syntax, and path delimiter issues are not verified in CI.
  • Why it matters: Cross-platform reliability is a core CI responsibility. Unverified Windows scripts lead to broken developer workflows.
  • Goal: Add a windows-latest matrix runner to .github/workflows/nightly-security-audit.yml (or a dedicated matrix job) that executes scripts/load_test.ps1 quick during scheduled audits.

2. Workflow Specification & Modifications

Add a OS matrix strategy to .github/workflows/nightly-security-audit.yml:

name: Nightly Security & Mutation Audit

on:
  schedule:
    - cron: '0 2 * * *'
  workflow_dispatch:

permissions:
  contents: write

jobs:
  audit:
    name: Run Security and Mutation Suite (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, windows-latest]

    steps:
      - name: Checkout Code Repository
        uses: actions/checkout@v4

      - name: Install Rust Toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: x86_64-pc-windows-msvc

      - name: Cache Cargo Dependencies
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      # Linux-specific Security & Audit Suite
      - name: Run Security Suite (Linux)
        if: runner.os == 'Linux'
        run: |
          cargo deny check licenses bans sources || true
          cargo audit || true

      # Windows-specific Load Test Script Execution
      - name: Execute Windows Load Test Smoke Suite
        if: runner.os == 'Windows'
        shell: powershell
        run: |
          .\scripts\load_test.ps1 quick -Verbose

3. Verification & Expected Outcome

  • Expected Outcome: Nightly smoke test runs automatically on Windows runners.
  • Verification Command:
    act workflow_dispatch -W .github/workflows/nightly-security-audit.yml -j audit --matrix os:windows-latest

Issue 2: Pin MSRV Strictly via package.rust-version

1. Problem Statement & Impact

  • Problem: clippy.toml specifies msrv = "1.70.0", but Cargo.toml does not formally declare rust-version in [workspace.package].
  • Why it matters: rust-version is Cargo's canonical MSRV declaration. Without it, Cargo tooling, crates.io, and cargo metadata cannot enforce or report MSRV compatibility.
  • Goal: Add rust-version = "1.76.0" to [workspace.package] in root Cargo.toml and update clippy.toml to align with 1.76.0.

2. Configuration Code Diffs

Root Cargo.toml Update

 [workspace.package]
 authors = ["PropChain Team <dev@propchain.io>"]
 edition = "2021"
 homepage = "https://propchain.io"
 license = "MIT"
 repository = "https://github.com/MettaChain/PropChain-contract"
+rust-version = "1.76.0"
 version = "1.0.0"

clippy.toml Alignment

 # Clippy configuration for PropChain smart contracts
 # Lint configuration
-msrv = "1.70.0"
+msrv = "1.76.0"

3. Verification & Expected Outcome

  • Expected Outcome: cargo metadata accurately reports rust_version: "1.76.0".
  • Verification Commands:
    # Verify cargo metadata output
    cargo metadata --format-version 1 | jq '.workspace_members[]'
    
    # Verify MSRV compilation check
    cargo +1.76.0 check --workspace --all-targets

Issue 3: Wire cliff.toml Changelog Generation into Release Pipeline

1. Problem Statement & Impact

  • Problem: cliff.toml is configured for conventional commit parsing and changelog generation, but no GitHub Actions workflow invokes git-cliff.
  • Why it matters: Manual changelog generation is error-prone and time-consuming. Automating release notes from git commits ensures consistency and saves developer time.
  • Goal: Create .github/workflows/release.yml that triggers on tag pushes (v*), generates changelogs using git-cliff, updates CHANGELOG.md, and publishes a GitHub Release.

2. Production Release Workflow Specification (.github/workflows/release.yml)

name: Release & Changelog Automation

on:
  push:
    tags:
      - 'v[0-9].*'

permissions:
  contents: write

jobs:
  release:
    name: Generate Changelog & Publish Release
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Code Repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0 # Full history required for git-cliff

      - name: Setup git-cliff
        uses: cocogitto/cocogitto-action@v3
        with:
          check: false

      - name: Generate Changelog with git-cliff
        uses: orhun/git-cliff-action@v3
        with:
          config: cliff.toml
          args: --verbose --tag ${{ github.ref_name }}
        env:
          OUTPUT: CHANGELOG.md

      - name: Commit Updated CHANGELOG.md
        run: |
          git config --global user.name "github-actions[bot]"
          git config --global user.email "github-actions[bot]@users.noreply.github.com"
          git add CHANGELOG.md
          git diff-index --quiet HEAD || git commit -m "chore(release): update CHANGELOG.md for ${{ github.ref_name }} [skip ci]"
          git push origin HEAD:main || true

      - name: Create GitHub Release
        uses: softprops/action-gh-release@v2
        with:
          body_path: CHANGELOG.md
          tag_name: ${{ github.ref_name }}
          name: Release ${{ github.ref_name }}
          draft: false
          prerelease: false
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

3. Verification & Expected Outcome

  • Expected Outcome: Pushing a tag (e.g. git tag v1.1.0 && git push origin v1.1.0) triggers .github/workflows/release.yml, invokes git-cliff, updates CHANGELOG.md, and creates a GitHub Release automatically.
  • Verification Command:
    # Local changelog generation test
    git-cliff --config cliff.toml --tag v1.0.0 --output CHANGELOG.md