Last active
July 21, 2019 14:21
-
-
Save DoguD/a0829226e12a696f1c454271308859d0 to your computer and use it in GitHub Desktop.
Fastfile which will record XC Tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default_platform(:ios) | |
platform :ios do | |
slack_url = "<YOUR-SLACK-WEBHOOK>" | |
video_finished = false | |
before_all do | |
setup_circle_ci | |
end | |
desc "Build and Test" | |
lane :build_and_test do | |
# Build (Build and test are executed seperately to shorten the video time) | |
xcodebuild( | |
workspace: "<YOUR-WORKSPACE>", | |
scheme: "<YOUR-SCHEME>", | |
clean: true, | |
configuration: "Release", | |
destination: ["platform=iOS Simulator,name=iPhone 8,OS=12.0"], | |
derivedDataPath: "/Users/distiller/src/test_build_folder", | |
xcargs: "build-for-testing", | |
) | |
# Start recording (Executes Apple Script) | |
sh("osascript ./recording_related/start_recording.scpt") | |
# Execute Tests | |
run_tests(devices: ["iPhone 8"], destination: ["platform=iOS Simulator,name=iPhone 8,OS=12.0"], derived_data_path: "/Users/distiller/src/test_build_folder", test_without_building: true, configuration: "Release") | |
# Stop recording | |
sh("cd .. && osascript ./fastlane/recording_related/stop_recording.scpt") | |
video_finished = true | |
# Uncomment if you want to save video as .mp4 instead of .mov | |
# sh("HOMEBREW_NO_AUTO_UPDATE=1 brew install ffmpeg") | |
# sh('ffmpeg -y -i /Users/distiller/src/testrecording.mov -vf "setpts=1.25*PTS" -r 20 /Users/distiller/src/testrecording.mp4') | |
# sh("rm /Users/distiller/src/testrecording.mov") | |
end | |
error do |lane, exception| | |
# Save video even if the tests fail | |
if !video_finished | |
# Stop recording | |
sh("cd .. && osascript ./fastlane/recording_related/stop_recording.scpt") # Stop recording | |
# Uncomment if you want to save video as .mp4 instead of .mov | |
# sh("HOMEBREW_NO_AUTO_UPDATE=1 brew install ffmpeg") | |
# sh('ffmpeg -y -i /Users/distiller/src/testrecording.mov -vf "setpts=1.25*PTS" -r 20 /Users/distiller/src/testrecording.mp4') | |
# sh("rm /Users/distiller/src/testrecording.mov") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment