-
Notifications
You must be signed in to change notification settings - Fork 25.2k
CI: add SwiftPM iOS e2e workflows (RNTester, HelloWorld, new app) #57659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
chrfalch
wants to merge
11
commits into
main
Choose a base branch
from
chrfalch/add-e2e-tests-for-swiftpm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+456
−0
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
387bc99
CI: add SwiftPM iOS e2e workflows (RNTester, HelloWorld, new app)
chrfalch da5340e
CI: build only the slices a caller needs in the prebuild-ios workflows
chrfalch 18322da
CI: fix Flow errors in the SwiftPM e2e scripts
chrfalch 0df922c
CI: fix remaining Flow error in spm-ios-e2e.js execFileSync env
chrfalch dd19bfc
CI: align the SwiftPM iOS workflows with the repo's CI conventions
chrfalch c2f0979
CI: retrigger — upstream SPM script fixes (#57660) landed on main
chrfalch 3a63fd6
CI: retrigger — #57660 and #57697 both landed on main
chrfalch 0466bcc
CI: drop the HERMES_CLI_PATH step from the SwiftPM workflows
chrfalch 853bcd7
CI: retrigger — #57660, #57697 and #57718 all landed on main
chrfalch 9971172
CI: rename the artifact step in the SwiftPM workflows
chrfalch db7b2d5
CI: make the SwiftPM lanes blocking
chrfalch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| name: Test iOS SwiftPM - Hello World | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: macos-15-large | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| flavor: [Debug, Release] | ||
| env: | ||
| APP_IOS_DIR: private/helloworld/ios | ||
| XCODE_PROJECT: HelloWorld.xcodeproj | ||
| XCODE_SCHEME: HelloWorld | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| - name: Setup xcode | ||
| uses: ./.github/actions/setup-xcode | ||
| - name: Setup node.js | ||
| uses: ./.github/actions/setup-node | ||
| - name: Run yarn install | ||
| uses: ./.github/actions/yarn-install | ||
| - name: Set Hermes prebuilt version | ||
| shell: bash | ||
| run: node ./scripts/releases/use-hermes-prebuilt.js | ||
| - name: Run yarn install again, with the correct hermes version | ||
| uses: ./.github/actions/yarn-install | ||
| - name: Ensure CocoaPods (`spm add --deintegrate` shells out to `pod`) | ||
| shell: bash | ||
| run: pod --version || sudo gem install cocoapods --no-document | ||
| # Both flavors are needed by every matrix cell, not just the one it builds: | ||
| # `spm add` stages both flavor framework trees and lets a per-configuration | ||
| # build setting pick one at build time, so it validates the debug/ and | ||
| # release/ artifact slots together (and `--download skip` refuses an | ||
| # incomplete slot). Please don't "optimise" this down to one flavor. | ||
| - name: Download ReactCore (Debug) | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: ReactCoreDebug.xcframework.tar.gz | ||
| path: /tmp/rc-debug | ||
| - name: Download ReactCore (Release) | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: ReactCoreRelease.xcframework.tar.gz | ||
| path: /tmp/rc-release | ||
|
chrfalch marked this conversation as resolved.
|
||
| - name: Download ReactNativeDependencies (Debug) | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: ReactNativeDependenciesDebug.xcframework.tar.gz | ||
| path: /tmp/deps-debug | ||
| - name: Download ReactNativeDependencies (Release) | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: ReactNativeDependenciesRelease.xcframework.tar.gz | ||
| path: /tmp/deps-release | ||
| # The ordinary `spm download`, pointed at the XCFrameworks this run just | ||
| # built rather than at the published nightly (RN_CORE_TARBALL_PATH / | ||
| # RN_DEPS_TARBALL_PATH are overrides download-spm-artifacts.js already | ||
| # supports). It fills both flavor slots per call and skips any slot that | ||
| # already validates, so it runs twice: the first pass fills both slots | ||
| # from the Release tarballs, then debug/ is dropped and refilled from the | ||
| # Debug tarballs while release/ is left alone. hermes-engine is fetched | ||
| # from Maven by the command itself. | ||
| - name: Download XCFrameworks built in this run (Debug + Release) | ||
| shell: bash | ||
| working-directory: ${{ env.APP_IOS_DIR }} | ||
| run: | | ||
| RN_CORE_TARBALL_PATH=/tmp/rc-release/ReactCoreRelease.xcframework.tar.gz \ | ||
| RN_DEPS_TARBALL_PATH=/tmp/deps-release/ReactNativeDependenciesRelease.xcframework.tar.gz \ | ||
| npx react-native spm download --artifacts /tmp/spm-artifacts | ||
| rm -rf /tmp/spm-artifacts/debug | ||
| RN_CORE_TARBALL_PATH=/tmp/rc-debug/ReactCoreDebug.xcframework.tar.gz \ | ||
| RN_DEPS_TARBALL_PATH=/tmp/deps-debug/ReactNativeDependenciesDebug.xcframework.tar.gz \ | ||
| npx react-native spm download --artifacts /tmp/spm-artifacts | ||
| - name: Scaffold Package.swift manifests for community dependencies | ||
| shell: bash | ||
| working-directory: ${{ env.APP_IOS_DIR }} | ||
| run: npx react-native spm scaffold || true | ||
| - name: Convert the app to SwiftPM | ||
| shell: bash | ||
| working-directory: ${{ env.APP_IOS_DIR }} | ||
| run: npx react-native spm add --deintegrate --artifacts /tmp/spm-artifacts --download skip | ||
| - name: Assert the app is on SwiftPM | ||
| shell: bash | ||
| working-directory: ${{ env.APP_IOS_DIR }} | ||
| run: | | ||
| if [[ ! -f "$XCODE_PROJECT/.spm-injected.json" ]]; then | ||
| echo "::error::spm add did not inject SwiftPM: $XCODE_PROJECT/.spm-injected.json is missing" | ||
| exit 1 | ||
| fi | ||
| if [[ -f Podfile ]] && grep -q 'use_react_native!' Podfile; then | ||
| echo "::error::spm add --deintegrate left use_react_native! in the Podfile" | ||
| exit 1 | ||
| fi | ||
| echo "SwiftPM injected in place; Podfile de-integrated." | ||
| - name: Build ${{ env.XCODE_SCHEME }} (${{ matrix.flavor }}) | ||
| shell: bash | ||
| working-directory: ${{ env.APP_IOS_DIR }} | ||
| run: | | ||
| xcodebuild \ | ||
| -project "$XCODE_PROJECT" \ | ||
| -scheme "$XCODE_SCHEME" \ | ||
| -configuration "${{ matrix.flavor }}" \ | ||
| -sdk iphonesimulator \ | ||
| -destination 'generic/platform=iOS Simulator' \ | ||
| -derivedDataPath build/spm-e2e-dd \ | ||
| build | ||
| - name: Check the embedded React.framework flavor | ||
| shell: bash | ||
| working-directory: ${{ env.APP_IOS_DIR }} | ||
| run: | | ||
| PRODUCTS="build/spm-e2e-dd/Build/Products/${{ matrix.flavor }}-iphonesimulator" | ||
| if [[ ! -d "$PRODUCTS" ]]; then | ||
| echo "Skipping flavor check: no build products directory." | ||
| exit 0 | ||
| fi | ||
| BINARY=$(find "$PRODUCTS" -maxdepth 4 -path '*.app/Frameworks/React.framework/React' -type f 2>/dev/null | head -1 || true) | ||
| if [[ -z "$BINARY" ]] || ! command -v nm >/dev/null; then | ||
| echo "Skipping flavor check: no embedded React.framework binary or no nm." | ||
| exit 0 | ||
| fi | ||
| COUNT=$(nm "$BINARY" | grep -c getDebugProps || true) | ||
| echo "getDebugProps symbols in $BINARY: $COUNT" | ||
| if [[ "${{ matrix.flavor }}" == 'Debug' && "$COUNT" -eq 0 ]]; then | ||
| echo "::error::Debug build embeds a Release React.framework (expected getDebugProps symbols, found none)" | ||
| exit 1 | ||
| fi | ||
| if [[ "${{ matrix.flavor }}" == 'Release' && "$COUNT" -ne 0 ]]; then | ||
| echo "::error::Release build embeds a Debug React.framework ($COUNT getDebugProps symbols, expected none)" | ||
| exit 1 | ||
| fi | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| name: Test iOS SwiftPM - New App | ||
|
cipolleschi marked this conversation as resolved.
|
||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: macos-15-large | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| flavor: [Debug, Release] | ||
| env: | ||
| APP_IOS_DIR: private/helloworld/ios | ||
| XCODE_PROJECT: HelloWorld.xcodeproj | ||
| XCODE_SCHEME: HelloWorld | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| - name: Setup xcode | ||
| uses: ./.github/actions/setup-xcode | ||
| - name: Setup node.js | ||
| uses: ./.github/actions/setup-node | ||
| - name: Run yarn install | ||
| uses: ./.github/actions/yarn-install | ||
| - name: Set Hermes prebuilt version | ||
| shell: bash | ||
| run: node ./scripts/releases/use-hermes-prebuilt.js | ||
| - name: Run yarn install again, with the correct hermes version | ||
| uses: ./.github/actions/yarn-install | ||
| - name: Ensure CocoaPods (`spm add --deintegrate` shells out to `pod`) | ||
| shell: bash | ||
| run: pod --version || sudo gem install cocoapods --no-document | ||
| # Both flavors are needed by every matrix cell, not just the one it builds: | ||
| # `spm add` stages both flavor framework trees and lets a per-configuration | ||
| # build setting pick one at build time, so it validates the debug/ and | ||
| # release/ artifact slots together (and `--download skip` refuses an | ||
| # incomplete slot). Please don't "optimise" this down to one flavor. | ||
| - name: Download ReactCore (Debug) | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: ReactCoreDebug.xcframework.tar.gz | ||
| path: /tmp/rc-debug | ||
| - name: Download ReactCore (Release) | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: ReactCoreRelease.xcframework.tar.gz | ||
| path: /tmp/rc-release | ||
|
chrfalch marked this conversation as resolved.
|
||
| - name: Download ReactNativeDependencies (Debug) | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: ReactNativeDependenciesDebug.xcframework.tar.gz | ||
| path: /tmp/deps-debug | ||
| - name: Download ReactNativeDependencies (Release) | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: ReactNativeDependenciesRelease.xcframework.tar.gz | ||
| path: /tmp/deps-release | ||
| - name: Download React Native package | ||
| uses: actions/download-artifact@v7 | ||
| with: | ||
| name: react-native-package | ||
| path: /tmp/react-native-tmp | ||
| # Reinstalls private/helloworld in place against the packaged react-native | ||
| # (published through the local proxy), so the app under test is what a user | ||
| # would get from npm rather than the workspace source. | ||
| - name: Prepare the HelloWorld application | ||
| shell: bash | ||
| run: node ./scripts/e2e/init-project-e2e.js --useHelloWorld --pathToLocalReactNative "/tmp/react-native-tmp/$(cat /tmp/react-native-tmp/react-native-package-version)" | ||
| # The ordinary `spm download`, pointed at the XCFrameworks this run just | ||
| # built rather than at the published nightly (RN_CORE_TARBALL_PATH / | ||
| # RN_DEPS_TARBALL_PATH are overrides download-spm-artifacts.js already | ||
| # supports). It fills both flavor slots per call and skips any slot that | ||
| # already validates, so it runs twice: the first pass fills both slots | ||
| # from the Release tarballs, then debug/ is dropped and refilled from the | ||
| # Debug tarballs while release/ is left alone. hermes-engine is fetched | ||
| # from Maven by the command itself. | ||
| - name: Download XCFrameworks built in this run (Debug + Release) | ||
| shell: bash | ||
| working-directory: ${{ env.APP_IOS_DIR }} | ||
| run: | | ||
| RN_CORE_TARBALL_PATH=/tmp/rc-release/ReactCoreRelease.xcframework.tar.gz \ | ||
| RN_DEPS_TARBALL_PATH=/tmp/deps-release/ReactNativeDependenciesRelease.xcframework.tar.gz \ | ||
| npx react-native spm download --artifacts /tmp/spm-artifacts | ||
| rm -rf /tmp/spm-artifacts/debug | ||
| RN_CORE_TARBALL_PATH=/tmp/rc-debug/ReactCoreDebug.xcframework.tar.gz \ | ||
| RN_DEPS_TARBALL_PATH=/tmp/deps-debug/ReactNativeDependenciesDebug.xcframework.tar.gz \ | ||
| npx react-native spm download --artifacts /tmp/spm-artifacts | ||
| - name: Scaffold Package.swift manifests for community dependencies | ||
| shell: bash | ||
| working-directory: ${{ env.APP_IOS_DIR }} | ||
| run: npx react-native spm scaffold || true | ||
| - name: Convert the app to SwiftPM | ||
| shell: bash | ||
| working-directory: ${{ env.APP_IOS_DIR }} | ||
| run: npx react-native spm add --deintegrate --artifacts /tmp/spm-artifacts --download skip | ||
| - name: Assert the app is on SwiftPM | ||
| shell: bash | ||
| working-directory: ${{ env.APP_IOS_DIR }} | ||
| run: | | ||
| if [[ ! -f "$XCODE_PROJECT/.spm-injected.json" ]]; then | ||
| echo "::error::spm add did not inject SwiftPM: $XCODE_PROJECT/.spm-injected.json is missing" | ||
| exit 1 | ||
| fi | ||
| if [[ -f Podfile ]] && grep -q 'use_react_native!' Podfile; then | ||
| echo "::error::spm add --deintegrate left use_react_native! in the Podfile" | ||
| exit 1 | ||
| fi | ||
| echo "SwiftPM injected in place; Podfile de-integrated." | ||
| - name: Build ${{ env.XCODE_SCHEME }} (${{ matrix.flavor }}) | ||
| shell: bash | ||
| working-directory: ${{ env.APP_IOS_DIR }} | ||
| run: | | ||
| xcodebuild \ | ||
| -project "$XCODE_PROJECT" \ | ||
| -scheme "$XCODE_SCHEME" \ | ||
| -configuration "${{ matrix.flavor }}" \ | ||
| -sdk iphonesimulator \ | ||
| -destination 'generic/platform=iOS Simulator' \ | ||
| -derivedDataPath build/spm-e2e-dd \ | ||
| build | ||
| - name: Check the embedded React.framework flavor | ||
| shell: bash | ||
| working-directory: ${{ env.APP_IOS_DIR }} | ||
| run: | | ||
| PRODUCTS="build/spm-e2e-dd/Build/Products/${{ matrix.flavor }}-iphonesimulator" | ||
| if [[ ! -d "$PRODUCTS" ]]; then | ||
| echo "Skipping flavor check: no build products directory." | ||
| exit 0 | ||
| fi | ||
| BINARY=$(find "$PRODUCTS" -maxdepth 4 -path '*.app/Frameworks/React.framework/React' -type f 2>/dev/null | head -1 || true) | ||
| if [[ -z "$BINARY" ]] || ! command -v nm >/dev/null; then | ||
| echo "Skipping flavor check: no embedded React.framework binary or no nm." | ||
| exit 0 | ||
| fi | ||
| COUNT=$(nm "$BINARY" | grep -c getDebugProps || true) | ||
| echo "getDebugProps symbols in $BINARY: $COUNT" | ||
| if [[ "${{ matrix.flavor }}" == 'Debug' && "$COUNT" -eq 0 ]]; then | ||
| echo "::error::Debug build embeds a Release React.framework (expected getDebugProps symbols, found none)" | ||
| exit 1 | ||
| fi | ||
| if [[ "${{ matrix.flavor }}" == 'Release' && "$COUNT" -ne 0 ]]; then | ||
| echo "::error::Release build embeds a Debug React.framework ($COUNT getDebugProps symbols, expected none)" | ||
| exit 1 | ||
| fi | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.