• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pantsbuild / pants / 25441711719

06 May 2026 02:31PM UTC coverage: 92.915%. Remained the same
25441711719

push

github

web-flow
use sha pin (with comment) format for generated actions (#23312)

Per the GitHub Action best practices we recently enabled at #23249, we
should pin each action to a SHA so that the reference is actually
immutable.

This will -- I hope -- knock out a large chunk of the 421 alerts we
currently get from zizmor. The next followup would then be upgrades and
harmonizing the generated and none-generated pins.

Notice: This idea was suggested by Claude while going over pinact output
and I was surprised to see that post processing the yaml wasn't too
gross.

92206 of 99237 relevant lines covered (92.91%)

4.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/python/pants/backend/kotlin/test/junit.py
1
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
2
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3
from __future__ import annotations
1✔
4

5
from dataclasses import dataclass
1✔
6

7
from pants.backend.kotlin.subsystems.kotlin import KotlinSubsystem
1✔
8
from pants.backend.kotlin.target_types import KotlinJunitTestDependenciesField
1✔
9
from pants.build_graph.address import Address
1✔
10
from pants.engine.rules import collect_rules, implicitly, rule
1✔
11
from pants.engine.target import FieldSet, InferDependenciesRequest, InferredDependencies
1✔
12
from pants.engine.unions import UnionRule
1✔
13
from pants.jvm.dependency_inference.artifact_mapper import (
1✔
14
    AllJvmArtifactTargets,
15
    find_jvm_artifacts_or_raise,
16
)
17
from pants.jvm.resolve.coordinate import Coordinate
1✔
18
from pants.jvm.subsystems import JvmSubsystem
1✔
19
from pants.jvm.target_types import JvmResolveField
1✔
20

21

22
@dataclass(frozen=True)
1✔
23
class KotlinJunitTestDependencyInferenceFieldSet(FieldSet):
1✔
24
    required_fields = (KotlinJunitTestDependenciesField, JvmResolveField)
1✔
25

26
    dependencies: KotlinJunitTestDependenciesField
1✔
27
    resolve: JvmResolveField
1✔
28

29

30
class InferKotlinJunitTestDependencyRequest(InferDependenciesRequest):
1✔
31
    infer_from = KotlinJunitTestDependencyInferenceFieldSet
1✔
32

33

34
@dataclass(frozen=True)
1✔
35
class KotlinJunitLibrariesForResolveRequest:
1✔
36
    resolve_name: str
1✔
37

38

39
@dataclass(frozen=True)
1✔
40
class KotlinJunitLibrariesForResolve:
1✔
41
    addresses: frozenset[Address]
1✔
42

43

44
@rule
1✔
45
async def resolve_kotlin_junit_libraries_for_resolve(
1✔
46
    request: KotlinJunitLibrariesForResolveRequest,
47
    jvm_artifact_targets: AllJvmArtifactTargets,
48
    jvm: JvmSubsystem,
49
    kotlin_subsystem: KotlinSubsystem,
50
) -> KotlinJunitLibrariesForResolve:
51
    kotlin_version = kotlin_subsystem.version_for_resolve(request.resolve_name)
1✔
52
    addresses = find_jvm_artifacts_or_raise(
1✔
53
        required_coordinates=[
54
            Coordinate(
55
                group="org.jetbrains.kotlin",
56
                artifact="kotlin-test-junit",
57
                version=kotlin_version,
58
            ),
59
        ],
60
        resolve=request.resolve_name,
61
        jvm_artifact_targets=jvm_artifact_targets,
62
        jvm=jvm,
63
        subsystem="the Kotlin test runtime for JUnit",
64
        target_type="kotlin_junit_tests",
65
        requirement_source="the relevant entry for this resolve in the `[kotlin].version_for_resolve` option",
66
    )
67
    return KotlinJunitLibrariesForResolve(addresses)
1✔
68

69

70
@rule(desc="Infer dependency on Kotlin Junit support artifact.")
1✔
71
async def infer_kotlin_junit_dependency(
1✔
72
    request: InferKotlinJunitTestDependencyRequest,
73
    jvm: JvmSubsystem,
74
) -> InferredDependencies:
75
    resolve = request.field_set.resolve.normalized_value(jvm)
1✔
76

77
    kotlin_junit_libraries = await resolve_kotlin_junit_libraries_for_resolve(
1✔
78
        KotlinJunitLibrariesForResolveRequest(resolve), **implicitly()
79
    )
80
    return InferredDependencies(kotlin_junit_libraries.addresses)
1✔
81

82

83
def rules():
1✔
84
    return (
1✔
85
        *collect_rules(),
86
        UnionRule(InferDependenciesRequest, InferKotlinJunitTestDependencyRequest),
87
    )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc