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
4 changes: 4 additions & 0 deletions .github/actions/generate-coverage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.3.5

- Fix ratchet step ordering so coverage is checked after Python results are available.

## v1.3.4

- Force reinstall of `cargo-llvm-cov` so cached binaries don't cause the
Expand Down
57 changes: 30 additions & 27 deletions .github/actions/generate-coverage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ runs:
INPUT_FORMAT: ${{ inputs.format }}
shell: bash
- name: Restore baselines
id: restore-baselines
if: inputs.with-ratchet == 'true'
uses: actions/cache@v4
with:
path: |
${{ inputs.baseline-rust-file }}
${{ inputs.baseline-python-file }}
key: ratchet-baseline-${{ runner.os }}
key: ratchet-baseline-${{ runner.os }}-${{ github.run_id }}
restore-keys: ratchet-baseline-${{ runner.os }}-
- name: Ensure baseline files
if: inputs.with-ratchet == 'true'
run: |
Expand Down Expand Up @@ -94,32 +96,6 @@ runs:
INPUT_FEATURES: ${{ inputs.features }}
INPUT_WITH_DEFAULT_FEATURES: ${{ inputs.with-default-features }}
shell: bash
- name: Ratchet coverage
if: inputs.with-ratchet == 'true'
run: |
ratchet() {
uv run --script "${{ github.action_path }}/scripts/ratchet_coverage.py" \
--baseline-file "$1" \
--current "$2"
}

lang="${{ steps.detect.outputs.lang }}"
if [[ "$lang" == "rust" || "$lang" == "mixed" ]]; then
ratchet "${{ inputs.baseline-rust-file }}" "${{ steps.rust.outputs.percent }}"
fi
if [[ "$lang" == "python" || "$lang" == "mixed" ]]; then
ratchet "${{ inputs.baseline-python-file }}" "${{ steps.python.outputs.percent }}"
fi
shell: bash
- name: Save baselines
if: success() && inputs.with-ratchet == 'true'
uses: actions/cache@v4
with:
path: |
${{ inputs.baseline-rust-file }}
${{ inputs.baseline-python-file }}
key: ratchet-baseline-${{ runner.os }}-${{ github.run_id }}
restore-keys: ratchet-baseline-${{ runner.os }}-

- name: Cache Python deps
if: steps.detect.outputs.lang == 'python' || steps.detect.outputs.lang == 'mixed'
Expand Down Expand Up @@ -150,6 +126,33 @@ runs:
PYTHON_FILE: ${{ steps.python.outputs.file }}
OUTPUT_PATH: ${{ inputs.output-path }}
shell: bash
- name: Ratchet coverage
if: inputs.with-ratchet == 'true'
run: |
set -euo pipefail
ratchet() {
uv run --script "${{ github.action_path }}/scripts/ratchet_coverage.py" \
--baseline-file "$1" \
--current "$2"
}

lang="${{ steps.detect.outputs.lang }}"
if [[ "$lang" == "rust" || "$lang" == "mixed" ]]; then
ratchet "${{ inputs.baseline-rust-file }}" "${{ steps.rust.outputs.percent }}"
fi
if [[ "$lang" == "python" || "$lang" == "mixed" ]]; then
ratchet "${{ inputs.baseline-python-file }}" "${{ steps.python.outputs.percent }}"
fi
shell: bash
- name: Save baselines
if: success() && inputs.with-ratchet == 'true' && steps.restore-baselines.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: |
${{ inputs.baseline-rust-file }}
${{ inputs.baseline-python-file }}
key: ratchet-baseline-${{ runner.os }}

- id: out
run: uv run --script "${{ github.action_path }}/scripts/set_outputs.py"
env:
Expand Down