Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,11 @@ jobs:

- name: Check dependencies
run: cargo deny check

- name: Check Documentation
run: |
chmod +x scripts/doc.sh
./scripts/doc.sh

- name: Lint Documentation (Missing Docs)
run: cargo clippy -- -D missing-docs
57 changes: 41 additions & 16 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ jobs:
"$CLIPPY_CHECK" == "true" && \
"$TEST_CHECK" == "true" && \
"$BUILD_DEBUG_CHECK" == "true" && \
"$BUILD_WASM_CHECK" == "true" ]]; then
"$BUILD_WASM_CHECK" == "true" && \
"$DOCS_CHECK" == "true" ]]; then
echo "βœ… All required checks passed!"
echo "can-merge=true" >> $GITHUB_OUTPUT
else
echo "can-merge=false" >> $GITHUB_OUTPUT
Expand All @@ -175,20 +177,39 @@ jobs:
with:
script: |
const canMerge = '${{ steps.check-results.outputs.can-merge }}' === 'true';
const comment = [
'## PR Validation Results',
'',
canMerge ? 'All required checks passed.' : 'Some required checks failed.',
'',
`- Code Formatting: ${{ steps.fmt-check.outputs.fmt_check == 'true' ? 'passed' : 'failed' }}`,
`- Clippy Lints: ${{ steps.clippy-check.outputs.clippy_check == 'true' ? 'passed' : 'failed' }}`,
`- Unit Tests: ${{ steps.test-check.outputs.test_check == 'true' ? 'passed' : 'failed' }}`,
`- Debug Build: ${{ steps.build-debug-check.outputs.build_debug_check == 'true' ? 'passed' : 'failed' }}`,
`- WASM Release Build: ${{ steps.build-wasm-check.outputs.build_wasm_check == 'true' ? 'passed' : 'failed' }}`,
`- Documentation: ${{ steps.docs-check.outputs.docs_check == 'true' ? 'passed' : 'failed' }}`,
`- Security Audit: ${{ steps.security-check.outputs.security_check == 'true' ? 'passed' : 'issues found' }}`,
`- Duplicate Dependencies: ${{ steps.duplicate-check.outputs.duplicate_check == 'true' ? 'passed' : 'issues found' }}`
].join('\n');

const comment = `
## πŸ€– PR Validation Results

${canMerge ? 'βœ… **This PR is ready to merge!**' : '❌ **This PR is not ready to merge yet.**'}

### πŸ“‹ Required Checks:
- **Code Formatting**: ${{ steps.fmt-check.outputs.fmt_check == 'true' && 'βœ… Passed' || '❌ Failed' }}
- **Clippy Lints**: ${{ steps.clippy-check.outputs.clippy_check == 'true' && 'βœ… Passed' || '❌ Failed' }}
- **Unit Tests**: ${{ steps.test-check.outputs.test_check == 'true' && 'βœ… Passed' || '❌ Failed' }}
- **Debug Build**: ${{ steps.build-debug-check.outputs.build_debug_check == 'true' && 'βœ… Passed' || '❌ Failed' }}
- **WASM Release Build**: ${{ steps.build-wasm-check.outputs.build_wasm_check == 'true' && 'βœ… Passed' || '❌ Failed' }}
- **Documentation**: ${{ steps.docs-check.outputs.docs_check == 'true' && 'βœ… Passed' || '❌ Failed' }}

### πŸ“š Optional Checks:
- **Security Audit**: ${{ steps.security-check.outputs.security_check == 'true' && 'βœ… Passed' || '⚠️ Issues Found' }}
- **Duplicate Dependencies**: ${{ steps.duplicate-check.outputs.duplicate_check == 'true' && 'βœ… Passed' || '⚠️ Issues Found' }}

${!canMerge ? `
### πŸ”§ How to Fix:
1. **Code Formatting**: Run \`cargo fmt --all\`
2. **Clippy Lints**: Fix all clippy warnings
3. **Unit Tests**: Make sure all tests pass with \`cargo test --lib\`
4. **Build**: Fix any compilation errors with \`cargo build\` and \`cargo build --target wasm32-unknown-unknown --release\`
5. **Documentation**: Fix any doc errors with \`cargo doc --no-deps\`

Please fix the failing checks and push your changes. The validation will run automatically.
` : ''}

---

πŸ€– *This comment was automatically generated by the PR validation workflow.*
`;

await github.rest.issues.createComment({
issue_number: context.issue.number,
Expand All @@ -197,12 +218,14 @@ jobs:
body: comment
});

# 11. Set PR status
- name: Update PR status
if: always()
uses: actions/github-script@v7
with:
script: |
const canMerge = '${{ steps.check-results.outputs.can-merge }}' === 'true';

await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -213,8 +236,10 @@ jobs:
context: 'pr-validation'
});

# 12. Branch protection enforcement
- name: Enforce branch protection
if: steps.check-results.outputs.can-merge == 'false'
run: |
echo "PR cannot be merged due to failed checks"
echo "🚫 PR cannot be merged due to failed checks"
echo "Please fix all failing checks before this PR can be merged"
exit 1
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resolver = "2"
members = [
"contracts/community",
"contracts/teachlink",
"contracts/insurance",
"contracts/documentation",
]

Expand Down
Loading
Loading