From 057fe86cdc4035ca58772ae47038f1e134f24895 Mon Sep 17 00:00:00 2001 From: aa2013 <47207976+aa2013@users.noreply.github.com> Date: Thu, 9 Apr 2026 09:42:44 +0800 Subject: [PATCH 1/3] Add GitHub Actions CI to build Lua XCFramework --- .github/workflows/ios-xcframework-ci.yml | 41 ++++++++++++++++++++++++ README.md | 13 +++++++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ios-xcframework-ci.yml diff --git a/.github/workflows/ios-xcframework-ci.yml b/.github/workflows/ios-xcframework-ci.yml new file mode 100644 index 0000000..b8003d2 --- /dev/null +++ b/.github/workflows/ios-xcframework-ci.yml @@ -0,0 +1,41 @@ +name: Build iOS Lua XCFramework + +on: + push: + branches: + - main + - master + pull_request: + workflow_dispatch: + +jobs: + build-xcframework: + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Show Xcode version + run: xcodebuild -version + + - name: Build lua_public aggregate target + run: | + xcodebuild \ + -project LuaFramework.xcodeproj \ + -scheme lua_public \ + -configuration Release \ + -destination 'generic/platform=iOS' \ + build + + - name: Validate generated XCFramework + run: | + test -d "Products/LuaFramework.xcframework" + /usr/libexec/PlistBuddy -c "Print :CFBundlePackageType" Products/LuaFramework.xcframework/Info.plist + + - name: Upload XCFramework artifact + uses: actions/upload-artifact@v4 + with: + name: LuaFramework-xcframework + path: Products/LuaFramework.xcframework + if-no-files-found: error diff --git a/README.md b/README.md index d493ac4..1f54c81 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,15 @@ Select the `lua_public` TARGET and click run to compile. After compilation succeeds, the folder will open automatically. -[Reference article](https://zhuanlan.zhihu.com/p/677506571) \ No newline at end of file +[Reference article](https://zhuanlan.zhihu.com/p/677506571) + +## CI + +This repository includes a GitHub Actions workflow: + +- File: `.github/workflows/ios-xcframework-ci.yml` +- Trigger: `push` (`main`/`master`), `pull_request`, `workflow_dispatch` +- Job platform: `macos-latest` +- Output artifact: `LuaFramework-xcframework` + +The workflow builds target `lua_public`, validates `Products/LuaFramework.xcframework`, then uploads it as a downloadable artifact. From 779604ee8438fd1a5a143deef08c783fe1eca16b Mon Sep 17 00:00:00 2001 From: aa2013 <47207976+aa2013@users.noreply.github.com> Date: Thu, 9 Apr 2026 09:46:30 +0800 Subject: [PATCH 2/3] Fix CI build command for aggregate scheme destination --- .github/workflows/ios-xcframework-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ios-xcframework-ci.yml b/.github/workflows/ios-xcframework-ci.yml index b8003d2..a25d410 100644 --- a/.github/workflows/ios-xcframework-ci.yml +++ b/.github/workflows/ios-xcframework-ci.yml @@ -21,11 +21,12 @@ jobs: - name: Build lua_public aggregate target run: | + # Aggregate targets only support macOS destinations in CI; + # do not pass iOS destination specifiers here. xcodebuild \ -project LuaFramework.xcodeproj \ -scheme lua_public \ -configuration Release \ - -destination 'generic/platform=iOS' \ build - name: Validate generated XCFramework From 4636a8c1ca37b37cda050a431dddebba34dde463 Mon Sep 17 00:00:00 2001 From: aa2013 <47207976+aa2013@users.noreply.github.com> Date: Thu, 9 Apr 2026 09:51:29 +0800 Subject: [PATCH 3/3] Disable code signing in archive script for CI builds --- LuaFramework.xcodeproj/project.pbxproj | 29 +++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/LuaFramework.xcodeproj/project.pbxproj b/LuaFramework.xcodeproj/project.pbxproj index 6f47276..391519a 100644 --- a/LuaFramework.xcodeproj/project.pbxproj +++ b/LuaFramework.xcodeproj/project.pbxproj @@ -178,7 +178,34 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#设置编译的target\ntargetName=\"LuaFramework\"\n#设置生成的framework的名称\nframeworkName=${targetName}\n#模拟器版本编译产物路径\nsimultorArchivePath=\"${BUILD_DIR}/${CONFIGURATION}/${frameworkName}-iphonesimulator.xcarchive\"\n#真机版本编译产物路径\ndeviceArchivePath=\"${BUILD_DIR}/${CONFIGURATION}/${frameworkName}-iphoneos.xcarchive\"\n#存储编译后产物的存储路径\noutput=${SRCROOT}/Products\n\n#删除上次编译后的产物\nrm -rf \"${output}\"\n\n#编译模拟器版本\nxcodebuild archive \\\n -scheme ${targetName} \\\n -archivePath ${simultorArchivePath} \\\n -sdk iphonesimulator \\\n SKIP_INSTALL=NO \\\n BUILD_LIBRARIES_FOR_DISTRIBUTION=YES\n\n#编译真机版本\nxcodebuild archive \\\n -scheme ${targetName} \\\n -archivePath ${deviceArchivePath} \\\n -sdk iphoneos \\\n SKIP_INSTALL=NO \\\n BUILD_LIBRARIES_FOR_DISTRIBUTION=YES\n\n#合并真机和模拟器版本,生成xcframework\nxcodebuild -create-xcframework \\\n -framework ${simultorArchivePath}/Products/Library/Frameworks/${frameworkName}.framework \\\n -framework ${deviceArchivePath}/Products/Library/Frameworks/${frameworkName}.framework \\\n -output ${output}/${frameworkName}.xcframework\n\n#打开编译后产物路径\nopen ${output}\n"; + shellScript = "#设置编译的target +targetName=\"LuaFramework\" +#设置生成的framework的名称 +frameworkName=${targetName} +#模拟器版本编译产物路径 +simultorArchivePath=\"${BUILD_DIR}/${CONFIGURATION}/${frameworkName}-iphonesimulator.xcarchive\" +#真机版本编译产物路径 +deviceArchivePath=\"${BUILD_DIR}/${CONFIGURATION}/${frameworkName}-iphoneos.xcarchive\" +#存储编译后产物的存储路径 +output=${SRCROOT}/Products + +#删除上次编译后的产物 +rm -rf \"${output}\" + +#编译模拟器版本(关闭签名,适配CI环境) +xcodebuild archive -scheme ${targetName} -archivePath ${simultorArchivePath} -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO + +#编译真机版本(关闭签名,适配CI环境) +xcodebuild archive -scheme ${targetName} -archivePath ${deviceArchivePath} -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES CODE_SIGNING_ALLOWED=NO CODE_SIGNING_REQUIRED=NO + +#合并真机和模拟器版本,生成xcframework +xcodebuild -create-xcframework -framework ${simultorArchivePath}/Products/Library/Frameworks/${frameworkName}.framework -framework ${deviceArchivePath}/Products/Library/Frameworks/${frameworkName}.framework -output ${output}/${frameworkName}.xcframework + +#打开编译后产物路径(本地调试时自动打开,CI中跳过) +if [ -z \"${CI}\" ]; then + open ${output} +fi +"; }; /* End PBXShellScriptBuildPhase section */