-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (84 loc) · 2.54 KB
/
Copy pathpages.yml
File metadata and controls
99 lines (84 loc) · 2.54 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Deploy GitHub Pages
on:
push:
branches:
- main
- master
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate coverage metric
id: coverage
shell: bash
run: |
set -euo pipefail
cargo llvm-cov --workspace --all-features --lcov --output-path lcov.info
pct=$(awk -F: '
/^LF:/ { lf += $2 }
/^LH:/ { lh += $2 }
END {
if (lf == 0) {
print "0.00"
} else {
printf "%.2f", (lh / lf) * 100
}
}
' lcov.info)
color=$(awk -v p="$pct" 'BEGIN {
if (p >= 90) print "brightgreen";
else if (p >= 80) print "green";
else if (p >= 70) print "yellowgreen";
else if (p >= 60) print "yellow";
else if (p >= 50) print "orange";
else print "red";
}')
echo "line_pct=$pct" >> "$GITHUB_OUTPUT"
echo "color=$color" >> "$GITHUB_OUTPUT"
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install docs dependencies
run: |
python -m pip install --upgrade pip
pip install mkdocs-material
- name: Build docs
run: mkdocs build --strict
- name: Write coverage badge endpoint
shell: bash
run: |
mkdir -p site/badges
cat > site/badges/coverage.json <<EOF
{"schemaVersion":1,"label":"coverage","message":"${{ steps.coverage.outputs.line_pct }}%","color":"${{ steps.coverage.outputs.color }}","cacheSeconds":300}
EOF
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4