-
Notifications
You must be signed in to change notification settings - Fork 35
Swift client runtime circleci setup #25
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
Changes from all commits
8bdd60d
95c9452
682c935
2e6720f
828a753
5ab8898
36fece0
128f4c0
e9f774b
460d0c6
83da155
1bbe2aa
da92edc
ae43279
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,15 @@ commands: | |
destination: Reports | ||
path: build/reports/tests/test/ | ||
|
||
pre_start_ios_simulator: | ||
description: >- | ||
Pre-start iOS Simulator, as the build may fail if it takes too long to start up during that step | ||
steps: | ||
- run: | ||
name: Pre-start iOS Simulator | ||
command: | | ||
bash CircleciScripts/pre_start_iOS_simulator.sh | ||
|
||
jobs: | ||
build: | ||
environment: | ||
|
@@ -115,6 +124,7 @@ jobs: | |
paths: | ||
- smithy-swift/build | ||
- smithy-swift/*/build | ||
|
||
test_smithy_kotlin: | ||
environment: | ||
# Configure the JVM and Gradle to avoid OOM errors | ||
|
@@ -154,6 +164,7 @@ jobs: | |
name: Run ktlint | ||
command: | | ||
./gradlew ktlint | ||
|
||
test_smithy_swift: | ||
environment: | ||
# Configure the JVM and Gradle to avoid OOM errors | ||
|
@@ -194,9 +205,32 @@ jobs: | |
command: | | ||
./gradlew ktlint | ||
|
||
build_and_unittest_swift_client_runtime: | ||
macos: | ||
xcode: "11.4.1" | ||
steps: | ||
- checkout | ||
- pre_start_ios_simulator | ||
- run: | ||
name: Install swiftlint | ||
command: | | ||
HOMEBREW_NO_AUTO_UPDATE=1 brew install swiftlint | ||
- run: | ||
name: Build ClientRuntime | ||
working_directory: ~/project/smithy-swift/ClientRuntime | ||
command: | | ||
xcodebuild build-for-testing -project ClientRuntime.xcodeproj -scheme ClientRuntime -sdk iphonesimulator -destination "${destination}" | ||
- run: | ||
name: Unit Test ClientRuntime | ||
working_directory: ~/project/smithy-swift/ClientRuntime | ||
command: | | ||
xcodebuild test-without-building -enableCodeCoverage YES -project ClientRuntime.xcodeproj -scheme ClientRuntime -sdk iphonesimulator -destination "${destination}" | ||
bash <(curl https://codecov.io/bash | sed 's/"$beta_xcode_partials"//g') | ||
|
||
workflows: | ||
version: 2 | ||
workflow: | ||
|
||
build_and_test_codegen: | ||
jobs: | ||
- build | ||
- test_smithy_kotlin: | ||
|
@@ -207,3 +241,11 @@ workflows: | |
requires: | ||
- build | ||
- lint_smithy_swift | ||
|
||
build_and_test_swift_client_runtime: | ||
jobs: | ||
- build_and_unittest_swift_client_runtime: | ||
filters: | ||
branches: | ||
only: | ||
- swift-client-runtime | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. currently only configured for this branch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will change when we move repos There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes also when we move this to master branch |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Create simulator if needed | ||
test_device_id=$( xcrun simctl list devices | grep "circleci-test-device" | sed 's/ *circleci-test-device *(//' | sed 's/).*//' ) | ||
|
||
if [[ -z $test_device_id ]] ; then | ||
echo "Creating test device" | ||
|
||
# Get the most recent available runtime | ||
runtime=$( xcrun simctl list runtimes iOS | sed 's/iOS //' | sort -h | tail -1 | sed 's/.* - //' | tr -d '[:space:]' ) | ||
echo "Runtime: '${runtime}'" | ||
|
||
# Get the last alphabetical device (probably something in the iPhone X family, as of 2019-05-31) | ||
devicetype=$( xcrun simctl list devicetypes iPhone | sort | tail -1 | sed 's/.*(//' | sed 's/).*//' | tr -d '[:space:]' ) | ||
echo "Device type: '${devicetype}'" | ||
|
||
test_device_id=$( xcrun simctl create "circleci-test-device" "${devicetype}" "${runtime}" | tr -d '[:space:]' ) | ||
fi | ||
|
||
echo "test_device_id: ${test_device_id}" | ||
echo "export test_device_id='$test_device_id'" >> $BASH_ENV | ||
|
||
# Boot sim if needed | ||
xcrun simctl list devices ${test_device_id} | grep -q Booted | ||
if [[ $? -eq 1 ]] ; then | ||
echo "Booting ${test_device_id}" | ||
xcrun simctl boot ${test_device_id} | ||
fi | ||
|
||
# destinationspecifier for xcodebuild commands | ||
destination="platform=iOS Simulator,id=${test_device_id}" | ||
echo "destination: ${destination}" | ||
echo "export destination='$destination'" >> $BASH_ENV | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
excluded: | ||
- Pods | ||
|
||
analyzer_rules: | ||
- unused_import | ||
- unused_declaration | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These rules are same as the ones used in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same linter too right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes. Swift community seems to be unanimously accepting https://github.com/realm/SwiftLint |
||
disabled_rules: | ||
- trailing_whitespace | ||
|
||
opt_in_rules: | ||
- empty_count | ||
|
||
# configurable rules can be customized from this configuration file | ||
force_cast: warning | ||
closing_brace: error | ||
colon: | ||
severity: error | ||
comma: error | ||
empty_count: warning | ||
empty_enum_arguments: error | ||
function_body_length: | ||
warning: 100 | ||
error: 150 | ||
identifier_name: | ||
excluded: | ||
- id | ||
- of | ||
- or | ||
line_length: | ||
warning: 120 | ||
error: 160 | ||
opening_brace: error | ||
return_arrow_whitespace: error | ||
statement_position: | ||
severity: error | ||
todo: warning | ||
trailing_semicolon: error |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -233,7 +233,6 @@ | |
43DD7767249702C70038F7AB /* MockURLProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockURLProtocol.swift; sourceTree = "<group>"; }; | ||
43DD776924973A7A0038F7AB /* URLSessionDelegateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URLSessionDelegateTests.swift; sourceTree = "<group>"; }; | ||
43DD776B24973AF60038F7AB /* NetworkingTestUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkingTestUtils.swift; sourceTree = "<group>"; }; | ||
43DD776D24981F860038F7AB /* Data+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Data+Extensions.swift"; sourceTree = "<group>"; }; | ||
43DD7770249892A10038F7AB /* BoolTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BoolTests.swift; sourceTree = "<group>"; }; | ||
43DD7772249936740038F7AB /* DateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateTests.swift; sourceTree = "<group>"; }; | ||
43DD7776249957000038F7AB /* XMLSimpleTypesTestsUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XMLSimpleTypesTestsUtils.swift; sourceTree = "<group>"; }; | ||
|
@@ -541,7 +540,6 @@ | |
43DD7767249702C70038F7AB /* MockURLProtocol.swift */, | ||
43DD776924973A7A0038F7AB /* URLSessionDelegateTests.swift */, | ||
43DD776B24973AF60038F7AB /* NetworkingTestUtils.swift */, | ||
43DD776D24981F860038F7AB /* Data+Extensions.swift */, | ||
43DD7792249BED370038F7AB /* HttpSerializeTests.swift */, | ||
); | ||
path = NetworkingTests; | ||
|
@@ -647,6 +645,7 @@ | |
43DD75D8249025250038F7AB /* Sources */, | ||
43DD75D9249025250038F7AB /* Frameworks */, | ||
43DD75DA249025250038F7AB /* Resources */, | ||
43DD77D924A54B070038F7AB /* ShellScript */, | ||
); | ||
buildRules = ( | ||
); | ||
|
@@ -664,6 +663,7 @@ | |
43DD75E1249025250038F7AB /* Sources */, | ||
43DD75E2249025250038F7AB /* Frameworks */, | ||
43DD75E3249025250038F7AB /* Resources */, | ||
43DD77D824A54A470038F7AB /* ShellScript */, | ||
); | ||
buildRules = ( | ||
); | ||
|
@@ -729,6 +729,43 @@ | |
}; | ||
/* End PBXResourcesBuildPhase section */ | ||
|
||
/* Begin PBXShellScriptBuildPhase section */ | ||
43DD77D824A54A470038F7AB /* ShellScript */ = { | ||
isa = PBXShellScriptBuildPhase; | ||
buildActionMask = 2147483647; | ||
files = ( | ||
); | ||
inputFileListPaths = ( | ||
); | ||
inputPaths = ( | ||
); | ||
outputFileListPaths = ( | ||
); | ||
outputPaths = ( | ||
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
shellPath = /bin/sh; | ||
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: Recommended to install SwiftLint, download from https://github.com/realm/SwiftLint\"\nfi\n"; | ||
}; | ||
43DD77D924A54B070038F7AB /* ShellScript */ = { | ||
isa = PBXShellScriptBuildPhase; | ||
buildActionMask = 2147483647; | ||
files = ( | ||
); | ||
inputFileListPaths = ( | ||
); | ||
inputPaths = ( | ||
); | ||
outputFileListPaths = ( | ||
); | ||
outputPaths = ( | ||
); | ||
runOnlyForDeploymentPostprocessing = 0; | ||
shellPath = /bin/sh; | ||
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: Recommended to install SwiftLint, download from https://github.com/realm/SwiftLint\"\nfi\n"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Swiftlint is now build in to the build process if the executable is present in the host machine. Else this step is skipped. |
||
}; | ||
/* End PBXShellScriptBuildPhase section */ | ||
|
||
/* Begin PBXSourcesBuildPhase section */ | ||
43DD75D8249025250038F7AB /* Sources */ = { | ||
isa = PBXSourcesBuildPhase; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This saves considerable amount of time as the test files are built during the previous step
build-for-testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good thinking love it. if build fails it never gets to this step right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope