Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/prebuild-ios-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ on:
type: boolean
required: false
default: false
slices:
description: 'JSON array of Apple platform slices to build. Defaults to the full set; callers that only consume a subset (e.g. a simulator-only e2e build) can pass fewer to save time.'
type: string
required: false
default: '["ios", "ios-simulator", "mac-catalyst"]'

jobs:
build-rn-slice:
Expand All @@ -21,7 +26,7 @@ jobs:
fail-fast: false
matrix:
flavor: ['Debug', 'Release']
slice: ['ios', 'ios-simulator', 'mac-catalyst']
slice: ${{ fromJSON(inputs.slices) }}
steps:
- name: Checkout
uses: actions/checkout@v6
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/prebuild-ios-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Prebuild iOS Dependencies

on:
workflow_call: # this directive allow us to call this workflow from other workflows
inputs:
slices:
description: 'JSON array of Apple platform slices to build. Defaults to the full set; callers that only consume a subset (e.g. a simulator-only e2e build) can pass fewer to save time.'
type: string
required: false
default: '["ios", "ios-simulator", "macos", "mac-catalyst", "tvos", "tvos-simulator", "xros", "xros-simulator"]'

jobs:
prepare_workspace:
Expand Down Expand Up @@ -51,17 +57,7 @@ jobs:
fail-fast: false
matrix:
flavor: ['Debug', 'Release']
slice:
[
'ios',
'ios-simulator',
'macos',
'mac-catalyst',
'tvos',
'tvos-simulator',
'xros',
'xros-simulator',
]
slice: ${{ fromJSON(inputs.slices) }}
steps:
- name: Checkout
uses: actions/checkout@v6
Expand Down
115 changes: 115 additions & 0 deletions .github/workflows/test-ios-spm-helloworld.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: Test iOS SwiftPM - Hello World

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would just create the workflow and call it from test-all. I would not add a cron job here. We should rely on the nightly trigger.


permissions:
contents: read

on:
workflow_dispatch:
inputs:
flavor:
description: 'Which build configuration(s) to test'
type: choice
options:
- both
- Debug
- Release
default: both
schedule:
# Nightly at 07:00 UTC (low-traffic hour).
- cron: '0 7 * * *'

jobs:
prebuild_apple_dependencies:
uses: ./.github/workflows/prebuild-ios-dependencies.yml
with:
# e2e only compiles for the iOS simulator — no need for device/catalyst/tv/xr slices.
slices: '["ios-simulator"]'
secrets: inherit

prebuild_react_native_core:
needs: [prebuild_apple_dependencies]
if: ${{ needs.prebuild_apple_dependencies.result == 'success' }}
uses: ./.github/workflows/prebuild-ios-core.yml
with:
use-hermes-prebuilt: ${{ !endsWith(github.ref_name, '-stable') }}
slices: '["ios-simulator"]'
secrets: inherit
Comment on lines +22 to +36

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have to depend on the job that creates the XCFramework and download the XCFramework directly and use that one. We don't want to run the prebuild for these jobs. We want to consume the prebuilds we are creating.


set_flavors:
runs-on: ubuntu-latest
outputs:
flavors: ${{ steps.compute.outputs.flavors }}
steps:
- id: compute
env:
FLAVOR: ${{ github.event.inputs.flavor }}
run: |
case "$FLAVOR" in
Debug) echo 'flavors=["Debug"]' >> "$GITHUB_OUTPUT" ;;
Release) echo 'flavors=["Release"]' >> "$GITHUB_OUTPUT" ;;
*) echo 'flavors=["Debug","Release"]' >> "$GITHUB_OUTPUT" ;;
esac

test:
needs: [prebuild_react_native_core, set_flavors]
if: ${{ needs.prebuild_react_native_core.result == 'success' }}
runs-on: macos-15-large
strategy:
fail-fast: false
matrix:
flavor: ${{ fromJSON(needs.set_flavors.outputs.flavors) }}
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 (needed by `spm add --deintegrate`)
shell: bash
run: pod --version || sudo gem install cocoapods --no-document
# `spm add --artifacts` validates BOTH the debug/ and release/ slots, so
# download both flavors regardless of which one this cell builds.
- 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
Comment on lines +80 to +89

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't have to download both. You can have a matrix and run Debug and Release in parallel.

- 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: Prime SPM artifacts (Debug + Release)
shell: bash
run: |
node scripts/e2e/spm-prime-artifacts.js --artifacts /tmp/spm-artifacts --flavor Debug \
--core-tarball /tmp/rc-debug/ReactCoreDebug.xcframework.tar.gz \
--deps-tarball /tmp/deps-debug/ReactNativeDependenciesDebug.xcframework.tar.gz
node scripts/e2e/spm-prime-artifacts.js --artifacts /tmp/spm-artifacts --flavor Release \
--core-tarball /tmp/rc-release/ReactCoreRelease.xcframework.tar.gz \
--deps-tarball /tmp/deps-release/ReactNativeDependenciesRelease.xcframework.tar.gz
- name: Convert to SwiftPM + build
shell: bash
run: |
node scripts/e2e/spm-ios-e2e.js \
--app helloworld \
--flavor "${{ matrix.flavor }}" \
--artifacts /tmp/spm-artifacts
155 changes: 155 additions & 0 deletions .github/workflows/test-ios-spm-newapp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: Test iOS SwiftPM - New App

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


permissions:
contents: read

on:
workflow_dispatch:
inputs:
flavor:
description: 'Which build configuration(s) to test'
type: choice
options:
- both
- Debug
- Release
default: both
schedule:
# Nightly at 08:00 UTC (low-traffic hour).
- cron: '0 8 * * *'

jobs:
prebuild_apple_dependencies:
uses: ./.github/workflows/prebuild-ios-dependencies.yml
with:
# e2e only compiles for the iOS simulator — no need for device/catalyst/tv/xr slices.
slices: '["ios-simulator"]'
secrets: inherit

prebuild_react_native_core:
needs: [prebuild_apple_dependencies]
if: ${{ needs.prebuild_apple_dependencies.result == 'success' }}
uses: ./.github/workflows/prebuild-ios-core.yml
with:
use-hermes-prebuilt: ${{ !endsWith(github.ref_name, '-stable') }}
slices: '["ios-simulator"]'
secrets: inherit
Comment on lines +22 to +36

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above


# Produces the `react-native-package` artifact (a local react-native .tgz) the
# fresh app installs. Mirrors test-all.yml's build_npm_package (dry-run upload).
build_npm_package:
runs-on: 8-core-ubuntu
container:
image: reactnativecommunity/react-native-android:latest
env:
TERM: 'dumb'
LC_ALL: C.UTF8
GRADLE_OPTS: '-Dorg.gradle.daemon=false'
REACT_NATIVE_DOWNLOADS_DIR: /opt/react-native-downloads
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Build NPM Package
uses: ./.github/actions/build-npm-package
with:
release-type: dry-run
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
skip-apple-prebuilts: 'true'
Comment on lines +40 to +57

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we rerun the build npm package when running the template app e2e tests. we should not do it here either.


set_flavors:
runs-on: ubuntu-latest
outputs:
flavors: ${{ steps.compute.outputs.flavors }}
steps:
- id: compute
env:
FLAVOR: ${{ github.event.inputs.flavor }}
run: |
case "$FLAVOR" in
Debug) echo 'flavors=["Debug"]' >> "$GITHUB_OUTPUT" ;;
Release) echo 'flavors=["Release"]' >> "$GITHUB_OUTPUT" ;;
*) echo 'flavors=["Debug","Release"]' >> "$GITHUB_OUTPUT" ;;
esac

test:
needs: [prebuild_react_native_core, build_npm_package, set_flavors]
if: ${{ needs.prebuild_react_native_core.result == 'success' && needs.build_npm_package.result == 'success' }}
runs-on: macos-15-large
strategy:
fail-fast: false
matrix:
flavor: ${{ fromJSON(needs.set_flavors.outputs.flavors) }}
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 (needed by `spm add --deintegrate`)
shell: bash
run: pod --version || sudo gem install cocoapods --no-document
- name: Configure git (Verdaccio publish + build)
shell: bash
run: |
git config --global user.email "react-native-bot@meta.com"
git config --global user.name "React Native Bot"
- name: Download React Native package
uses: actions/download-artifact@v7
with:
name: react-native-package
path: /tmp/react-native-tmp
# `spm add --artifacts` validates BOTH the debug/ and release/ slots, so
# download both flavors regardless of which one this cell builds.
- 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
Comment on lines +111 to +120

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, Debug and release should run in parallel.

- 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: Prime SPM artifacts (Debug + Release)
shell: bash
run: |
node scripts/e2e/spm-prime-artifacts.js --artifacts /tmp/spm-artifacts --flavor Debug \
--core-tarball /tmp/rc-debug/ReactCoreDebug.xcframework.tar.gz \
--deps-tarball /tmp/deps-debug/ReactNativeDependenciesDebug.xcframework.tar.gz
node scripts/e2e/spm-prime-artifacts.js --artifacts /tmp/spm-artifacts --flavor Release \
--core-tarball /tmp/rc-release/ReactCoreRelease.xcframework.tar.gz \
--deps-tarball /tmp/deps-release/ReactNativeDependenciesRelease.xcframework.tar.gz
- name: Convert to SwiftPM + build
shell: bash
run: |
mapfile -t RN_PKGS < <(find /tmp/react-native-tmp -type f -name "*.tgz")
if [[ ${#RN_PKGS[@]} -ne 1 ]]; then
echo "Expected exactly one react-native .tgz in /tmp/react-native-tmp, found ${#RN_PKGS[@]}:" >&2
printf ' %s\n' "${RN_PKGS[@]}" >&2
exit 1
fi
REACT_NATIVE_PKG="${RN_PKGS[0]}"
echo "react-native tarball: $REACT_NATIVE_PKG"
node scripts/e2e/spm-ios-e2e.js \
--app newapp \
--flavor "${{ matrix.flavor }}" \
--artifacts /tmp/spm-artifacts \
--rn-tarball "$REACT_NATIVE_PKG"
Loading
Loading