From f2a24853b42ce431fb6f557ad3007d86d19e7847 Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Fri, 10 Oct 2025 14:30:51 +0100 Subject: [PATCH] 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. --- .github/workflows/compound-ios.yml | 7 +++++-- .../Sources/Compound/BaseStyles/CompoundButtonStyle.swift | 2 +- compound-ios/Sources/Compound/Icons/CompoundIcon.swift | 6 +++--- .../Sources/Compound/Layout/ScaledFrameModifier.swift | 2 +- .../Sources/Compound/Layout/ScaledOffsetModifier.swift | 2 +- .../Sources/Compound/Layout/ScaledPaddingModifier.swift | 2 +- compound-ios/Sources/Compound/List/ListRow.swift | 8 ++++---- 7 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.github/workflows/compound-ios.yml b/.github/workflows/compound-ios.yml index c39269ec3..82d5738e1 100644 --- a/.github/workflows/compound-ios.yml +++ b/.github/workflows/compound-ios.yml @@ -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: diff --git a/compound-ios/Sources/Compound/BaseStyles/CompoundButtonStyle.swift b/compound-ios/Sources/Compound/BaseStyles/CompoundButtonStyle.swift index e1fb580b8..d3868cae5 100644 --- a/compound-ios/Sources/Compound/BaseStyles/CompoundButtonStyle.swift +++ b/compound-ios/Sources/Compound/BaseStyles/CompoundButtonStyle.swift @@ -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)) diff --git a/compound-ios/Sources/Compound/Icons/CompoundIcon.swift b/compound-ios/Sources/Compound/Icons/CompoundIcon.swift index 134bcd565..06b0f3159 100644 --- a/compound-ios/Sources/Compound/Icons/CompoundIcon.swift +++ b/compound-ios/Sources/Compound/Icons/CompoundIcon.swift @@ -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) diff --git a/compound-ios/Sources/Compound/Layout/ScaledFrameModifier.swift b/compound-ios/Sources/Compound/Layout/ScaledFrameModifier.swift index 15b7ab35d..e0ba03847 100644 --- a/compound-ios/Sources/Compound/Layout/ScaledFrameModifier.swift +++ b/compound-ios/Sources/Compound/Layout/ScaledFrameModifier.swift @@ -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) diff --git a/compound-ios/Sources/Compound/Layout/ScaledOffsetModifier.swift b/compound-ios/Sources/Compound/Layout/ScaledOffsetModifier.swift index 481b75fbc..de5efcba4 100644 --- a/compound-ios/Sources/Compound/Layout/ScaledOffsetModifier.swift +++ b/compound-ios/Sources/Compound/Layout/ScaledOffsetModifier.swift @@ -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) diff --git a/compound-ios/Sources/Compound/Layout/ScaledPaddingModifier.swift b/compound-ios/Sources/Compound/Layout/ScaledPaddingModifier.swift index ffd507706..272a9b7bc 100644 --- a/compound-ios/Sources/Compound/Layout/ScaledPaddingModifier.swift +++ b/compound-ios/Sources/Compound/Layout/ScaledPaddingModifier.swift @@ -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) diff --git a/compound-ios/Sources/Compound/List/ListRow.swift b/compound-ios/Sources/Compound/List/ListRow.swift index 5cf5256c6..177a01a94 100644 --- a/compound-ios/Sources/Compound/List/ListRow.swift +++ b/compound-ios/Sources/Compound/List/ListRow.swift @@ -27,19 +27,19 @@ public struct ListRow let details: ListRowDetails? - public enum Kind { + public enum Kind { case label case button(action: () -> Void) case navigationLink(action: () -> Void) - case picker(selection: Binding, items: [(title: String, tag: SelectionValue)]) + case picker(selection: Binding, items: [(title: String, tag: Selection)]) case toggle(Binding) - case inlinePicker(selection: Binding, items: [(title: String, tag: SelectionValue)]) + case inlinePicker(selection: Binding, items: [(title: String, tag: Selection)]) case selection(isSelected: Bool, action: () -> Void) case multiSelection(isSelected: Bool, action: () -> Void) case textField(text: Binding, axis: Axis?) case secureField(text: Binding) - case custom(() -> CustomContent) + case custom(() -> CustomView) public static func textField(text: Binding) -> Self { .textField(text: text, axis: nil)