-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (65 loc) · 2.24 KB
/
code-quality.yml
File metadata and controls
75 lines (65 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
name: Code Quality Metrics
"on":
pull_request:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
jobs:
metrics:
name: Collect Code Quality Metrics
runs-on: ubuntu-latest
steps:
- name: Checkout repository
# v6.0.2
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Install Rust toolchain
# master
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: stable
- name: Install analysis tools
# v2.67.18
uses: taiki-e/install-action@d0f23220b09a75c6db730f13bb37c4f8144b4382
with:
tool: cargo-geiger,cargo-bloat
- name: Cache cargo registry
# v5.0.3
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-metrics-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-metrics-
- name: Scan for unsafe code
run: |
echo "## Unsafe Code Analysis" > metrics-report.md
echo '```' >> metrics-report.md
cargo geiger --all-features >> metrics-report.md || true
echo '```' >> metrics-report.md
echo "" >> metrics-report.md
- name: Analyze binary size
run: |
cargo build --release
echo "## Binary Size Analysis" >> metrics-report.md
echo '```' >> metrics-report.md
cargo bloat --release --crates >> metrics-report.md
echo '```' >> metrics-report.md
echo "" >> metrics-report.md
- name: Check documentation coverage
run: |
echo "## Documentation Coverage" >> metrics-report.md
echo '```' >> metrics-report.md
cargo doc --no-deps --all-features 2>&1 | grep -E "Documenting|warning" >> metrics-report.md || true
echo '```' >> metrics-report.md
- name: Upload metrics report
# v4.6.2
uses: actions/upload-artifact@47309c993abb98030a35d55ef7ff34b7fa1074b5
with:
name: code-quality-metrics
path: metrics-report.md
retention-days: 30