Skip to content

Commit 98d49d5

Browse files
authored
Add sandbox mode to CI testing matrix (#895)
What changed: 1. Add sandbox on/off to testing matrix, so we have 2 bazel version * VFS on/off * sandbox on off = 8 tests in total ATM 2. Fix redefinition of `AppErrorCode` enum error in sandbox mode by removing the extra import in bridging header. The tests still works and can catch renaming of the enum for example. Why it was working in non sandbox mode is unknown 3. Add `sandbox` config to include all settings needed to pass CI. specifically allow a small set of actions to run locally. Why this change: To add CI coverage to sandbox mode to ensure no regression on it, now that we have fixed issues with sandbox mode in #894 Discussion: CI duration might be a concern, we can exclude certain combo in the test matrix if we want, it's possible with `exclude` keyword
1 parent 7b16cda commit 98d49d5

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

.bazelrc

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
common --enable_bzlmod
33

44
# Spawn strategy required for some tests
5-
build --spawn_strategy=standalone
5+
build --spawn_strategy=local
66

77
# Setup Xcode configuration.
88
build --xcode_version_config=//:host_xcodes
@@ -62,6 +62,16 @@ build:remote_cache --noslim_profile
6262
build:remote_cache --remote_cache=grpcs://remote.buildbuddy.io
6363
build:remote_cache --remote_timeout=3600
6464

65+
build:sandboxed --spawn_strategy=sandboxed
66+
# Otherwise it still use the worker strategy
67+
build:sandboxed --strategy=SwiftCompile=sandboxed
68+
build:sandboxed --strategy=Genrule=sandboxed,local
69+
build:sandboxed --strategy=StoryboardCompile=sandboxed,local
70+
build:sandboxed --strategy=CleaningFramework=sandboxed,local
71+
build:sandboxed --strategy=StoryboardLink=sandboxed,local
72+
build:sandboxed --strategy=ProcessAndSign=sandboxed,local
73+
build:sandboxed --strategy=AssetCatalogCompile=sandboxed,local
74+
6575
# By default don't upload local results to remote cache, only CI does this.
6676
build --noremote_upload_local_results
6777
build:ci --remote_upload_local_results

.github/workflows/tests.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ concurrency:
1515
# when adding a new job / changing the matrix, make sure to update all jobs
1616
jobs:
1717
integration_tests:
18-
name: Build and test (Bazel ${{ matrix.bazel_version }} / Xcode ${{ matrix.xcode_version }} / Virtual Frameworks ${{ matrix.virtual_frameworks }})
18+
name: Build and test (Bazel ${{ matrix.bazel_version }} / Xcode ${{ matrix.xcode_version }} / Virtual Frameworks ${{ matrix.virtual_frameworks }}) / Sandbox ${{ matrix.sandbox }}
1919
runs-on: macos-14
2020
strategy:
2121
fail-fast: false
2222
matrix:
2323
bazel_version: [6.5.0, 7.1.0]
2424
xcode_version: [15.2]
2525
virtual_frameworks: [true, false]
26+
sandbox: [true, false]
2627
env:
2728
XCODE_VERSION: ${{ matrix.xcode_version }}
2829
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
@@ -34,6 +35,10 @@ jobs:
3435
name: Add vfs config
3536
run: |
3637
echo "build --config=vfs" >> user.bazelrc
38+
- if: matrix.sandbox
39+
name: Enable sandbox mode
40+
run: |
41+
echo "build --config=sandboxed" >> user.bazelrcc
3742
- name: Build and Test
3843
run: |
3944
# non-iOS tests

rules/library.bzl

-2
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,6 @@ def apple_library(
953953
generated_swift_header_name = module_name + "-Swift.h"
954954

955955
if module_map:
956-
# TODO: now that we always add module_map as a swiftc_input,
957-
# we should consider removing this one if it's not needed
958956
extend_modulemap(
959957
name = module_map + ".extended." + name,
960958
destination = "%s.extended.modulemap" % name,
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
#import <TestImports-Unit-Tests/testhelper.h>
2-
#import <TestImports-App/Header2.h>

tests/ios/unit-test/test-imports-app/test.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ class SwiftTests : XCTestCase {
55
func testPasses() {
66
_ = EmptyStruct()
77
XCTAssertTrue(true)
8-
XCTAssertEqual(TestHelper.createString(), "ObjcTestHelperString_EnumValue=1")
8+
XCTAssertEqual(TestHelper.createString(), "ObjcTestHelperString_EnumValue=\(AppErrorCode.unknown.rawValue)")
99
}
1010
}

0 commit comments

Comments
 (0)