Skip to content

Commit c1e76a1

Browse files
committed
Merge pull request #6 from venmo/marklarr/travis_and_coveralls
Marklarr/travis and coveralls
2 parents eb83414 + 1391969 commit c1e76a1

File tree

9 files changed

+109
-35
lines changed

9 files changed

+109
-35
lines changed

.coveralls.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
service_name: travis-ci

.travis.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
language: objective-c
2+
script: scripts/travis.sh
3+
4+
# Sets Travis to run the Ruby specs on OS X machines which are required to
5+
# build the native extensions of Xcodeproj.
6+
7+
env:
8+
- RVM_RUBY_VERSION=system
9+
- RVM_RUBY_VERSION=2.1.1
10+
11+
before_install:
12+
- curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
13+
- source ~/.rvm/scripts/rvm
14+
- if [[ $RVM_RUBY_VERSION != 'system' ]]; then rvm install $RVM_RUBY_VERSION; fi
15+
- rvm use $RVM_RUBY_VERSION
16+
- if [[ $RVM_RUBY_VERSION == 'system' ]]; then export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future; fi
17+
- if [[ $RVM_RUBY_VERSION == 'system' ]]; then sudo gem install bundler --no-ri --no-rdoc; else gem install bundler --no-ri --no-rdoc; fi
18+
19+
install:
20+
- bundle install --without=documentation --path ./travis_bundle_dir

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
2+
13
![Slather Logo](https://raw.githubusercontent.com/venmo/slather/master/docs/logo.jpg)
24

5+
[![Gem Version](https://badge.fury.io/rb/slather.svg)](http://badge.fury.io/rb/slather)
6+
[![Build Status](https://travis-ci.org/venmo/slather.svg?branch=master)](https://travis-ci.org/venmo/slather)
7+
38
Generate test coverage reports for Xcode projects & hook it into CI.
49

510
### Projects that use Slather

lib/slather/coverage_file.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def gcov_data
3939
gcov_data = gcov_file.read
4040

4141
gcov_files_created.each { |file| FileUtils.rm(file) }
42-
42+
4343
gcov_data
4444
end
4545
end

scripts/travis.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
xcodebuild -project spec/fixtures/fixtures.xcodeproj/ -scheme fixtures -configuration Debug test
2+
bundle exec rspec

slather.gemspec

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
1818
spec.require_paths = ["lib"]
1919

2020
spec.add_development_dependency "bundler", "~> 1.6"
21+
spec.add_development_dependency "coveralls"
2122
spec.add_development_dependency "rake", "~> 10.3"
2223
spec.add_development_dependency "rspec", "~> 2.14"
2324
spec.add_development_dependency "pry", "~> 0.9"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0600"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "8C9A202C195965F10013B6B3"
18+
BuildableName = "libfixtures.a"
19+
BlueprintName = "fixtures"
20+
ReferencedContainer = "container:fixtures.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
27+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
28+
shouldUseLaunchSchemeArgsEnv = "YES"
29+
buildConfiguration = "Debug">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "8C9A203F195965F10013B6B3"
36+
BuildableName = "fixturesTests.xctest"
37+
BlueprintName = "fixturesTests"
38+
ReferencedContainer = "container:fixtures.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
</TestAction>
43+
<LaunchAction
44+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
45+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
46+
launchStyle = "0"
47+
useCustomWorkingDirectory = "NO"
48+
buildConfiguration = "Debug"
49+
ignoresPersistentStateOnLaunch = "NO"
50+
debugDocumentVersioning = "YES"
51+
allowLocationSimulation = "YES">
52+
<AdditionalOptions>
53+
</AdditionalOptions>
54+
</LaunchAction>
55+
<ProfileAction
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
buildConfiguration = "Release"
60+
debugDocumentVersioning = "YES">
61+
</ProfileAction>
62+
<AnalyzeAction
63+
buildConfiguration = "Debug">
64+
</AnalyzeAction>
65+
<ArchiveAction
66+
buildConfiguration = "Release"
67+
revealArchiveInOrganizer = "YES">
68+
</ArchiveAction>
69+
</Scheme>

spec/slather/coverage_file_spec.rb

+4-34
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
end
88

99
let(:coverage_file) do
10-
gcno_path = Pathname(File.join(File.dirname(__FILE__), "fixtures.gcno")).to_s
11-
Slather::CoverageFile.new(fixtures_project, gcno_path)
10+
fixtures_project.send(:coverage_files).detect { |cf| cf.source_file_pathname.basename.to_s == "fixtures.m" }
1211
end
1312

1413
describe "#initialize" do
1514
it "should convert the provided path string to a Pathname object, and set it as the gcno_file_pathname" do
16-
expect(coverage_file.gcno_file_pathname).to eq(Pathname(File.join(File.dirname(__FILE__), "fixtures.gcno")))
15+
expect(coverage_file.gcno_file_pathname.exist?).to be_truthy
16+
expect(coverage_file.gcno_file_pathname.basename.to_s).to eq("fixtures.gcno")
1717
end
1818
end
1919

@@ -98,37 +98,7 @@
9898

9999
describe "gcov_data" do
100100
it "should process the gcno file with gcov and return the contents of the file" do
101-
expected = <<-GCOV
102-
-: 0:Source:/Users/marklarsen/github.com/slather/spec/fixtures/fixtures/fixtures.m
103-
-: 0:Graph:/Users/marklarsen/github.com/slather/spec/slather/fixtures.gcno
104-
-: 0:Data:-
105-
-: 0:Runs:0
106-
-: 0:Programs:0
107-
-: 1://
108-
-: 2:// fixtures.m
109-
-: 3:// fixtures
110-
-: 4://
111-
-: 5:// Created by Mark Larsen on 6/24/14.
112-
-: 6:// Copyright (c) 2014 marklarr. All rights reserved.
113-
-: 7://
114-
-: 8:
115-
-: 9:#import "fixtures.h"
116-
-: 10:
117-
-: 11:@implementation fixtures
118-
-: 12:
119-
-: 13:- (void)testedMethod
120-
-: 14:{
121-
#####: 15: NSLog(@"tested");
122-
#####: 16:}
123-
-: 17:
124-
-: 18:- (void)untestedMethod
125-
-: 19:{
126-
#####: 20: NSLog(@"untested");
127-
#####: 21:}
128-
-: 22:
129-
-: 23:@end
130-
GCOV
131-
expect(coverage_file.gcov_data).to eq(expected)
101+
expect(coverage_file.gcov_data.include?("1: 15: NSLog(@\"tested\");")).to be_truthy
132102
end
133103
end
134104

spec/spec_helper.rb

+6
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33

44
require 'slather'
55
require 'pry'
6+
require 'coveralls'
7+
8+
Coveralls.wear!
69

710
FIXTURES_PROJECT_PATH = File.join(File.dirname(__FILE__), 'fixtures/fixtures.xcodeproj')
811

912
RSpec.configure do |config|
13+
config.after(:suite) do
14+
FileUtils.rm_rf(Dir[File.expand_path('~') + "/Library/Developer/Xcode/DerivedData/fixture*"].first)
15+
end
1016
end

0 commit comments

Comments
 (0)