Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce builds and tests using Azure DevOps #333

Merged
merged 2 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
trigger:
- master

pr:
autoCancel: true
branches:
include:
- master

jobs:
- job: Xcode
displayName: 'Xcode build and tests'
pool:
vmImage: macOS-10.14
demands: xcode
steps:
- script: ./scripts/bluepill.sh test
displayName: 'Run BluePill tests'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'build/reports/*.xml'
mergeTestResults: false
failTaskOnFailedTests: false
- script: ./scripts/bluepill.sh build
displayName: 'Build BluePill'
- task: CopyFiles@2
inputs:
contents: 'build/*.zip'
targetFolder: '$(Build.artifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'

- job: Bazel
displayName: 'Bazel build'
pool:
vmImage: macOS-10.14
demands: xcode
steps:
- script: 'brew install bazel'
jmkk marked this conversation as resolved.
Show resolved Hide resolved
displayName: 'Install Bazel'
- script: 'bazel build //bluepill:bluepill'
displayName: 'Bazel build'
35 changes: 4 additions & 31 deletions scripts/bluepill.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#!/bin/bash

XCPRETTY=xcpretty
XCPRETTY='xcpretty --report junit'
command -v $XCPRETTY >/dev/null 2>&1 || {
XCPRETTY=cat
}
Expand All @@ -33,36 +33,10 @@ export NSUnbufferedIO

# If BPBuildScript is set to YES, it will disable verbose output in `bp`
BPBuildScript=YES

# Set it to NO if we're on Travis
# Also turn off XCPRETTY
if [ "$TRAVIS" == "true" ] || [ "$VERBOSE" == "1" ]
then
BPBuildScript=NO
XCPRETTY=cat
fi

export BPBuildScript

mkdir -p build/

test_runtime()
{
# Test that we have a valid runtime.

default_runtime=`grep BP_DEFAULT_RUNTIME ./Source/Shared/BPConstants.h | sed 's/.*BP_DEFAULT_RUNTIME *//;s/"//g;s/ *$//g;'`
xcrun simctl list runtimes | grep -q "$default_runtime" || {
echo "Your system doesn't contain latest runtime: iOS $default_runtime"
exit -1
}
}

simulator_cleanup()
{
echo "Clean up simulators"
xcrun simctl list | grep BP | sed 's/).*$//g;s/^.*(//g;' | while read x; do xcrun simctl shutdown $x >/dev/null; xcrun simctl delete $x >/dev/null; done
}

bluepill_build()
{
set -o pipefail
Expand Down Expand Up @@ -117,7 +91,7 @@ bluepill_instance_tests()
xcodebuild test \
-workspace Bluepill.xcworkspace \
-scheme bp-tests \
-derivedDataPath "build/" 2>&1 | tee result.txt | $XCPRETTY
-derivedDataPath "build/" 2>&1 | tee result.txt | $XCPRETTY --output build/reports/instance.xml

if ! grep '\*\* TEST SUCCEEDED \*\*' result.txt; then
echo 'Test failed'
Expand All @@ -130,7 +104,7 @@ bluepill_runner_tests()
xcodebuild test \
-workspace Bluepill.xcworkspace \
-scheme bluepill-tests \
-derivedDataPath "build/" 2>&1 | tee result.txt | $XCPRETTY
-derivedDataPath "build/" 2>&1 | tee result.txt | $XCPRETTY --output build/reports/runner.xml

if ! grep '\*\* TEST SUCCEEDED \*\*' result.txt; then
echo 'Test failed'
Expand All @@ -144,12 +118,11 @@ bluepill_verbose_tests()
export BPBuildScript
bluepill_test
}

# The simulator clean up is to workaound a Xcode10 beta5 bug(CircleCI is still using beta5)
bluepill_test()
{
simulator_cleanup
bluepill_instance_tests
simulator_cleanup
bluepill_runner_tests
}

Expand Down