Only run Compound tests when files are changed in Compound. (#4611)

* Only run Compound tests when files are changed in Compound.

* Fix warnings about missing spacing.

* Fix warnings about inner type shadowing.
This commit is contained in:
Doug
2025-10-10 14:30:51 +01:00
committed by GitHub
parent 3081bd2d0b
commit f2a24853b4
7 changed files with 16 additions and 13 deletions

View File

@@ -6,8 +6,10 @@ name: Compound
on:
push:
branches: [ develop ]
paths: [ 'compound-ios/**' ]
pull_request:
paths: [ 'compound-ios/**' ]
jobs:
tests:
@@ -15,8 +17,9 @@ jobs:
runs-on: macos-15
concurrency:
# Only allow a single run of this workflow on each branch, automatically cancelling older runs.
group: ${{ format('compound-tests-{0}', github.ref) }}
# When running on develop, use the sha to allow all runs of this workflow to run concurrently.
# Otherwise only allow a single run of this workflow on each branch, automatically cancelling older runs.
group: ${{ github.ref == 'refs/heads/develop' && format('compound-develop-{0}', github.sha) || format('compound-{0}', github.ref) }}
cancel-in-progress: true
steps:

View File

@@ -235,7 +235,7 @@ public struct CompoundButtonStyle_Previews: PreviewProvider, TestablePreview {
}
public static func buttons(_ size: CompoundButtonStyle.Size) -> some View {
VStack {
VStack(spacing: 8) {
Button("Super") { }
.buttonStyle(.compound(.super, size: size))

View File

@@ -168,9 +168,9 @@ struct CompoundIcon_Previews: PreviewProvider, TestablePreview {
}
static var accessibilityIcons: some View {
VStack {
VStack(spacing: 8) {
ForEach(DynamicTypeSize.allCases, id: \.self) { size in
HStack {
HStack(spacing: 8) {
CompoundIcon(\.userProfile, size: .xSmall, relativeTo: .compound.bodyXS)
CompoundIcon(\.userProfile, size: .small, relativeTo: .compound.bodySM)
CompoundIcon(\.userProfile, size: .medium, relativeTo: .compound.bodyLG)
@@ -219,7 +219,7 @@ struct CompoundIcon_Previews: PreviewProvider, TestablePreview {
}
static var buttons: some View {
VStack {
VStack(spacing: 8) {
Button { } label: {
Label { Text("Body Large") } icon: {
CompoundIcon(\.userProfile, size: .medium, relativeTo: .compound.bodyLG)

View File

@@ -39,7 +39,7 @@ private struct ScaledFrameModifier: ViewModifier {
struct ScaledFrameModifier_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
VStack {
VStack(spacing: 8) {
ForEach(DynamicTypeSize.allCases, id: \.self) { size in
likeButtonLabel
.dynamicTypeSize(size)

View File

@@ -32,7 +32,7 @@ private struct ScaledOffsetModifier: ViewModifier {
struct ScaledOffsetModifier_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
VStack {
VStack(spacing: 8) {
ForEach(DynamicTypeSize.allCases, id: \.self) { size in
verifiedUserComposite
.dynamicTypeSize(size)

View File

@@ -37,7 +37,7 @@ private struct ScaledPaddingModifier: ViewModifier {
struct ScaledPaddingModifier_Previews: PreviewProvider, TestablePreview {
static var previews: some View {
VStack {
VStack(spacing: 8) {
ForEach(DynamicTypeSize.allCases, id: \.self) { size in
userProfileButtonLabel
.dynamicTypeSize(size)

View File

@@ -27,19 +27,19 @@ public struct ListRow<Icon: View, DetailsIcon: View, CustomContent: View, Select
let label: ListRowLabel<Icon>
let details: ListRowDetails<DetailsIcon>?
public enum Kind<CustomContent: View, SelectionValue: Hashable> {
public enum Kind<CustomView: View, Selection: Hashable> {
case label
case button(action: () -> Void)
case navigationLink(action: () -> Void)
case picker(selection: Binding<SelectionValue>, items: [(title: String, tag: SelectionValue)])
case picker(selection: Binding<Selection>, items: [(title: String, tag: Selection)])
case toggle(Binding<Bool>)
case inlinePicker(selection: Binding<SelectionValue>, items: [(title: String, tag: SelectionValue)])
case inlinePicker(selection: Binding<Selection>, items: [(title: String, tag: Selection)])
case selection(isSelected: Bool, action: () -> Void)
case multiSelection(isSelected: Bool, action: () -> Void)
case textField(text: Binding<String>, axis: Axis?)
case secureField(text: Binding<String>)
case custom(() -> CustomContent)
case custom(() -> CustomView)
public static func textField(text: Binding<String>) -> Self {
.textField(text: text, axis: nil)