Skip to content

Commit b011490

Browse files
authored
Merge pull request #74 from Samuel1505/contribution/quality
Implement contribution quality assurance system
2 parents ecc3345 + e8617b1 commit b011490

6 files changed

Lines changed: 153 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
1. Go to '...'
15+
2. Click on '...'
16+
3. Scroll down to '...'
17+
4. See error
18+
19+
**Expected behavior**
20+
A clear and concise description of what you expected to happen.
21+
22+
**Screenshots**
23+
If applicable, add screenshots to help explain your problem.
24+
25+
**Environment (please complete the following information):**
26+
- OS: [e.g. Linux]
27+
- Rust Version: [e.g. 1.75.0]
28+
- Soroban CLI Version: [e.g. 20.0.0]
29+
30+
**Additional context**
31+
Add any other context about the problem here.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
**Is your feature request related to a problem? Please describe.**
10+
A clear and concise description of what the problem is. Ex: I'm always frustrated when [...]
11+
12+
**Describe the solution you'd like**
13+
A clear and concise description of what you want to happen.
14+
15+
**Describe alternatives you've considered**
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
18+
**Additional context**
19+
Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Description
2+
3+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
4+
5+
Fixes # (issue)
6+
7+
## Type of change
8+
9+
- [ ] Bug fix (non-breaking change which fixes an issue)
10+
- [ ] New feature (non-breaking change which adds functionality)
11+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12+
- [ ] Documentation update
13+
14+
# How Has This Been Tested?
15+
16+
Please describe the tests that you ran to verify your changes.
17+
18+
- [ ] Unit Test
19+
- [ ] Integration Test
20+
- [ ] Manual Test
21+
22+
# Checklist:
23+
24+
- [ ] My code follows the style guidelines of this project
25+
- [ ] I have performed a self-review of my own code
26+
- [ ] I have commented my code, particularly in hard-to-understand areas
27+
- [ ] I have made corresponding changes to the documentation
28+
- [ ] My changes generate no new warnings
29+
- [ ] I have added tests that prove my fix is effective or that my feature works
30+
- [ ] New and existing unit tests pass locally with my changes

.github/workflows/benchmark.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Benchmark
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
benchmark:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
13+
- name: Install Rust toolchain
14+
uses: dtolnay/rust-toolchain@stable
15+
with:
16+
targets: wasm32-unknown-unknown
17+
18+
- name: Cache cargo
19+
uses: Swatinem/rust-cache@v2
20+
21+
- name: Install Soroban CLI
22+
run: cargo install --locked stellar-cli --features opt
23+
24+
- name: Build Contract
25+
run: cargo build --target wasm32-unknown-unknown --release -p teachlink-contract
26+
27+
- name: Run Benchmarks
28+
run: ./scripts/benchmark.sh

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ jobs:
3131

3232
- name: Build WASM (release)
3333
run: cargo build --target wasm32-unknown-unknown --release
34+
35+
- name: Docs
36+
run: cargo doc --no-deps --document-private-items
37+

scripts/benchmark.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Benchmark Script for TeachLink Contract
5+
6+
echo "Starting Benchmark..."
7+
8+
# 1. Build the Contract
9+
echo "Building contract in release mode..."
10+
cargo build --release --target wasm32-unknown-unknown -p teachlink-contract
11+
12+
# 2. Check WASM Size
13+
WASM_PATH="target/wasm32-unknown-unknown/release/teachlink_contract.wasm"
14+
if [ -f "$WASM_PATH" ]; then
15+
SIZE=$(du -h "$WASM_PATH" | cut -f1)
16+
echo "WASM Size: $SIZE"
17+
18+
# Optional: Check against a limit (e.g., 300KB)
19+
SIZE_BYTES=$(stat -c%s "$WASM_PATH")
20+
if [ "$SIZE_BYTES" -gt 307200 ]; then
21+
echo "WARNING: WASM size exceeds 300KB!"
22+
else
23+
echo "WASM size is within limits."
24+
fi
25+
else
26+
echo "Error: WASM file not found at $WASM_PATH"
27+
exit 1
28+
fi
29+
30+
# 3. Run Tests (Performance Check)
31+
echo "Running unit tests..."
32+
start_time=$(date +%s%N)
33+
cargo test --release
34+
end_time=$(date +%s%N)
35+
36+
duration=$((end_time - start_time))
37+
duration_ms=$((duration / 1000000))
38+
39+
echo "Tests completed in ${duration_ms} ms"
40+
41+
echo "Benchmark Complete."

0 commit comments

Comments
 (0)