Skip to content

Commit f6a9825

Browse files
committed
test(e2e, ios): add buildcache to ios e2e run to speed up build
cold cache is 20% slower, warm cache is 50% faster
1 parent 026ce53 commit f6a9825

File tree

2 files changed

+42
-3
lines changed

2 files changed

+42
-3
lines changed

.github/workflows/tests_e2e_ios.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,45 @@ jobs:
116116
max_attempts: 3
117117
command: yarn tests:ios:pod:install
118118

119+
- uses: actions/cache@v2
120+
name: Buildcache Cache
121+
id: buildcache-cache
122+
with:
123+
path: ~/.buildcache
124+
key: ${{ runner.os }}-v1
125+
126+
- name: Fetch buildcache
127+
uses: nick-invision/retry@v2
128+
with:
129+
timeout_minutes: 10
130+
retry_wait_seconds: 60
131+
max_attempts: 3
132+
command: cd $HOME && curl -s https://api.github.com/repos/mbitsnbites/buildcache/releases/latest | grep -o "https://.*macos\.zip" | xargs curl -fsLJO
133+
134+
- name: Install buildcache
135+
run: |
136+
pwd
137+
cd $HOME
138+
ls -la
139+
unzip buildcache-macos.zip
140+
ln -s $HOME/buildcache/bin/buildcache $HOME/buildcache/bin/clang
141+
ln -s $HOME/buildcache/bin/buildcache $HOME/buildcache/bin/clang++
142+
echo "BUILDCACHE_MAX_CACHE_SIZE=525288000" >> $GITHUB_ENV
143+
echo "BUILDCACHE_DEBUG=2" >> $GITHUB_ENV
144+
echo "BUILDCACHE_LOG_FILE=$HOME/buildcache.log" >> $GITHUB_ENV
145+
echo $HOME/buildcache/bin >> $GITHUB_PATH
146+
119147
- name: Build iOS App
120148
run: |
149+
$HOME/buildcache/bin/buildcache -c
150+
$HOME/buildcache/bin/buildcache -s
151+
which clang
121152
export SKIP_BUNDLING=1
122153
export RCT_NO_LAUNCH_PACKAGER=1
123154
cd tests
124155
set -o pipefail
125156
./node_modules/.bin/detox build --configuration ios.sim.debug
157+
$HOME/buildcache/bin/buildcache -s
126158
shell: bash
127159

128160
- name: Install applesimutils
@@ -157,6 +189,13 @@ jobs:
157189
cd tests
158190
./node_modules/.bin/nyc ./node_modules/.bin/detox test --debug-synchronization 200 --configuration ios.sim.debug --cleanup
159191
192+
- name: Upload Buildcache Log
193+
uses: actions/upload-artifact@v2
194+
if: always()
195+
with:
196+
name: buildcache_log
197+
path: $BUILDCACHE_LOG_FILE
198+
160199
- name: Compress Simulator Log
161200
if: always()
162201
run: gzip -9 simulator.log
@@ -165,7 +204,7 @@ jobs:
165204
uses: actions/upload-artifact@v2
166205
if: always()
167206
with:
168-
name: simulator_logs
207+
name: simulator_log
169208
path: simulator.log.gz
170209

171210
- name: Submit Coverage

tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@
5252
"configurations": {
5353
"ios.sim.debug": {
5454
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/testing.app",
55-
"build": "xcodebuild -workspace ios/testing.xcworkspace -scheme testing -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build -UseModernBuildSystem=YES",
55+
"build": "xcodebuild CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ -workspace ios/testing.xcworkspace -scheme testing -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build -UseModernBuildSystem=YES",
5656
"type": "ios.simulator",
5757
"device": {
5858
"type": "iPhone 11"
5959
}
6060
},
6161
"ios.sim.release": {
6262
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/testing.app",
63-
"build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/testing.xcworkspace -scheme testing -configuration Release -sdk iphonesimulator -derivedDataPath ios/build -UseModernBuildSystem=YES",
63+
"build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ -workspace ios/testing.xcworkspace -scheme testing -configuration Release -sdk iphonesimulator -derivedDataPath ios/build -UseModernBuildSystem=YES",
6464
"type": "ios.simulator",
6565
"device": {
6666
"type": "iPhone 11"

0 commit comments

Comments
 (0)