Skip to content
Open
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
14 changes: 9 additions & 5 deletions .github/actions/generate-coverage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# Changelog

## v1.1.0 (2025-06-23)
## v1.1.2 (2025-06-25)

- Support Python projects by running `slipcover` when `pyproject.toml` is present.
- Expose `file` and `format` outputs.
- Default coverage format changed to `cobertura`.
- Fail fast if both `Cargo.toml` and `pyproject.toml` exist.
- Merge detection and validation into a single step and track the language in the `LANG_DETECTED` environment variable.

## v1.1.1 (2025-06-24)

- Automatically install `slipcover` and `pytest` using `setup-uv` when running
Python coverage.

## v1.1.0 (2025-06-23)

- Support Python projects by running `slipcover` when `pyproject.toml` is present.
- Expose `file` and `format` outputs.
- Default coverage format changed to `cobertura`.
- Fail fast if both `Cargo.toml` and `pyproject.toml` exist.

## v1.0.0 (2025-06-20)

- Initial version using `cargo llvm-cov` for Rust projects.
26 changes: 13 additions & 13 deletions .github/actions/generate-coverage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,22 @@ runs:
echo "Found both Cargo.toml and pyproject.toml; not supported" >&2
exit 1
elif [ -f Cargo.toml ]; then
echo "lang=rust" >> "$GITHUB_OUTPUT"
lang=rust
elif [ -f pyproject.toml ]; then
echo "lang=python" >> "$GITHUB_OUTPUT"
lang=python
else
echo "Neither Cargo.toml nor pyproject.toml found" >&2
exit 1
fi
shell: bash
- id: validate
run: |
set -euo pipefail

case "${{ inputs.format }}" in
lcov|cobertura|coveragepy) ;;
*)
echo "Unsupported format: ${{ inputs.format }}" >&2
exit 1
;;
esac
lang='${{ steps.detect.outputs.lang }}'

if [[ "$lang" == 'rust' && "${{ inputs.format }}" == 'coveragepy' ]]; then
echo "coveragepy format only supported for Python projects" >&2
exit 1
Expand All @@ -63,8 +60,10 @@ runs:
echo "lcov format only supported for Rust projects" >&2
exit 1
fi

echo "LANG_DETECTED=$lang" >> "$GITHUB_ENV"
shell: bash
- if: steps.detect.outputs.lang == 'rust'
- if: env.LANG_DETECTED == 'rust'
run: |
set -euo pipefail
args=(--workspace)
Expand All @@ -79,11 +78,11 @@ runs:
cargo llvm-cov "${args[@]}"
shell: bash
- name: Install uv and set the python version
if: steps.detect.outputs.lang == 'python'
if: env.LANG_DETECTED == 'python'
uses: astral-sh/setup-uv@v5

- name: Cache Python deps
if: steps.detect.outputs.lang == 'python'
if: env.LANG_DETECTED == 'python'
uses: actions/cache@v4
with:
path: ~/.cache/uv
Expand All @@ -92,11 +91,11 @@ runs:
${{ runner.os }}-py-deps-

- name: Install slipcover and pytest
if: steps.detect.outputs.lang == 'python'
if: env.LANG_DETECTED == 'python'
run: uv pip install --system slipcover pytest
shell: bash

- if: steps.detect.outputs.lang == 'python'
- if: env.LANG_DETECTED == 'python'
run: |
set -euo pipefail
mkdir -p "$(dirname "${{ inputs.output-path }}")"
Expand All @@ -117,7 +116,8 @@ runs:
shell: bash
- id: out
run: |
set -euo pipefail
echo "file=${{ inputs.output-path }}" >> "$GITHUB_OUTPUT"
echo "format=${{ inputs.format }}" >> "$GITHUB_OUTPUT"
echo "lang=${{ steps.detect.outputs.lang }}" >> "$GITHUB_OUTPUT"
echo "lang=$LANG_DETECTED" >> "$GITHUB_OUTPUT"
shell: bash