Files
aitbc/.gitea/workflows/contract-benchmarks.yml
aitbc dcc08e7569 Migrate contracts directory from npm to pnpm
- Delete package-lock.json and create pnpm-lock.yaml
- Add .npmrc with strict peer deps and frozen lockfile settings
- Update CI workflows to use pnpm instead of npm
- Update shell scripts to use pnpm instead of npm/npx
- Update documentation to reference pnpm commands
- Validate migration with successful hardhat compile
2026-05-22 22:28:32 +02:00

248 lines
7.1 KiB
YAML

name: Contract Performance Benchmarks
on:
push:
branches: [main, develop]
paths:
- 'contracts/**'
- 'scripts/benchmarking/**'
- '.gitea/workflows/contract-benchmarks.yml'
pull_request:
branches: [main, develop]
workflow_dispatch:
inputs:
benchmark_type:
description: 'Type of benchmark to run'
required: false
default: 'all'
type: choice
options:
- all
- gas-usage
- execution-time
- throughput
concurrency:
group: contract-benchmarks-${{ github.ref }}
cancel-in-progress: true
jobs:
benchmark-gas-usage:
runs-on: debian
timeout-minutes: 30
env:
WORKSPACE: /var/lib/aitbc-workspaces/gas-benchmarks
steps:
- name: Clone repository
run: |
rm -rf "${{ env.WORKSPACE }}"
mkdir -p "${{ env.WORKSPACE }}"
cd "${{ env.WORKSPACE }}"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Initialize job logging
run: |
cd "${{ env.WORKSPACE }}/repo"
bash scripts/ci/setup-job-logging.sh
- name: Setup Node.js environment
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
pnpm install
echo "✅ Node.js environment ready"
- name: Run gas usage benchmarks
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
echo "🧪 Running gas usage benchmarks"
# Run benchmarks (gas reporting will be added when tests are implemented)
pnpm hardhat test test/benchmarks/gas-usage.test.js
echo "✅ Gas usage benchmarks completed"
- name: Upload gas report
run: |
cd "${{ env.WORKSPACE }}/repo"
echo "📊 Gas report upload skipped (reports will be added when tests are implemented)"
# Save report to artifacts directory (placeholder)
mkdir -p /var/lib/aitbc/benchmarks
echo "Gas report placeholder - $(date)" > /var/lib/aitbc/benchmarks/gas-report-placeholder-$(date +%Y%m%d-%H%M%S).txt
echo "✅ Gas report placeholder uploaded"
- name: Cleanup
if: always()
run: rm -rf "${{ env.WORKSPACE }}"
benchmark-execution-time:
runs-on: debian
timeout-minutes: 30
env:
WORKSPACE: /var/lib/aitbc-workspaces/execution-benchmarks
steps:
- name: Clone repository
run: |
rm -rf "${{ env.WORKSPACE }}"
mkdir -p "${{ env.WORKSPACE }}"
cd "${{ env.WORKSPACE }}"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Initialize job logging
run: |
cd "${{ env.WORKSPACE }}/repo"
bash scripts/ci/setup-job-logging.sh
- name: Setup Node.js environment
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
pnpm install
echo "✅ Node.js environment ready"
- name: Run execution time benchmarks
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
echo "🧪 Running execution time benchmarks"
pnpm hardhat test test/benchmarks/execution-time.test.js
echo "✅ Execution time benchmarks completed"
- name: Upload execution time report
run: |
cd "${{ env.WORKSPACE }}/repo"
echo "📊 Execution time report upload skipped (reports will be added when tests are implemented)"
mkdir -p /var/lib/aitbc/benchmarks
echo "Execution time report placeholder - $(date)" > /var/lib/aitbc/benchmarks/execution-time-placeholder-$(date +%Y%m%d-%H%M%S).json
echo "✅ Execution time report placeholder uploaded"
- name: Cleanup
if: always()
run: rm -rf "${{ env.WORKSPACE }}"
benchmark-throughput:
runs-on: debian
timeout-minutes: 30
env:
WORKSPACE: /var/lib/aitbc-workspaces/throughput-benchmarks
steps:
- name: Clone repository
run: |
rm -rf "${{ env.WORKSPACE }}"
mkdir -p "${{ env.WORKSPACE }}"
cd "${{ env.WORKSPACE }}"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Initialize job logging
run: |
cd "${{ env.WORKSPACE }}/repo"
bash scripts/ci/setup-job-logging.sh
- name: Setup Node.js environment
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
pnpm install
echo "✅ Node.js environment ready"
- name: Run throughput benchmarks
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
echo "🧪 Running throughput benchmarks"
pnpm hardhat test test/benchmarks/throughput.test.js
echo "✅ Throughput benchmarks completed"
- name: Upload throughput report
run: |
cd "${{ env.WORKSPACE }}/repo"
echo "📊 Throughput report upload skipped (reports will be added when tests are implemented)"
mkdir -p /var/lib/aitbc/benchmarks
echo "Throughput report placeholder - $(date)" > /var/lib/aitbc/benchmarks/throughput-placeholder-$(date +%Y%m%d-%H%M%S).json
echo "✅ Throughput report placeholder uploaded"
- name: Cleanup
if: always()
run: rm -rf "${{ env.WORKSPACE }}"
compare-benchmarks:
runs-on: debian
timeout-minutes: 15
needs: [benchmark-gas-usage, benchmark-execution-time, benchmark-throughput]
env:
WORKSPACE: /var/lib/aitbc-workspaces/benchmark-comparison
steps:
- name: Clone repository
run: |
rm -rf "${{ env.WORKSPACE }}"
mkdir -p "${{ env.WORKSPACE }}"
cd "${{ env.WORKSPACE }}"
git clone --depth 1 http://gitea.bubuit.net:3000/oib/aitbc.git repo
- name: Initialize job logging
run: |
cd "${{ env.WORKSPACE }}/repo"
bash scripts/ci/setup-job-logging.sh
- name: Compare with previous benchmarks
run: |
cd "${{ env.WORKSPACE }}/repo"
echo "📊 Comparing benchmark results"
# Run comparison script
bash scripts/benchmarking/compare-benchmarks.sh
echo "✅ Benchmark comparison completed"
- name: Generate benchmark report
run: |
cd "${{ env.WORKSPACE }}/repo"
echo "📝 Generating benchmark report"
bash scripts/benchmarking/generate-report.sh
echo "✅ Benchmark report generated"
- name: Cleanup
if: always()
run: rm -rf "${{ env.WORKSPACE }}"