forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy pathbuild-react-native-dependencies-pr.yml
More file actions
155 lines (151 loc) · 6 KB
/
build-react-native-dependencies-pr.yml
File metadata and controls
155 lines (151 loc) · 6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Build ReactNativeDependencies for PR
on:
workflow_call:
jobs:
prepare_workspace:
name: Prepare workspace
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup toolchain
uses: ./.github/actions/microsoft-setup-toolchain
with:
platform: macos
node-version: '22'
- name: Install dependencies
run: yarn install
- name: Restore cache if present
id: restore-rn-deps
uses: actions/cache/restore@v4
with:
path: packages/react-native/third-party/
key: v2-pr-rn-dependencies-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }}
enableCrossOsArchive: true
- name: Prepare Dependencies
if: steps.restore-rn-deps.outputs.cache-hit != 'true'
run: |
node scripts/releases/prepare-ios-prebuilds.js -s
- name: Generate Package.swift
if: steps.restore-rn-deps.outputs.cache-hit != 'true'
run: |
node scripts/releases/prepare-ios-prebuilds.js -w
- name: Upload Artifacts
uses: actions/upload-artifact@v4.3.4
with:
name: rn-deps-workspace
path: packages/react-native/third-party/
- name: Save Cache
uses: actions/cache/save@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
key: v2-pr-rn-dependencies-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }}
enableCrossOsArchive: true
path: packages/react-native/third-party/
build-macos-slice:
name: Build macOS Slice
runs-on: macos-14
needs: [prepare_workspace]
strategy:
fail-fast: false
matrix:
flavor: ['Debug', 'Release']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup toolchain
uses: ./.github/actions/microsoft-setup-toolchain
with:
platform: macos
node-version: '22'
- name: Install dependencies
run: yarn install
- name: Restore slice folder
id: restore-slice-folder
uses: actions/cache/restore@v4
with:
path: packages/react-native/third-party/.build/Build/Products
key: v2-pr-rn-dependencies-slice-macos-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }}
- name: Restore workspace
if: steps.restore-slice-folder.outputs.cache-hit != 'true'
uses: actions/download-artifact@v4
with:
name: rn-deps-workspace
path: packages/react-native/third-party/
- name: Print third-party folder structure
run: ls -lR packages/react-native/third-party
- name: Build slice for macOS ${{ matrix.flavor }}
if: steps.restore-slice-folder.outputs.cache-hit != 'true'
run: node scripts/releases/prepare-ios-prebuilds.js -b -p macos -r ${{ matrix.flavor }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4.3.4
with:
name: prebuild-slice-${{ matrix.flavor }}-macos
path: |
packages/react-native/third-party/.build/Build/Products
- name: Save Cache
uses: actions/cache/save@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
key: v2-pr-rn-dependencies-slice-macos-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }}
enableCrossOsArchive: true
path: |
packages/react-native/third-party/.build/Build/Products
create-xcframework:
name: Create XCFramework
runs-on: macos-14
needs: [build-macos-slice]
strategy:
fail-fast: false
matrix:
flavor: [Debug, Release]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup toolchain
uses: ./.github/actions/microsoft-setup-toolchain
with:
platform: macos
node-version: '22'
- name: Install dependencies
run: yarn install
- name: Restore XCFramework
id: restore-xcframework
uses: actions/cache/restore@v4
with:
path: |
packages/react-native/third-party/
key: v2-pr-rn-dependencies-xcframework-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }}
- name: Restore workspace
if: steps.restore-xcframework.outputs.cache-hit != 'true'
uses: actions/download-artifact@v4
with:
name: rn-deps-workspace
path: packages/react-native/third-party/
- name: Download slices
if: steps.restore-xcframework.outputs.cache-hit != 'true'
uses: actions/download-artifact@v4
with:
pattern: prebuild-slice-${{ matrix.flavor }}-*
path: packages/react-native/third-party/.build/Build/Products
merge-multiple: true
- name: Create XCFramework (unsigned)
if: steps.restore-xcframework.outputs.cache-hit != 'true'
run: node scripts/releases/prepare-ios-prebuilds.js -c -r ${{ matrix.flavor }}
- name: Compress and Rename XCFramework
if: steps.restore-xcframework.outputs.cache-hit != 'true'
run: |
tar -cz -f packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz \
packages/react-native/third-party/ReactNativeDependencies.xcframework
- name: Upload XCFramework Artifact
uses: actions/upload-artifact@v4
with:
name: ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
path: packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
- name: Save XCFramework in Cache
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/cache/save@v4
with:
path: |
packages/react-native/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
key: v2-pr-rn-dependencies-xcframework-${{ matrix.flavor }}-${{ hashfiles('scripts/releases/ios-prebuild/configuration.js') }}