Skip to content

Merge pull request #562 from DevMuhdishaq/main #652

Merge pull request #562 from DevMuhdishaq/main

Merge pull request #562 from DevMuhdishaq/main #652

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
env:
CARGO_TERM_COLOR: always
jobs:
format:
name: Format Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
clippy:
name: Clippy Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
${{ runner.os }}-cargo-
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings -D nonstandard-style
build:
name: Build Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
${{ runner.os }}-cargo-
- name: Build release version
run: cargo build --workspace --release --verbose
- name: Check binary sizes
run: |
find target/release -name "streller-cli" -exec ls -lh {} \; || true
find target/release -name "*.wasm" -exec ls -lh {} \; || true
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-test-
${{ runner.os }}-cargo-
- name: Run unit tests
run: cargo test --workspace --exclude e2e-tests --verbose
coverage:
name: Contract Coverage Gate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-coverage-
${{ runner.os }}-cargo-
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run 95% coverage gate
run: ./scripts/test-coverage.sh --gate 95 --lcov
- name: Upload coverage reports
uses: actions/upload-artifact@v4
if: always()
with:
name: contract-coverage
path: |
target/coverage/
target/coverage-reports/
performance:
name: Performance Regression
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Make scripts executable
run: chmod +x scripts/*.sh
- name: Run performance profile
run: ./scripts/perf_profile.sh --report target/perf_report.json
- name: Upload performance report
uses: actions/upload-artifact@v4
with:
name: perf-report
path: target/perf_report.json
load-testing:
name: Load Testing
runs-on: ubuntu-latest
env:
STRELLER_PEAK_LOAD: 5
STRELLER_LOAD_MULTIPLIER: 10
STRELLER_STUDENT_POOL: 20
STRELLER_COURSE_COUNT: 4
STRELLER_READ_MULTIPLIER: 2
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-load-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-load-
${{ runner.os }}-cargo-
- name: Make scripts executable
run: chmod +x scripts/*.sh
- name: Run bounded load test suite
run: ./scripts/load_test.sh --ci --report target/load-test-report.json --summary target/load-test-summary.md
- name: Upload load test artifacts
uses: actions/upload-artifact@v4
with:
name: load-test-report
path: |
target/load-test-report.json
target/load-test-summary.md
visual-regression:
name: Visual Regression
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps
- name: Run visual regression tests
run: npm run visual:test
- name: Upload visual diff report
if: always()
uses: actions/upload-artifact@v4
with:
name: visual-regression-report
path: |
visual-tests/playwright-report
visual-tests/test-results
visual-tests/tests/__screenshots__
accessibility:
name: Accessibility (WCAG AA)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Run accessibility tests
run: npm run a11y:test
- name: Upload accessibility report
if: always()
uses: actions/upload-artifact@v4
with:
name: accessibility-report
path: |
visual-tests/accessibility-report/
visual-tests/accessibility-reports/
ci-success:
name: CI Success
runs-on: ubuntu-latest
needs: [format, clippy, build, test, coverage, performance, visual-regression]
if: always()
steps:
- name: Check all jobs
run: |
if [[ "${{ needs.format.result }}" != "success" || \
"${{ needs.clippy.result }}" != "success" || \
"${{ needs.build.result }}" != "success" || \
"${{ needs.test.result }}" != "success" || \
"${{ needs.coverage.result }}" != "success" || \
"${{ needs.performance.result }}" != "success" || \
"${{ needs.visual-regression.result }}" != "success" || \
"${{ needs.accessibility.result }}" != "success" ]]; then
echo "One or more CI jobs failed"
echo "Format: ${{ needs.format.result }}"
echo "Clippy: ${{ needs.clippy.result }}"
echo "Build: ${{ needs.build.result }}"
echo "Test: ${{ needs.test.result }}"
echo "Coverage: ${{ needs.coverage.result }}"
echo "Performance: ${{ needs.performance.result }}"
echo "Load Testing: ${{ needs.load-testing.result }}"
echo "Visual Regression: ${{ needs.visual-regression.result }}"
echo "Accessibility: ${{ needs.accessibility.result }}"
exit 1
fi
echo "✅ All CI jobs passed successfully"
echo "🎉 Project is ready for deployment!"