Skip to content

Commit

Permalink
build: download visionOS SDK if needed (#331)
Browse files Browse the repository at this point in the history
* build: download visionOS SDK if needed

* ci: update ci

* build: add manual build xcframework workflow
  • Loading branch information
YoloMao authored Oct 9, 2024
1 parent 5ae45bc commit c97ef39
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 14 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build_xcframework_manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build XCFramework

on: workflow_dispatch

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
publish:
runs-on: macos-latest

steps:
# https://github.com/actions/runner-images/issues/10559
- name: Download visionOS SDK
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GIOSDK_PAT }}

- name: Generate xcframework
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
CODESIGN_IDENTIFY_NAME: ${{ secrets.CODESIGN_IDENTIFY_NAME }}
run:
sh ./scripts/generate_xcframework.sh releaseDefaultAutotracker --codesign --verbose

- name: Archive
run: |
cd ./generate
tar -czvf GrowingAnalytics.xcframework.tar.gz ./Release
zip -r -y GrowingAnalytics.xcframework.zip ./Release
- name: Upload
uses: actions/upload-artifact@v4
with:
name: archive
path: |
./generate/GrowingAnalytics.xcframework.tar.gz
./generate/GrowingAnalytics.xcframework.zip
8 changes: 8 additions & 0 deletions .github/workflows/cocoapods.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ jobs:
runs-on: macos-latest

steps:
# https://github.com/actions/runner-images/issues/10559
- name: Download visionOS SDK
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
- uses: actions/checkout@v4

- name: Deploy to Cocoapods
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/cocoapods_beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# https://github.com/actions/runner-images/issues/10559
- name: Download visionOS SDK
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/cocoapods_beta_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ jobs:
if: ${{ github.ref != 'refs/heads/master' }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# https://github.com/actions/runner-images/issues/10559
- name: Download visionOS SDK
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/draft_release_with_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ jobs:
echo "Not running on master branch"
exit 1
fi
# https://github.com/actions/runner-images/issues/10559
- name: Download visionOS SDK
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
- name: Checkout
uses: actions/checkout@v4
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/draft_release_without_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ jobs:
exit 1
fi
# https://github.com/actions/runner-images/issues/10559
- name: Download visionOS SDK
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
- name: Checkout
uses: actions/checkout@v4
with:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/spm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ jobs:
scheme: GrowingTracker
runs-on: ${{ matrix.os }}
steps:
# https://github.com/actions/runner-images/issues/10559
- name: Download visionOS SDK
if: ${{ matrix.target == 'visionOS' }}
run: |
sudo xcodebuild -runFirstLaunch
sudo xcrun simctl list
sudo xcodebuild -downloadPlatform visionOS
sudo xcodebuild -runFirstLaunch
- name: Checkout Repo
uses: actions/checkout@v4
- name: Xcode
Expand Down
30 changes: 16 additions & 14 deletions scripts/generate_xcframework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ generateProjects() {
prepareGenerateOnlyTrackerProjects
generateProjectByPlatform "macOS"
generateProjectByPlatform "watchOS"
# generateProjectByPlatform "visionOS"
generateProjectByPlatform "visionOS"

logger -v "step: reset podspec"
mv "${MAIN_FRAMEWORK_NAME}-backup.podspec" "${MAIN_FRAMEWORK_NAME}.podspec"
Expand All @@ -228,8 +228,8 @@ generate_xcframework() {
tv_simulator_archive_path="${archive_path}/tvsimulator"
watch_os_archive_path="${archive_path}/watchos"
watch_simulator_archive_path="${archive_path}/watchsimulator"
# vision_os_archive_path="${archive_path}/visionos"
# vision_simulator_archive_path="${archive_path}/visionsimulator"
vision_os_archive_path="${archive_path}/visionos"
vision_simulator_archive_path="${archive_path}/visionsimulator"
output_path="./${FOLDER_NAME}/Release/${framework_name//-/_}.xcframework"
common_args="archive -workspace ./${PROJECT_PATH_PREFIX}/iOS/${MAIN_FRAMEWORK_NAME}/${MAIN_FRAMEWORK_NAME}.xcworkspace \
-scheme ${framework_name} -configuration 'Release' -derivedDataPath ./${FOLDER_NAME}/derivedData"
Expand Down Expand Up @@ -287,23 +287,23 @@ generate_xcframework() {
-destination "generic/platform=watchOS Simulator" \
-archivePath ${watch_simulator_archive_path} || exit 1

# logger -v "step: generate ${framework_name} xros-arm64 framework(Only Tracker)"
# common_args_for_vision_os=$(echo "$common_args" | sed 's/iOS/visionOS/g')
# xcodebuild ${common_args_for_vision_os} \
# -destination "generic/platform=visionOS" \
# -archivePath ${vision_os_archive_path} || exit 1
logger -v "step: generate ${framework_name} xros-arm64 framework(Only Tracker)"
common_args_for_vision_os=$(echo "$common_args" | sed 's/iOS/visionOS/g')
xcodebuild ${common_args_for_vision_os} \
-destination "generic/platform=visionOS" \
-archivePath ${vision_os_archive_path} || exit 1

# logger -v "step: generate ${framework_name} xros-arm64_x86_64-simulator framework(Only Tracker)"
# common_args_for_vision_simulator=$(echo "$common_args" | sed 's/iOS/visionOS/g')
# xcodebuild ${common_args_for_vision_simulator} \
# -destination "generic/platform=visionOS Simulator" \
# -archivePath ${vision_simulator_archive_path} || exit 1
logger -v "step: generate ${framework_name} xros-arm64_x86_64-simulator framework(Only Tracker)"
common_args_for_vision_simulator=$(echo "$common_args" | sed 's/iOS/visionOS/g')
xcodebuild ${common_args_for_vision_simulator} \
-destination "generic/platform=visionOS Simulator" \
-archivePath ${vision_simulator_archive_path} || exit 1

logger -v "step: delete _CodeSignature folder in simulator framework which is unnecessary"
rm -rf ${iphone_simulator_archive_path}${framework_path_suffix}/_CodeSignature
rm -rf ${tv_simulator_archive_path}${framework_path_suffix}/_CodeSignature
rm -rf ${watch_simulator_archive_path}${framework_path_suffix}/_CodeSignature
# rm -rf ${vision_simulator_archive_path}${framework_path_suffix}/_CodeSignature
rm -rf ${vision_simulator_archive_path}${framework_path_suffix}/_CodeSignature

xcodebuild -create-xcframework \
-framework ${iphone_os_archive_path}${framework_path_suffix} \
Expand All @@ -314,6 +314,8 @@ generate_xcframework() {
-framework ${tv_simulator_archive_path}${framework_path_suffix} \
-framework ${watch_os_archive_path}${framework_path_suffix} \
-framework ${watch_simulator_archive_path}${framework_path_suffix} \
-framework ${vision_os_archive_path}${framework_path_suffix} \
-framework ${vision_simulator_archive_path}${framework_path_suffix} \
-output ${output_path} || exit 1
else
logger -v "step: delete _CodeSignature folder in simulator framework which is unnecessary"
Expand Down

0 comments on commit c97ef39

Please sign in to comment.