You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CI环境运行Swift PeripheryApp遇Xcode构建错误及磁盘空间问题

解决CI环境下PeripheryApp磁盘占用过高及xcodebuild错误方案

问题分析

你遇到的xcodebuild退出状态70错误,核心原因是CI环境磁盘空间不足——Periphery默认生成的索引数据、DerivedData会占用大量磁盘,而CI环境的磁盘配额通常远小于本地机器。

具体解决步骤

  • 指定DerivedData到临时目录
    CI环境一般提供临时存储路径(如GitHub Actions的$RUNNER_TEMP),将Periphery的DerivedData指向这里,既不占用主磁盘空间,任务结束后还会自动清理:

    periphery scan --project $(Build.SourcesDirectory)/app-ios/MyApp.xcworkspace --schemes MyApp --derived-data-path $RUNNER_TEMP/PeripheryDerivedData
    
  • 关闭冗余编译索引选项
    Periphery默认开启的COMPILER_INDEX_STORE_ENABLE和INDEX_ENABLE_DATA_STORE会生成大量索引文件,直接关闭这两个选项可大幅降低磁盘占用,且不影响无用代码分析功能:

    periphery scan --project $(Build.SourcesDirectory)/app-ios/MyApp.xcworkspace --schemes MyApp --xcodebuild-arguments "COMPILER_INDEX_STORE_ENABLE=NO INDEX_ENABLE_DATA_STORE=NO"
    
  • 提前清理CI环境缓存
    执行Periphery前手动清理旧缓存和DerivedData,快速释放磁盘空间:

    rm -rf ~/Library/Caches/com.github.peripheryapp
    rm -rf $(xcodebuild -showBuildSettings | grep -m 1 -o "/.*DerivedData")
    
  • 拆分扫描范围
    针对大型项目,按target拆分扫描任务,减小单次扫描的磁盘占用压力:

    periphery scan --project $(Build.SourcesDirectory)/app-ios/MyApp.xcworkspace --targets MyAppCore,MyAppUI
    

内容的提问来源于stack exchange,提问作者Robert

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 12:07:05