feat: metrics/log schema for latency, cache, and registry errors (#24) #24
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: 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 | |
| # Zensical replaces mkdocs + mkdocs-material as a drop-in. | |
| # Reason: https://squidfunk.github.io/mkdocs-material/blog/2026/02/18/mkdocs-2.0/ | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install zensical | |
| - name: Build docs | |
| run: zensical 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 |