Skip to content

Commit

Permalink
test(e2e, ios): add buildcache to ios e2e run to speed up build
Browse files Browse the repository at this point in the history
cold cache is 20% slower, warm cache is 50% faster
  • Loading branch information
mikehardy committed May 1, 2021
1 parent 026ce53 commit f6a9825
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
41 changes: 40 additions & 1 deletion .github/workflows/tests_e2e_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,45 @@ jobs:
max_attempts: 3
command: yarn tests:ios:pod:install

- uses: actions/cache@v2
name: Buildcache Cache
id: buildcache-cache
with:
path: ~/.buildcache
key: ${{ runner.os }}-v1

- name: Fetch buildcache
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
retry_wait_seconds: 60
max_attempts: 3
command: cd $HOME && curl -s https://api.github.com/repos/mbitsnbites/buildcache/releases/latest | grep -o "https://.*macos\.zip" | xargs curl -fsLJO

- name: Install buildcache
run: |
pwd
cd $HOME
ls -la
unzip buildcache-macos.zip
ln -s $HOME/buildcache/bin/buildcache $HOME/buildcache/bin/clang
ln -s $HOME/buildcache/bin/buildcache $HOME/buildcache/bin/clang++
echo "BUILDCACHE_MAX_CACHE_SIZE=525288000" >> $GITHUB_ENV
echo "BUILDCACHE_DEBUG=2" >> $GITHUB_ENV
echo "BUILDCACHE_LOG_FILE=$HOME/buildcache.log" >> $GITHUB_ENV
echo $HOME/buildcache/bin >> $GITHUB_PATH
- name: Build iOS App
run: |
$HOME/buildcache/bin/buildcache -c
$HOME/buildcache/bin/buildcache -s
which clang
export SKIP_BUNDLING=1
export RCT_NO_LAUNCH_PACKAGER=1
cd tests
set -o pipefail
./node_modules/.bin/detox build --configuration ios.sim.debug
$HOME/buildcache/bin/buildcache -s
shell: bash

- name: Install applesimutils
Expand Down Expand Up @@ -157,6 +189,13 @@ jobs:
cd tests
./node_modules/.bin/nyc ./node_modules/.bin/detox test --debug-synchronization 200 --configuration ios.sim.debug --cleanup
- name: Upload Buildcache Log
uses: actions/upload-artifact@v2
if: always()
with:
name: buildcache_log
path: $BUILDCACHE_LOG_FILE

- name: Compress Simulator Log
if: always()
run: gzip -9 simulator.log
Expand All @@ -165,7 +204,7 @@ jobs:
uses: actions/upload-artifact@v2
if: always()
with:
name: simulator_logs
name: simulator_log
path: simulator.log.gz

- name: Submit Coverage
Expand Down
4 changes: 2 additions & 2 deletions tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/testing.app",
"build": "xcodebuild -workspace ios/testing.xcworkspace -scheme testing -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build -UseModernBuildSystem=YES",
"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",
"type": "ios.simulator",
"device": {
"type": "iPhone 11"
}
},
"ios.sim.release": {
"binaryPath": "ios/build/Build/Products/Release-iphonesimulator/testing.app",
"build": "export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/testing.xcworkspace -scheme testing -configuration Release -sdk iphonesimulator -derivedDataPath ios/build -UseModernBuildSystem=YES",
"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",
"type": "ios.simulator",
"device": {
"type": "iPhone 11"
Expand Down

1 comment on commit f6a9825

@vercel
Copy link

@vercel vercel bot commented on f6a9825 May 1, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.