diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml index 65593a58..0df2bb04 100644 --- a/.github/workflows/branch.yml +++ b/.github/workflows/branch.yml @@ -158,3 +158,30 @@ jobs: if: steps.filter.outputs.changed == 'true' working-directory: domains/games/apps/wordchains_ios run: swift test + + - uses: bazel-contrib/setup-bazel@0.18.0 + if: steps.filter.outputs.changed == 'true' + with: + bazelisk-cache: true + disk-cache: test-ios + repository-cache: true + + - name: Build iOS app with bazel + if: steps.filter.outputs.changed == 'true' + run: | + bazel build //domains/games/apps/wordchains_ios:WordChains \ + --ios_minimum_os=17.0 \ + --apple_platform_type=ios + + # swift.enable_testing is needed for @testable imports because the repo + # builds -c opt, where rules_swift disables testability by default. + # Without an explicit simulator device the test runner pairs an ancient + # device type (iPhone 6s Plus) with the latest iOS runtime and the + # simulator fails to boot. + - name: Run iOS unit tests with bazel + if: steps.filter.outputs.changed == 'true' + run: | + bazel test //domains/games/apps/wordchains_ios:WordChainsTests \ + --ios_minimum_os=17.0 \ + --features=swift.enable_testing \ + --ios_simulator_device="iPhone 16" diff --git a/.github/workflows/release-wordchains-ios.yml b/.github/workflows/release-wordchains-ios.yml index 2b410b52..26dc61a5 100644 --- a/.github/workflows/release-wordchains-ios.yml +++ b/.github/workflows/release-wordchains-ios.yml @@ -143,11 +143,7 @@ jobs: disk-cache: release-wordchains-ios repository-cache: true - # rules_apple doesn't support Bazel 9 yet; pin to Bazel 8 LTS for iOS builds. - # Track: https://github.com/bazelbuild/rules_apple/issues - name: Build iOS app - env: - USE_BAZEL_VERSION: 8.2.1 run: | bazel build //domains/games/apps/wordchains_ios:WordChains \ --ios_minimum_os=17.0 \ diff --git a/domains/games/apps/wordchains_ios/BUILD.bazel b/domains/games/apps/wordchains_ios/BUILD.bazel index 50d0ea07..3da2bc08 100644 --- a/domains/games/apps/wordchains_ios/BUILD.bazel +++ b/domains/games/apps/wordchains_ios/BUILD.bazel @@ -15,13 +15,14 @@ swift_library( ":word_graph_json", ], module_name = "WordChains", - tags = ["manual"], - target_compatible_with = ["@platforms//os:macos"], + target_compatible_with = ["@platforms//os:ios"], ) -# Tagged manual: rules_apple doesn't support Bazel 9 yet. -# https://github.com/bazelbuild/rules_apple/issues/2863 -# Build with: USE_BAZEL_VERSION=8.2.1 bazel build //domains/games/apps/wordchains_ios:WordChains +# The Apple bundling rules transition to an iOS target platform before +# target_compatible_with is evaluated, so os:ios can't keep Linux CI off +# them — Linux analysis fails resolving an Apple C++ toolchain instead of +# skipping. Tag them manual; the test-ios job and the release workflow +# request them by explicit label, which builds manual targets. ios_application( name = "WordChains", bundle_id = "com.muchq.wordchains", @@ -35,7 +36,7 @@ ios_application( ":word_graph_json", ] + glob(["Sources/Resources/**"]), tags = ["manual"], - target_compatible_with = ["@platforms//os:macos"], + target_compatible_with = ["@platforms//os:ios"], visibility = ["//visibility:public"], deps = [":WordChainsLib"], ) @@ -44,11 +45,13 @@ swift_library( name = "WordChainsTestLib", testonly = True, srcs = glob(["Tests/**/*.swift"]), - tags = ["manual"], - target_compatible_with = ["@platforms//os:macos"], + target_compatible_with = ["@platforms//os:ios"], deps = [":WordChainsLib"], ) +# Unlike ios_application, the test rule stays in the host configuration +# (only its deps transition to iOS), so it must be compatible with the +# macOS host that runs the simulator. ios_unit_test( name = "WordChainsTests", minimum_os_version = "17.0",