From 5d0548ab784f4c84e5f405a78bd9fc5088b9c34f Mon Sep 17 00:00:00 2001 From: Kinflou Date: Sun, 8 Nov 2026 15:41:14 +0800 Subject: [PATCH 1/2] ci: Observatory report workflow --- .github/reports-branch.md | 13 ++++ .github/workflows/reports.yml | 108 ++++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 .github/reports-branch.md create mode 100644 .github/workflows/reports.yml diff --git a/.github/reports-branch.md b/.github/reports-branch.md new file mode 100644 index 0000000..492f472 --- /dev/null +++ b/.github/reports-branch.md @@ -0,0 +1,13 @@ +# Published reports + +This branch is written by CI only; don't push to it by hand. It holds the +latest reports of `main`, which the Observatory reads: + +- `cli.size.json`: byte and gzip size of the release `comline` binary. +- `cli.coverage.json`: line and function coverage per crate. +- `cli.compile.json`: a clean release build's seconds per crate. + +All three come from `.github/workflows/reports.yml` on every push to `main`; +the formats are the Observatory's `DATA.md` (`size`, `coverage`, `compile`). +Each report names the `main` commit it measured. Every publish is one commit +here, so `git log -- cli.size.json` is the series. diff --git a/.github/workflows/reports.yml b/.github/workflows/reports.yml new file mode 100644 index 0000000..e046f51 --- /dev/null +++ b/.github/workflows/reports.yml @@ -0,0 +1,108 @@ +name: Reports + +# Observatory reports: size, coverage and compile time of the CLI. +# Each job writes one JSON report and uploads it; the `publish` job commits +# them all to the `reports` branch, only from `main` or a manual run. On a +# pull request everything runs except the publish, so the workflow is proven +# before it merges. + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: reports-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + +jobs: + size: + name: size + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-wasip1 + - uses: Swatinem/rust-cache@v2 + - id: rustc + run: echo "version=$(rustc --version)" >> "$GITHUB_OUTPUT" + - name: Build + run: | + cargo build --locked --release + - uses: ComlineProject/observatory/.github/actions/report-size@v1 + with: + output: reports/cli.size.json + toolchain: ${{ steps.rustc.outputs.version }} + artifacts: | + cli/x86_64-linux-release=target/release/comline + - uses: actions/upload-artifact@v7 + with: + name: report-size + path: reports/cli.size.json + if-no-files-found: error + + coverage: + name: coverage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-wasip1 + - uses: Swatinem/rust-cache@v2 + - uses: ComlineProject/observatory/.github/actions/report-rust-coverage@v1 + with: + output: reports/cli.coverage.json + args: --workspace + - uses: actions/upload-artifact@v7 + with: + name: report-coverage + path: reports/cli.coverage.json + if-no-files-found: error + + compile: + name: compile time + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - uses: dtolnay/rust-toolchain@stable + with: + targets: wasm32-wasip1 + - uses: ComlineProject/observatory/.github/actions/report-rust-compile@v1 + with: + output: reports/cli.compile.json + args: --release + - uses: actions/upload-artifact@v7 + with: + name: report-compile + path: reports/cli.compile.json + if-no-files-found: error + + publish: + name: publish + needs: [size, coverage, compile] + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - uses: actions/download-artifact@v8 + with: + pattern: report-* + path: reports + merge-multiple: true + - uses: ComlineProject/observatory/.github/actions/publish-report@v1 + with: + reports: reports/cli.size.json reports/cli.coverage.json reports/cli.compile.json + readme: .github/reports-branch.md From 9eafd28609c2572bff03176eb768705fc3299afa Mon Sep 17 00:00:00 2001 From: Kinflou Date: Sun, 8 Nov 2026 15:48:52 +0800 Subject: [PATCH 2/2] ci: compile report args with a space (argparse reads a lone --release as a flag) --- .github/workflows/reports.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reports.yml b/.github/workflows/reports.yml index e046f51..e919457 100644 --- a/.github/workflows/reports.yml +++ b/.github/workflows/reports.yml @@ -79,7 +79,7 @@ jobs: - uses: ComlineProject/observatory/.github/actions/report-rust-compile@v1 with: output: reports/cli.compile.json - args: --release + args: --workspace --release - uses: actions/upload-artifact@v7 with: name: report-compile