Feature/c #34
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR CI and Merge Restrictions | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
pr_ci_checks: | |
name: PR Checks | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout Code | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
# Step 2: Restrict Source Branch | |
- name: Check Source Branch | |
if: "!startsWith(github.head_ref, 'feature/') && !startsWith(github.head_ref, 'release-please--')" | |
run: | | |
echo "❌ Pull requests to main must come from feature/* or release-please-- branches." | |
exit 1 | |
# Step 3: Lint Commit Messages | |
- name: Lint Commit Messages | |
uses: wagoid/commitlint-github-action@v6 | |
# Step 4: Cache Cargo Dependencies | |
- name: Cache Cargo Registry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-registry- | |
- name: Cache Cargo Build | |
uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-build- | |
# Step 5: Set up Rust Toolchain | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
# Step 6: Run Clippy | |
- name: Run Clippy | |
run: | | |
cargo clippy --all-targets --all-features -- -D warnings | |
# Step 7: Run Tests | |
- name: Run Tests | |
run: cargo test --all-features | |
# Step 8: Check Formatting | |
- name: Check Formatting | |
run: cargo fmt -- --check | |
# Step 9: Run Cargo Audit (Security Checks) | |
- name: Run Cargo Audit | |
run: | | |
cargo install cargo-audit | |
cargo audit --stale | |
# Step 10: Run Cargo Deny (Dependency Checks) | |
- name: Run Cargo Deny | |
run: | | |
cargo install cargo-deny | |
cargo deny check |