Skip to content

Commit

Permalink
Code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
kishikawakatsumi committed Jan 3, 2015
1 parent 2627246 commit 24409ee
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,5 +1,5 @@
#xcode specific
build/*
build/
*.pbxuser
*.mode2v3
*.mode1v3
Expand Down
4 changes: 3 additions & 1 deletion .travis.yml
@@ -1,12 +1,14 @@
language: objective-c
osx_image: xcode61
cache:
directories:
- vendor/bundle
install:
- sudo easy_install cpp-coveralls
- bundle install --path=vendor/bundle --binstubs=vendor/bin
script:
- bundle exec rake ios:build osx:build ios:test osx:test
after_success:
- ./iOS/Script/coveralls.sh
env:
global:
- LANG=en_US.UTF-8
Expand Down
2 changes: 0 additions & 2 deletions Mac/UICKeyChainStore.xcodeproj/project.pbxproj
Expand Up @@ -14,7 +14,6 @@
147256F11957100600989F75 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 147256EF1957100600989F75 /* InfoPlist.strings */; };
1472570E1957119900989F75 /* UICKeyChainStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 1472570C1957119900989F75 /* UICKeyChainStore.h */; };
1472570F1957119900989F75 /* UICKeyChainStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 1472570D1957119900989F75 /* UICKeyChainStore.m */; };
147257101957119900989F75 /* UICKeyChainStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 1472570D1957119900989F75 /* UICKeyChainStore.m */; };
14A86CCA1A1DD98A002F5380 /* UICKeyChainStoreTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 14A86CC91A1DD98A002F5380 /* UICKeyChainStoreTests.m */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -250,7 +249,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
147257101957119900989F75 /* UICKeyChainStore.m in Sources */,
14A86CCA1A1DD98A002F5380 /* UICKeyChainStoreTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
6 changes: 6 additions & 0 deletions Rakefile
Expand Up @@ -40,13 +40,19 @@ XCJobs::Test.new('ios:test') do |t|
destinations.each do |destination|
t.add_destination(destination)
end
t.build_dir = 'build'
t.formatter = 'xcpretty -c'
t.add_build_setting('GCC_INSTRUMENT_PROGRAM_FLOW_ARCS', 'YES')
t.add_build_setting('GCC_GENERATE_TEST_COVERAGE_FILES', 'YES')
end

XCJobs::Test.new('osx:test') do |t|
t.workspace = 'UICKeyChainStore'
t.scheme = 'Mac'
t.configuration = 'Release'
t.sdk = 'macosx'
t.build_dir = 'build'
t.formatter = 'xcpretty -c'
t.add_build_setting('GCC_INSTRUMENT_PROGRAM_FLOW_ARCS', 'YES')
t.add_build_setting('GCC_GENERATE_TEST_COVERAGE_FILES', 'YES')
end
19 changes: 19 additions & 0 deletions iOS/Script/create-coveralls-script.sh
@@ -0,0 +1,19 @@
#!/bin/bash -e

if [[ -z "${CI}" ]]; then
exit 0
fi

COVERALLS_SCRIPT_PATH="${SRCROOT}/Script/coveralls.sh"
cat > "${COVERALLS_SCRIPT_PATH}" <<EOF
#!/bin/bash -e
cd "${OBJECT_FILE_DIR_normal}/${CURRENT_ARCH}"
for file in *.gcda; do
gcov "\${file}"
done
coveralls --root "${SRCROOT}/../" -e "iOS" --no-gcov
EOF

chmod +x "${COVERALLS_SCRIPT_PATH}"
8 changes: 3 additions & 5 deletions iOS/UICKeyChainStore.xcodeproj/project.pbxproj
Expand Up @@ -19,7 +19,6 @@
147256B619570FB600989F75 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1472569E19570FB600989F75 /* UIKit.framework */; };
147256BE19570FB600989F75 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 147256BC19570FB600989F75 /* InfoPlist.strings */; };
147257091957118800989F75 /* UICKeyChainStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 147257081957118800989F75 /* UICKeyChainStore.m */; };
1472570A1957118800989F75 /* UICKeyChainStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 147257081957118800989F75 /* UICKeyChainStore.m */; };
14A86CC81A1DD980002F5380 /* UICKeyChainStoreTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 14A86CC71A1DD980002F5380 /* UICKeyChainStoreTests.m */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -169,6 +168,7 @@
1472569319570FB600989F75 /* Sources */,
1472569419570FB600989F75 /* Frameworks */,
1472569519570FB600989F75 /* Resources */,
14BB4C291A58648D0005FCC3 /* ShellScript */,
);
buildRules = (
);
Expand All @@ -186,7 +186,6 @@
147256AE19570FB600989F75 /* Sources */,
147256AF19570FB600989F75 /* Frameworks */,
147256B019570FB600989F75 /* Resources */,
147257111957121A00989F75 /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -252,7 +251,7 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
147257111957121A00989F75 /* ShellScript */ = {
14BB4C291A58648D0005FCC3 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand All @@ -263,7 +262,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "install_name_tool -change \"/Developer/Library/Frameworks/XCTest.framework/XCTest\" \"${SDKROOT}/Developer/Library/Frameworks/XCTest.framework/XCTest\" \"${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}\"\n\nif [ $arch != \"x86_64\" ] && [ $arch != \"i386\" ]; then\ncodesign --verify --force --sign \"$CODE_SIGN_IDENTITY\" \"$CODESIGNING_FOLDER_PATH\"\nfi\n";
shellScript = "Script/create-coveralls-script.sh";
};
/* End PBXShellScriptBuildPhase section */

Expand All @@ -282,7 +281,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1472570A1957118800989F75 /* UICKeyChainStore.m in Sources */,
14A86CC81A1DD980002F5380 /* UICKeyChainStoreTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down

0 comments on commit 24409ee

Please sign in to comment.