From eb9a87de35d5aaccb3c76abef4a741f7bfeb5a4a Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 27 Jul 2026 03:14:39 +0800 Subject: [PATCH 1/3] Enable Tuist caching and build insights in CI --- .github/workflows/compatibility_tests.yml | 27 ++++++++++++++-- .github/workflows/compute.yml | 27 ++++++++++++++-- .github/workflows/ios.yml | 39 ++++++++++++++++++++--- .github/workflows/release.yml | 21 ++++++++++-- .github/workflows/xcframework.yml | 15 +++++++++ Example/Project.swift | 5 ++- Example/Tuist.swift | 10 +++++- Example/Tuist/Package.resolved | 15 --------- Example/Tuist/Package.swift | 5 +-- Example/mise.toml | 2 +- Scripts/build_xcframework.sh | 17 ++++++++-- Tuist.swift | 5 +++ mise.toml | 2 +- 13 files changed, 153 insertions(+), 37 deletions(-) delete mode 100644 Example/Tuist/Package.resolved diff --git a/.github/workflows/compatibility_tests.yml b/.github/workflows/compatibility_tests.yml index ce12df1c..9f5422f4 100644 --- a/.github/workflows/compatibility_tests.yml +++ b/.github/workflows/compatibility_tests.yml @@ -9,6 +9,9 @@ on: jobs: compatibility_tests_macos: name: Execute compatibility tests + permissions: + contents: read + id-token: write strategy: fail-fast: false matrix: @@ -31,6 +34,18 @@ jobs: uses: OpenSwiftUIProject/setup-xcode@v2 with: xcode-version: ${{ matrix.xcode-version }} + - name: Set up mise + uses: jdx/mise-action@v2 + with: + install: false + cache: false + - name: Set up Tuist cache + run: | + mise trust mise.toml + mise install + mise exec -- tuist auth login + mise exec -- tuist setup cache + shell: bash - name: Set up build environment run: Scripts/CI/darwin_setup_build.sh shell: bash @@ -42,10 +57,18 @@ jobs: --build-path .build-compatibility-test-debug - name: Run tests against Apple's AttributeGraph on macOS via Xcode run: | - xcodebuild test \ + result_bundle="${RUNNER_TEMP:-/tmp}/openattributegraph-compatibility-macos-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT:-0}.xcresult" + rm -rf "$result_bundle" + trap 'rm -rf "$result_bundle"' EXIT + mise exec -- tuist xcodebuild test \ -workspace .swiftpm/xcode/package.xcworkspace \ -scheme OpenAttributeGraph-Package \ -sdk macosx \ -destination "platform=macOS" \ + -resultBundlePath "$result_bundle" \ -skipPackagePluginValidation \ - -skipMacroValidation + -skipMacroValidation \ + COMPILATION_CACHE_ENABLE_CACHING=YES \ + COMPILATION_CACHE_REMOTE_SERVICE_PATH="$HOME/.local/state/tuist/OpenSwiftUIProject_openattributegraph.sock" \ + COMPILATION_CACHE_ENABLE_PLUGIN=YES \ + COMPILATION_CACHE_ENABLE_DIAGNOSTIC_REMARKS=YES diff --git a/.github/workflows/compute.yml b/.github/workflows/compute.yml index 239f5eff..91dcefc7 100644 --- a/.github/workflows/compute.yml +++ b/.github/workflows/compute.yml @@ -57,6 +57,9 @@ jobs: compute_ios_build: name: Build with Compute (binary) on iOS + permissions: + contents: read + id-token: write strategy: fail-fast: false matrix: @@ -79,14 +82,34 @@ jobs: uses: OpenSwiftUIProject/setup-xcode@v2 with: xcode-version: ${{ matrix.xcode-version }} + - name: Set up mise + uses: jdx/mise-action@v2 + with: + install: false + cache: false + - name: Set up Tuist cache + run: | + mise trust mise.toml + mise install + mise exec -- tuist auth login + mise exec -- tuist setup cache + shell: bash - name: Build in debug mode on iOS Simulator run: | - xcodebuild build \ + result_bundle="${RUNNER_TEMP:-/tmp}/openattributegraph-compute-ios-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT:-0}.xcresult" + rm -rf "$result_bundle" + trap 'rm -rf "$result_bundle"' EXIT + mise exec -- tuist xcodebuild build \ -workspace .swiftpm/xcode/package.xcworkspace \ -scheme OpenAttributeGraph \ -configuration Debug \ -destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" \ -derivedDataPath .build-debug \ + -resultBundlePath "$result_bundle" \ -skipMacroValidation \ -skipPackagePluginValidation \ - OTHER_SWIFT_FLAGS="-warnings-as-errors" + OTHER_SWIFT_FLAGS="-warnings-as-errors" \ + COMPILATION_CACHE_ENABLE_CACHING=YES \ + COMPILATION_CACHE_REMOTE_SERVICE_PATH="$HOME/.local/state/tuist/OpenSwiftUIProject_openattributegraph.sock" \ + COMPILATION_CACHE_ENABLE_PLUGIN=YES \ + COMPILATION_CACHE_ENABLE_DIAGNOSTIC_REMARKS=YES diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 90b4f500..ecec55eb 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -9,6 +9,9 @@ on: jobs: ios_test: name: Execute tests on iOS + permissions: + contents: read + id-token: write strategy: fail-fast: false matrix: @@ -33,35 +36,63 @@ jobs: uses: OpenSwiftUIProject/setup-xcode@v2 with: xcode-version: ${{ matrix.xcode-version }} + - name: Set up mise + uses: jdx/mise-action@v2 + with: + install: false + cache: false + - name: Set up Tuist cache + run: | + mise trust mise.toml + mise install + mise exec -- tuist auth login + mise exec -- tuist setup cache + shell: bash - name: Set up build environment run: Scripts/CI/darwin_setup_build.sh shell: bash - name: Build in debug mode on iOS run: | + result_bundle="${RUNNER_TEMP:-/tmp}/openattributegraph-ios-build-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT:-0}.xcresult" + rm -rf "$result_bundle" + trap 'rm -rf "$result_bundle"' EXIT # Swift 6.2.4 crashes while indexing C++ interop test targets. - xcodebuild build \ + mise exec -- tuist xcodebuild build \ -workspace .swiftpm/xcode/package.xcworkspace \ -scheme OpenAttributeGraph-Package \ -configuration Debug \ -destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" \ -derivedDataPath .build-debug \ + -resultBundlePath "$result_bundle" \ -skipMacroValidation \ -skipPackagePluginValidation \ COMPILER_INDEX_STORE_ENABLE=NO \ - OTHER_SWIFT_FLAGS="-warnings-as-errors" + OTHER_SWIFT_FLAGS="-warnings-as-errors" \ + COMPILATION_CACHE_ENABLE_CACHING=YES \ + COMPILATION_CACHE_REMOTE_SERVICE_PATH="$HOME/.local/state/tuist/OpenSwiftUIProject_openattributegraph.sock" \ + COMPILATION_CACHE_ENABLE_PLUGIN=YES \ + COMPILATION_CACHE_ENABLE_DIAGNOSTIC_REMARKS=YES - name: Build and run tests in debug mode with coverage on iOS Simulator run: | + result_bundle="${RUNNER_TEMP:-/tmp}/openattributegraph-ios-test-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT:-0}.xcresult" + rm -rf "$result_bundle" + trap 'rm -rf "$result_bundle"' EXIT # Swift 6.2.4 crashes while indexing C++ interop test targets. - xcodebuild test \ + mise exec -- tuist xcodebuild test \ -workspace .swiftpm/xcode/package.xcworkspace \ -scheme OpenAttributeGraph-Package \ -configuration Debug \ -destination "platform=iOS Simulator,OS=${{ matrix.ios-version }},name=${{ matrix.ios-simulator-name }}" \ -enableCodeCoverage=YES \ -derivedDataPath .build-test-debug \ + -resultBundlePath "$result_bundle" \ -skipPackagePluginValidation \ -skipMacroValidation \ - COMPILER_INDEX_STORE_ENABLE=NO + COMPILER_INDEX_STORE_ENABLE=NO \ + COMPILATION_CACHE_ENABLE_CACHING=YES \ + COMPILATION_CACHE_REMOTE_SERVICE_PATH="$HOME/.local/state/tuist/OpenSwiftUIProject_openattributegraph.sock" \ + COMPILATION_CACHE_ENABLE_PLUGIN=YES \ + COMPILATION_CACHE_ENABLE_DIAGNOSTIC_REMARKS=YES # OTHER_SWIFT_FLAGS="-warnings-as-errors" Conflicting options '-warnings-as-errors' and '-suppress-warnings' - name: Generate iOS coverage report run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 44a2a8c4..dcf2a105 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,7 @@ jobs: runs-on: macos-15 permissions: contents: write + id-token: write env: GH_TOKEN: ${{ github.token }} steps: @@ -22,17 +23,31 @@ jobs: uses: OpenSwiftUIProject/setup-xcode@v2 with: xcode-version: "26.3" + - name: Set up mise + uses: jdx/mise-action@v2 + with: + install: false + cache: false + - name: Set up Tuist cache + run: | + mise trust mise.toml + mise install + mise exec -- tuist auth login + mise exec -- tuist setup cache + shell: bash - name: Build XCFramework run: ./Scripts/build_xcframework.sh - name: Compute Checksum id: checksum run: | - echo "checksum=$(swift package compute-checksum .build/Xcode/Frameworks/OpenAttributeGraph.xcframework.zip)" >> $GITHUB_OUTPUT + echo "checksum=$(swift package compute-checksum .build/Xcode/Frameworks/OpenAttributeGraph.xcframework.zip)" >> "$GITHUB_OUTPUT" - name: Collect Build Info id: build_info run: | - echo "xcode_version=$(xcodebuild -version | head -1)" >> $GITHUB_OUTPUT - echo "swift_version=$(swift --version 2>&1 | head -1)" >> $GITHUB_OUTPUT + { + echo "xcode_version=$(xcodebuild -version | head -1)" + echo "swift_version=$(swift --version 2>&1 | head -1)" + } >> "$GITHUB_OUTPUT" - name: Generate Release Notes run: | TAG_NAME="${GITHUB_REF#refs/tags/}" diff --git a/.github/workflows/xcframework.yml b/.github/workflows/xcframework.yml index f80aee33..08f4e4fa 100644 --- a/.github/workflows/xcframework.yml +++ b/.github/workflows/xcframework.yml @@ -9,6 +9,9 @@ on: jobs: build_xcframework: name: Build XCFramework + permissions: + contents: read + id-token: write strategy: fail-fast: false matrix: @@ -25,6 +28,18 @@ jobs: uses: OpenSwiftUIProject/setup-xcode@v2 with: xcode-version: ${{ matrix.xcode-version }} + - name: Set up mise + uses: jdx/mise-action@v2 + with: + install: false + cache: false + - name: Set up Tuist cache + run: | + mise trust mise.toml + mise install + mise exec -- tuist auth login + mise exec -- tuist setup cache + shell: bash - name: Build XCFramework run: ./Scripts/build_xcframework.sh - name: Upload XCFramework diff --git a/Example/Project.swift b/Example/Project.swift index 5c3aec6e..c5c70612 100644 --- a/Example/Project.swift +++ b/Example/Project.swift @@ -7,6 +7,9 @@ let indexStoreDisabledSettings: SettingsDictionary = [ let project = Project( name: "Example", + packages: [ + .package(path: ".."), + ], settings: .settings(base: indexStoreDisabledSettings), targets: [ .target( @@ -18,7 +21,7 @@ let project = Project( sources: ["Sources/**"], dependencies: [ .sdk(name: "c++", type: .library), - .external(name: "OpenAttributeGraph"), + .package(product: "OpenAttributeGraph"), ], settings: .settings(base: indexStoreDisabledSettings) ), diff --git a/Example/Tuist.swift b/Example/Tuist.swift index abf9ffd0..7e779ccc 100644 --- a/Example/Tuist.swift +++ b/Example/Tuist.swift @@ -1,5 +1,13 @@ import ProjectDescription let tuist = Tuist( - project: .tuist() + fullHandle: "OpenSwiftUIProject/openattributegraph", + xcodeCache: .xcodeCache( + upload: Environment.isCI + ), + project: .tuist( + generationOptions: .options( + enableCaching: true + ) + ) ) diff --git a/Example/Tuist/Package.resolved b/Example/Tuist/Package.resolved deleted file mode 100644 index e8cf1f64..00000000 --- a/Example/Tuist/Package.resolved +++ /dev/null @@ -1,15 +0,0 @@ -{ - "originHash" : "b4d69cd3c6294a612f2691e0c9ace37d5e8c8904296914f23e337abb762050c2", - "pins" : [ - { - "identity" : "swift-numerics", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-numerics", - "state" : { - "revision" : "0c0290ff6b24942dadb83a929ffaaa1481df04a2", - "version" : "1.1.1" - } - } - ], - "version" : 3 -} diff --git a/Example/Tuist/Package.swift b/Example/Tuist/Package.swift index 9384c666..e18a677e 100644 --- a/Example/Tuist/Package.swift +++ b/Example/Tuist/Package.swift @@ -17,8 +17,5 @@ let packageSettings = PackageSettings( let package = Package( name: "ExampleDependencies", - dependencies: [ - .package(path: "../../"), - .package(url: "https://github.com/apple/swift-numerics", from: "1.1.1"), - ] + dependencies: [] ) diff --git a/Example/mise.toml b/Example/mise.toml index 9d16c181..cc14d054 100644 --- a/Example/mise.toml +++ b/Example/mise.toml @@ -1,2 +1,2 @@ [tools] -tuist = "4.193.0" +tuist = "4.203.0-rc.1" diff --git a/Scripts/build_xcframework.sh b/Scripts/build_xcframework.sh index 603ded86..385f7b8d 100755 --- a/Scripts/build_xcframework.sh +++ b/Scripts/build_xcframework.sh @@ -42,25 +42,36 @@ done echo "Building xcframework for $SCHEME (debug info: $DEBUG_INFO)" # Archive for each platform using the Tuist-generated xcodeproj -xcodebuild archive \ +rm -rf \ + "$BUILD_DIR/Archives/$SCHEME-macOS.xcarchive" \ + "$BUILD_DIR/Archives/$SCHEME-macOS.xcresult" \ + "$BUILD_DIR/Archives/$SCHEME-iOS.xcarchive" \ + "$BUILD_DIR/Archives/$SCHEME-iOS.xcresult" \ + "$BUILD_DIR/Archives/$SCHEME-iOS-Simulator.xcarchive" \ + "$BUILD_DIR/Archives/$SCHEME-iOS-Simulator.xcresult" + +tuist xcodebuild archive \ -project "$XCODEPROJ" \ -scheme "$SCHEME" \ -destination "generic/platform=macOS" \ -archivePath "$BUILD_DIR/Archives/$SCHEME-macOS.xcarchive" \ + -resultBundlePath "$BUILD_DIR/Archives/$SCHEME-macOS.xcresult" \ ENABLE_USER_SCRIPT_SANDBOXING=NO -xcodebuild archive \ +tuist xcodebuild archive \ -project "$XCODEPROJ" \ -scheme "$SCHEME" \ -destination "generic/platform=iOS" \ -archivePath "$BUILD_DIR/Archives/$SCHEME-iOS.xcarchive" \ + -resultBundlePath "$BUILD_DIR/Archives/$SCHEME-iOS.xcresult" \ ENABLE_USER_SCRIPT_SANDBOXING=NO -xcodebuild archive \ +tuist xcodebuild archive \ -project "$XCODEPROJ" \ -scheme "$SCHEME" \ -destination "generic/platform=iOS Simulator" \ -archivePath "$BUILD_DIR/Archives/$SCHEME-iOS-Simulator.xcarchive" \ + -resultBundlePath "$BUILD_DIR/Archives/$SCHEME-iOS-Simulator.xcresult" \ ENABLE_USER_SCRIPT_SANDBOXING=NO echo "Archives completed successfully." diff --git a/Tuist.swift b/Tuist.swift index a1d52306..191f66bd 100644 --- a/Tuist.swift +++ b/Tuist.swift @@ -1,8 +1,13 @@ import ProjectDescription let tuist = Tuist( + fullHandle: "OpenSwiftUIProject/openattributegraph", + xcodeCache: .xcodeCache( + upload: Environment.isCI + ), project: .tuist( generationOptions: .options( + enableCaching: true, manifestEnvironment: [ "OPENSWIFTUI_*", "OPENATTRIBUTEGRAPH_*", diff --git a/mise.toml b/mise.toml index 82eb7c50..cc14d054 100644 --- a/mise.toml +++ b/mise.toml @@ -1,2 +1,2 @@ [tools] -tuist = "4.156.0" +tuist = "4.203.0-rc.1" From 64877d3f45c3c18a14bbe9cf1c72575e9c890548 Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 27 Jul 2026 03:16:11 +0800 Subject: [PATCH 2/3] Pin the Example package dependency --- Example/Project.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Example/Project.swift b/Example/Project.swift index c5c70612..814e4231 100644 --- a/Example/Project.swift +++ b/Example/Project.swift @@ -9,6 +9,11 @@ let project = Project( name: "Example", packages: [ .package(path: ".."), + // Preserve the revision pinned by the former Tuist-managed dependency lock. + .package( + url: "https://github.com/apple/swift-numerics", + .revision("0c0290ff6b24942dadb83a929ffaaa1481df04a2") + ), ], settings: .settings(base: indexStoreDisabledSettings), targets: [ From 39f2473df1ffacb28da39ca59074d3cb03cd1ef8 Mon Sep 17 00:00:00 2001 From: Kyle Date: Mon, 27 Jul 2026 03:17:51 +0800 Subject: [PATCH 3/3] Use the root package resolution lock --- Example/Project.swift | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Example/Project.swift b/Example/Project.swift index 814e4231..c5c70612 100644 --- a/Example/Project.swift +++ b/Example/Project.swift @@ -9,11 +9,6 @@ let project = Project( name: "Example", packages: [ .package(path: ".."), - // Preserve the revision pinned by the former Tuist-managed dependency lock. - .package( - url: "https://github.com/apple/swift-numerics", - .revision("0c0290ff6b24942dadb83a929ffaaa1481df04a2") - ), ], settings: .settings(base: indexStoreDisabledSettings), targets: [