diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 8cb398ec0..83a6dc965 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -894,3 +894,50 @@ jobs: cargo clean && cargo build - name: lv10-stats-use run: ${SCCACHE_PATH} --show-stats + + xcode: + runs-on: macos-latest + env: + SCCACHE_PATH: target/debug/sccache + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Install rust + uses: ./.github/actions/rust-toolchain + with: + toolchain: "stable" + + - name: Build sccache + run: | + cargo build + + - name: Create wrapper script + working-directory: tests/xcode + run: | + echo '#!/bin/sh' > wrapper.sh + echo "$GITHUB_WORKSPACE/${SCCACHE_PATH} $(xcrun -f cc) \$@" >> wrapper.sh + + - name: Start server + run: ${SCCACHE_PATH} --start-server + + - name: Test compile xcode + working-directory: tests/xcode + run: | + xcodebuild -version + xcodebuild -xcconfig sccache.xcconfig + + - name: Output + run: | + ${SCCACHE_PATH} --show-stats + + - name: Test compile xcode cached + working-directory: tests/xcode + run: | + xcodebuild clean + xcodebuild -xcconfig sccache.xcconfig + + - name: Output + run: | + ${SCCACHE_PATH} --show-stats + ${SCCACHE_PATH} --show-stats | grep -e "Cache hits\s*[1-9]" diff --git a/tests/xcode/main.cpp b/tests/xcode/main.cpp new file mode 100644 index 000000000..e371aa940 --- /dev/null +++ b/tests/xcode/main.cpp @@ -0,0 +1,6 @@ +#include + +int main(int argc, const char * argv[]) { + std::cout << "Hello, World!\n"; + return 0; +} diff --git a/tests/xcode/sccache.xcconfig b/tests/xcode/sccache.xcconfig new file mode 100644 index 000000000..f637a79cb --- /dev/null +++ b/tests/xcode/sccache.xcconfig @@ -0,0 +1,3 @@ +CC=$(SRCROOT)/wrapper.sh +CLANG_ENABLE_MODULES=NO +COMPILER_INDEX_STORE_ENABLE=NO diff --git a/tests/xcode/xcode-test.xcodeproj/project.pbxproj b/tests/xcode/xcode-test.xcodeproj/project.pbxproj new file mode 100644 index 000000000..aec85264f --- /dev/null +++ b/tests/xcode/xcode-test.xcodeproj/project.pbxproj @@ -0,0 +1,279 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 77; + objects = { + +/* Begin PBXBuildFile section */ + 9D52B00E2CABDB80008CF5FD /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9D52B00D2CABDB80008CF5FD /* main.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9D52B0012CABDB40008CF5FD /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 9D52B0032CABDB40008CF5FD /* xcode-test */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "xcode-test"; sourceTree = BUILT_PRODUCTS_DIR; }; + 9D52B00D2CABDB80008CF5FD /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9D52B0002CABDB40008CF5FD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9D52AFFA2CABDB40008CF5FD = { + isa = PBXGroup; + children = ( + 9D52B00D2CABDB80008CF5FD /* main.cpp */, + 9D52B0042CABDB40008CF5FD /* Products */, + ); + sourceTree = ""; + }; + 9D52B0042CABDB40008CF5FD /* Products */ = { + isa = PBXGroup; + children = ( + 9D52B0032CABDB40008CF5FD /* xcode-test */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 9D52B0022CABDB40008CF5FD /* xcode-test */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9D52B00A2CABDB40008CF5FD /* Build configuration list for PBXNativeTarget "xcode-test" */; + buildPhases = ( + 9D52AFFF2CABDB40008CF5FD /* Sources */, + 9D52B0002CABDB40008CF5FD /* Frameworks */, + 9D52B0012CABDB40008CF5FD /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "xcode-test"; + packageProductDependencies = ( + ); + productName = "xcode-test"; + productReference = 9D52B0032CABDB40008CF5FD /* xcode-test */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9D52AFFB2CABDB40008CF5FD /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastUpgradeCheck = 1600; + TargetAttributes = { + 9D52B0022CABDB40008CF5FD = { + CreatedOnToolsVersion = 16.0; + }; + }; + }; + buildConfigurationList = 9D52AFFE2CABDB40008CF5FD /* Build configuration list for PBXProject "xcode-test" */; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 9D52AFFA2CABDB40008CF5FD; + minimizedProjectReferenceProxies = 1; + preferredProjectObjectVersion = 77; + productRefGroup = 9D52B0042CABDB40008CF5FD /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 9D52B0022CABDB40008CF5FD /* xcode-test */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 9D52AFFF2CABDB40008CF5FD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9D52B00E2CABDB80008CF5FD /* main.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 9D52B0082CABDB40008CF5FD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 11.5; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 9D52B0092CABDB40008CF5FD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MACOSX_DEPLOYMENT_TARGET = 11.5; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = macosx; + }; + name = Release; + }; + 9D52B00B2CABDB40008CF5FD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 9D52B00C2CABDB40008CF5FD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 9D52AFFE2CABDB40008CF5FD /* Build configuration list for PBXProject "xcode-test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9D52B0082CABDB40008CF5FD /* Debug */, + 9D52B0092CABDB40008CF5FD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9D52B00A2CABDB40008CF5FD /* Build configuration list for PBXNativeTarget "xcode-test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9D52B00B2CABDB40008CF5FD /* Debug */, + 9D52B00C2CABDB40008CF5FD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9D52AFFB2CABDB40008CF5FD /* Project object */; +}