Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/coverage-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Coverage (main)

# CodeScene accepts `cs-coverage upload` only for analysed branches, so
# main-branch coverage is uploaded here on push; pull requests only
# generate coverage in coverage.yml (the changed-line gate is deferred
# until CodeScene enables the coverage-gates configuration for project
# 70277 — see the comment in coverage.yml). This workflow also advances
# the coverage ratchet baseline: caches saved on main are readable by
# every pull-request run, so the baseline written here is the one PR
# ratchet checks compare against.
#
# workflow_dispatch lets the upload be re-run on demand: merges
# performed by the automerge workflow's GITHUB_TOKEN do not fire
# push-event workflows, so automerged changes to main only get coverage
# via a manual dispatch.

on:
push:
branches: [main]
workflow_dispatch:

jobs:
coverage-upload:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
CS_ACCESS_TOKEN: ${{ secrets.CS_ACCESS_TOKEN }}
CODESCENE_CLI_SHA256: ${{ vars.CODESCENE_CLI_SHA256 }}
steps:
- uses: actions/checkout@v5
- name: Setup Rust
uses: leynos/shared-actions/.github/actions/setup-rust@927edd45ae77be4251a8a18ca9eb5613a2e32cbd
- name: Generate coverage
uses: leynos/shared-actions/.github/actions/generate-coverage@927edd45ae77be4251a8a18ca9eb5613a2e32cbd
with:
output-path: lcov.info
format: lcov
use-cargo-nextest: 'false'
with-ratchet: 'true'
- name: Upload coverage data to CodeScene
if: ${{ env.CS_ACCESS_TOKEN != '' }}
uses: leynos/shared-actions/.github/actions/upload-codescene-coverage@927edd45ae77be4251a8a18ca9eb5613a2e32cbd
with:
format: lcov
access-token: ${{ env.CS_ACCESS_TOKEN }}
installer-checksum: ${{ vars.CODESCENE_CLI_SHA256 }}
30 changes: 20 additions & 10 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,34 @@ jobs:
CODESCENE_CLI_SHA256: ${{ vars.CODESCENE_CLI_SHA256 }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Rust
uses: leynos/shared-actions/.github/actions/setup-rust@69f9c29d18a28b6bdf4b02dcd743ef416817ba18
uses: leynos/shared-actions/.github/actions/setup-rust@927edd45ae77be4251a8a18ca9eb5613a2e32cbd
- name: Format
run: make check-fmt
- name: Lint
run: make lint
- name: Generate coverage
uses: leynos/shared-actions/.github/actions/generate-coverage@69f9c29d18a28b6bdf4b02dcd743ef416817ba18
uses: leynos/shared-actions/.github/actions/generate-coverage@927edd45ae77be4251a8a18ca9eb5613a2e32cbd
with:
output-path: lcov.info
format: lcov
- name: Upload coverage data to CodeScene
if: ${{ env.CS_ACCESS_TOKEN != '' }}
uses: leynos/shared-actions/.github/actions/upload-codescene-coverage@69f9c29d18a28b6bdf4b02dcd743ef416817ba18
with:
format: lcov
access-token: ${{ env.CS_ACCESS_TOKEN }}
installer-checksum: ${{ vars.CODESCENE_CLI_SHA256 }}
use-cargo-nextest: 'false'
with-ratchet: 'true'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fix the ratchet cache key before relying on it

When a PR runs after coverage-main has uploaded a new baseline, this ratchet still starts from 0: the pinned generate-coverage action restores ratchet-baseline-${{ runner.os }}-${{ github.run_id }} with restore prefix ratchet-baseline-${{ runner.os }}-, but saves the updated baseline as ratchet-baseline-${{ runner.os }}. Since that saved key is not prefixed by either lookup key, the main baseline is never restored here, so coverage drops below the intended baseline will pass silently even with with-ratchet enabled.

Useful? React with 👍 / 👎.

# The `mode: check` step is deliberately not wired in yet: CodeScene
# project 70277 has no coverage-gates configuration, so
# `cs-coverage check` would fail every run with "HTTP call
# succeeded, but the received project-config isn't valid. Lacks the
# gates configuration." — a CodeScene-side per-project setting, not
# a CI defect (see ddlint#287 and chutoro#156, which hit the
# byte-identical error). Add the check step in a fast-follow PR
# once coverage-main.yml has uploaded to main at least once and the
# gate is confirmed to resolve, or once CodeScene confirms the
# project's coverage gate is enabled. `cs-coverage upload` is not
# run here either: CodeScene only accepts uploads for branches it
# analyses (main), so uploading from a pull-request head fails;
# main-branch coverage is uploaded by coverage-main.yml instead.

# Exercise the experimental REST-based resolve path, ensuring lints and tests
# pass when the `unstable-rest-resolve` feature is enabled.
Expand All @@ -39,7 +49,7 @@ jobs:
steps:
- uses: actions/checkout@v5
- name: Setup Rust
uses: leynos/shared-actions/.github/actions/setup-rust@69f9c29d18a28b6bdf4b02dcd743ef416817ba18
uses: leynos/shared-actions/.github/actions/setup-rust@927edd45ae77be4251a8a18ca9eb5613a2e32cbd
- name: Install OpenSSL
run: sudo apt-get update && sudo apt-get install -y openssl ca-certificates
- name: Lint (feature-gated)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
fi
echo "Release tag $tag matches Cargo.toml version."
- name: Setup Rust
uses: leynos/shared-actions/.github/actions/setup-rust@69f9c29d18a28b6bdf4b02dcd743ef416817ba18
uses: leynos/shared-actions/.github/actions/setup-rust@927edd45ae77be4251a8a18ca9eb5613a2e32cbd
- name: Add Rust target
run: rustup target add ${{ matrix.target }}
- name: Install AArch64 linker
Expand Down
Loading