1- name : CI
1+ name : build-example-ios
22on :
3- push :
4- branches :
5- - main
3+ workflow_dispatch :
4+
5+ release :
6+ types : [published]
7+
68 pull_request :
7- branches :
8- - main
9- merge_group :
10- types :
11- - checks_requested
9+ types :
10+ - closed
1211
12+ branches :
13+ - ' master'
14+
1315jobs :
14- lint :
15- runs-on : ubuntu-latest
16- steps :
17- - name : Checkout
18- uses : actions/checkout@v3
19-
20- - name : Setup
21- uses : ./.github/actions/setup
22-
23- - name : Lint files
24- run : yarn lint
25-
26- - name : Typecheck files
27- run : yarn typecheck
28-
29- test :
30- runs-on : ubuntu-latest
31- steps :
32- - name : Checkout
33- uses : actions/checkout@v3
34-
35- - name : Setup
36- uses : ./.github/actions/setup
37-
38- - name : Run unit tests
39- run : yarn test --maxWorkers=2 --coverage
40-
41- build-library :
42- runs-on : ubuntu-latest
43- steps :
44- - name : Checkout
45- uses : actions/checkout@v3
46-
47- - name : Setup
48- uses : ./.github/actions/setup
49-
50- - name : Build package
51- run : yarn prepare
16+ build :
17+ name : Build example app
18+ runs-on : macos-14
19+ if : ${{ (github.event.pull_request.merged == true) || (github.event_name != 'pull_request') }}
5220
53- build-android :
54- runs-on : ubuntu-latest
55- env :
56- TURBO_CACHE_DIR : .turbo/android
5721 steps :
58- - name : Checkout
59- uses : actions/checkout@v3
22+ - name : Cancel previous runs
23+ uses : styfle/cancel-workflow-action@0.9.1
6024
61- - name : Setup
62- uses : ./.github/actions/setup
25+ - name : Show self-hosted machine infomation
26+ run : uname -a
6327
64- - name : Cache turborepo for Android
65- uses : actions/cache@v3
66- with :
67- path : ${{ env.TURBO_CACHE_DIR }}
68- key : ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
69- restore-keys : |
70- ${{ runner.os }}-turborepo-android-
28+ - name : Check Xcode version
29+ run : /usr/bin/xcodebuild -version
30+
31+ - name : Checkout repo from main branch
32+ uses : actions/checkout@v4
7133
72- - name : Check turborepo cache for Android
34+ - name : Install Apple certificate and provisioning profile
35+ env :
36+ BUILD_CERTIFICATE_BASE64 : ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
37+ P12_PASSWORD : ${{ secrets.P12_PASSWORD }}
38+ BUILD_PROVISION_PROFILE_BASE64 : ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
39+ KEYCHAIN_PASSWORD : ${{ secrets.KEYCHAIN_PASSWORD }}
7340 run : |
74- TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
75-
76- if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
77- echo "turbo_cache_hit=1" >> $GITHUB_ENV
78- fi
79-
80- - name : Install JDK
81- if : env.turbo_cache_hit != 1
82- uses : actions/setup-java@v3
41+ # create variables
42+ CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
43+ PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
44+ KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
45+
46+ # import certificate and provisioning profile from secrets
47+ echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
48+ echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
49+
50+ # create temporary keychain
51+ security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
52+ security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
53+ security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
54+
55+ # import certificate to keychain
56+ security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
57+ security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
58+ security list-keychain -d user -s $KEYCHAIN_PATH
59+
60+ # apply provisioning profile
61+ mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
62+ cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
63+
64+ - uses : actions/setup-node@v4
8365 with :
84- distribution : ' zulu '
85- java-version : ' 17 '
66+ node-version : ' v18.12.1 '
67+ cache : ' yarn '
8668
87- - name : Finalize Android SDK
88- if : env.turbo_cache_hit != 1
69+ - name : Initialize library
8970 run : |
90- /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
71+ yarn install
72+ cd example
73+ yarn install
9174
92- - name : Cache Gradle
93- if : env.turbo_cache_hit != 1
94- uses : actions/cache@v3
95- with :
96- path : |
97- ~/.gradle/wrapper
98- ~/.gradle/caches
99- key : ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
100- restore-keys : |
101- ${{ runner.os }}-gradle-
102-
103- - name : Build example for Android
104- env :
105- JAVA_OPTS : " -XX:MaxHeapSize=6g"
106- run : |
107- yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
75+ - name : Build JS
76+ run : yarn run bob build
10877
109- build-ios :
110- runs-on : macos-14
111- env :
112- TURBO_CACHE_DIR : .turbo/ios
113- steps :
114- - name : Checkout
115- uses : actions/checkout@v3
78+ - name : 1/2 - Run `pod-install` (fabric, static library)
79+ run : yarn pod-install:new-static
11680
117- - name : Setup
118- uses : ./.github/actions/setup
81+ - name : 1/2 - Build example (fabric, static library)
82+ run : yarn run build:ios
11983
120- - name : Cache turborepo for iOS
121- uses : actions/cache@v3
122- with :
123- path : ${{ env.TURBO_CACHE_DIR }}
124- key : ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
125- restore-keys : |
126- ${{ runner.os }}-turborepo-ios-
127-
128- - name : Check turborepo cache for iOS
129- run : |
130- TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
131-
132- if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
133- echo "turbo_cache_hit=1" >> $GITHUB_ENV
134- fi
84+ - name : Clear/reset example pods
85+ run : yarn run nuke:example-pods
13586
136- - name : Cache cocoapods
137- if : env.turbo_cache_hit != 1
138- id : cocoapods-cache
139- uses : actions/cache@v3
140- with :
141- path : |
142- **/ios/Pods
143- key : ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
144- restore-keys : |
145- ${{ runner.os }}-cocoapods-
146-
147- - name : Install cocoapods
148- if : env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
149- run : |
150- cd example/ios
151- pod install
152- env :
153- NO_FLIPPER : 1
87+ - name : 2/2 - Run `pod-install` (paper, static library)
88+ run : yarn pod-install:old-static
15489
155- - name : Build example for iOS
156- run : |
157- yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
90+ - name : 2/2 - Build example (paper, static library)
91+ run : yarn run build:ios
0 commit comments