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
  • Loading branch information
mikehardy committed May 1, 2021
1 parent 5f9acaa commit 15b21f4
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 25 deletions.
78 changes: 55 additions & 23 deletions .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
ls -la
cd $HOME
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 "eBUILDCACHE_MAX_CACHE_SIZE=525288000" >> $GITHUB_ENV
echo "BUILDCACHE_DEBUG=2" >> $GITHUB_ENV
echo "BUILDCACHE_LOG_FILE=~/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 All @@ -133,29 +165,29 @@ jobs:
max_attempts: 3
command: HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew && HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils && applesimutils --list

- name: Pre-fetch Javascript bundle
run: |
nohup yarn tests:packager:jet &
printf 'Waiting for packager to come online'
until curl --output /dev/null --silent --head --fail http://localhost:8081/status; do
printf '.'
sleep 2
done
echo "Packager is online! Preparing bundle..."
curl --output /dev/null --silent --head --fail "http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&inlineSourceMap=true"
echo "...javascript bundle ready"
- name: Create Simulator Log
# With a little delay so the detox test below has time to spawn it, missing the first part of boot is fine
# If you boot the simulator separately from detox, some other race fails and detox testee never sends ready to proxy
continue-on-error: true
run: nohup sh -c "sleep 30 && xcrun simctl spawn booted log stream --level debug --style compact > simulator.log 2>&1 &"

- name: Detox Test
timeout-minutes: 40
run: |
cd tests
./node_modules/.bin/nyc ./node_modules/.bin/detox test --debug-synchronization 200 --configuration ios.sim.debug --cleanup
# - name: Pre-fetch Javascript bundle
# run: |
# nohup yarn tests:packager:jet &
# printf 'Waiting for packager to come online'
# until curl --output /dev/null --silent --head --fail http://localhost:8081/status; do
# printf '.'
# sleep 2
# done
# echo "Packager is online! Preparing bundle..."
# curl --output /dev/null --silent --head --fail "http://localhost:8081/index.bundle?platform=ios&dev=true&minify=false&inlineSourceMap=true"
# echo "...javascript bundle ready"

# - name: Create Simulator Log
# # With a little delay so the detox test below has time to spawn it, missing the first part of boot is fine
# # If you boot the simulator separately from detox, some other race fails and detox testee never sends ready to proxy
# continue-on-error: true
# run: nohup sh -c "sleep 30 && xcrun simctl spawn booted log stream --level debug --style compact > simulator.log 2>&1 &"

# - name: Detox Test
# timeout-minutes: 40
# run: |
# cd tests
# ./node_modules/.bin/nyc ./node_modules/.bin/detox test --debug-synchronization 200 --configuration ios.sim.debug --cleanup

- name: Compress Simulator Log
if: always()
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

0 comments on commit 15b21f4

Please sign in to comment.