name: Coverage on: schedule: - cron: "11 3 * * 6" workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: contents: read env: CARGO_TERM_COLOR: always jobs: coverage: name: Coverage (Rust, TypeScript) runs-on: ubuntu-latest timeout-minutes: 30 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: $/.github/actions/rust with: components: llvm-tools-preview cache-key: coverage - uses: taiki-e/install-action@ab49d3c64680143e184118bed66a46419fc15519 # v2.90.5 with: tool: cargo-llvm-cov - uses: $/.github/actions/pnpm - name: Rust run: | cargo llvm-cov --workspace --all-features --locked --no-report mkdir -p target/coverage cargo llvm-cov report --lcov --output-path target/coverage/rust.lcov cargo llvm-cov report --html --output-dir target/coverage/rust cargo llvm-cov report --summary-only > target/coverage/rust.txt - name: TypeScript run: pnpm coverage:ts - name: Summary if: always() run: | { echo "### Rust (\`cargo llvm-cov\`)" echo echo '```text' cat target/coverage/rust.txt 2>/dev/null || echo "no report" echo '```' echo echo "### TypeScript (vitest, V8), packages/ferrovue/src" echo node -e ' const fs = require("node:fs"); const file = "target/coverage/ts/coverage-summary.json"; if (!fs.existsSync(file)) { console.log("no report"); process.exit(0); } const { total } = JSON.parse(fs.readFileSync(file, "utf8")); console.log("| | Covered | Total | % |\n|---|---:|---:|---:|"); for (const k of ["lines", "statements", "functions", "branches"]) console.log(`| ${k} | ${total[k].covered} | ${total[k].total} | ${total[k].pct}% |`); ' } >> "$GITHUB_STEP_SUMMARY" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 if: always() with: name: coverage path: target/coverage/ if-no-files-found: warn