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
15 changes: 4 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,10 @@ jobs:
steps:
- uses: actions/checkout@v5
- uses: bazel-contrib/setup-bazel@0.15.0
- name: Install Aspect CLI
uses: jaxxstorm/action-install-gh-release@v2.1.0
with:
repo: aspect-build/aspect-cli
tag: 2025.42.9
asset-name: aspect-cli
platform: unknown_linux
arch: x86_64
extension-matching: disable
rename-to: aspect
chmod: 0755
- run: |
curl -LO https://github.com/aspect-build/aspect-cli/releases/download/v2025.46.20/aspect-cli-x86_64-unknown-linux-musl
chmod +x aspect-cli-x86_64-unknown-linux-musl
mv aspect-cli-x86_64-unknown-linux-musl /usr/local/bin/aspect
- name: Test
working-directory: example
shell: sh
Expand Down
2 changes: 2 additions & 0 deletions MODULE.aspect
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"Public API re-export"
use_task("coverage.axl", "coverage")
15 changes: 7 additions & 8 deletions coverage.axl
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,25 @@ def impl(ctx) -> int:

lcov_build = ctx.bazel.build(
"@lcov",
events = True,
bazel_flags = ["--build_runfile_links"],
build_events = True,
flags = ["--build_runfile_links"],
)

lcov = runnable(ctx)
for event in lcov_build.events():
for event in lcov_build.build_events():
lcov.event(event)

test = ctx.bazel.build(
test = ctx.bazel.test(
"//...",
events = True,
bazel_flags = [
build_events = True,
flags = [
"--isatty=" + str(int(out.is_tty)),
"--collect_code_coverage",
],
bazel_verb = "test"
)

coverage_dat_files = []
for event in test.events():
for event in test.build_events():
if event.kind == "test_result":
coverage_dat_files.extend([
f.file.removeprefix("file://")
Expand Down
1 change: 0 additions & 1 deletion example/.aspect/coverage.axl

This file was deleted.

1 change: 0 additions & 1 deletion example/.aspect/runnable.axl

This file was deleted.

5 changes: 5 additions & 0 deletions example/MODULE.aspect
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
axl_local_dep(
name = "coverage",
path = "..",
auto_use_tasks = True,
)
4 changes: 2 additions & 2 deletions runnable.axl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _determine_entrypoint(state: struct) -> str | None:
break
return entrypoint

def _spawn(ctx: task_context, state: struct, args: list[str]) -> std.process.child:
def _spawn(ctx: TaskContext, state: struct, args: list[str]) -> std.process.Child:
entrypoint = _determine_entrypoint(state)
runfiles = entrypoint + ".runfiles"
return ctx.std.process.command(entrypoint)\
Expand All @@ -40,7 +40,7 @@ def _spawn(ctx: task_context, state: struct, args: list[str]) -> std.process.chi
.args(args) \
.spawn()

def runnable(ctx) -> struct:
def runnable(ctx: TaskContext) -> struct:
state = struct(
ctx = ctx,
target = "@@lcov+//:lcov", # TODO(alexeagle): we can assume there's only one target
Expand Down