Pod Template => Unit Tests & Travis defaults #33

Closed
wants to merge 22 commits into
from

Conversation

Projects
None yet
10 participants
@orta
Member

orta commented Mar 29, 2014

I would like to enforce best standards, I think this involves unit tests and travis CI.

I don't think this is the end, but steps towards CocoaPods/CocoaPods#1921 just wanted to get it our there and aired.

@@ -0,0 +1,12 @@
+language: objective-c
+rvm: 1.9.3

This comment has been minimized.

@fabiopelosin

fabiopelosin Mar 30, 2014

Member

Why this version of Ruby?

@fabiopelosin

fabiopelosin Mar 30, 2014

Member

Why this version of Ruby?

This comment has been minimized.

@orta

orta Mar 30, 2014

Member

the latest had issues cocopaods

@orta

orta Mar 30, 2014

Member

the latest had issues cocopaods

This comment has been minimized.

@segiddins

segiddins Jun 20, 2014

Member

With ffi?

@segiddins

segiddins Jun 20, 2014

Member

With ffi?

This comment has been minimized.

@orta orta referenced this pull request in CocoaPods/CocoaPods Mar 30, 2014

Closed

Remove hardcode template URL messages #1975

@hpique

This comment has been minimized.

Show comment
Hide comment
@hpique

hpique Mar 31, 2014

I suggest renaming UnitTests to Tests. It's shorter, and also not all tests have to be unit tests.

hpique commented Mar 31, 2014

I suggest renaming UnitTests to Tests. It's shorter, and also not all tests have to be unit tests.

@orta

This comment has been minimized.

Show comment
Hide comment
@orta

orta Mar 31, 2014

Member

@hpique they are logic tests though, these ones are not ran as application tests so they can't access UIView/UIFonts stuff.

Calling them unit tests was to give it a clue towards what sort of things you should be doing in there

Member

orta commented Mar 31, 2014

@hpique they are logic tests though, these ones are not ran as application tests so they can't access UIView/UIFonts stuff.

Calling them unit tests was to give it a clue towards what sort of things you should be doing in there

@hpique

This comment has been minimized.

Show comment
Hide comment
@hpique

hpique Mar 31, 2014

@orta I thought all iOS tests ran in the simulator now. Are you saying this
UnitTests project won't work for UI components? That's a huge chunks of the
pods.

(didn't try the pull yet, can do later at home if needed)
On Mar 31, 2014 6:54 PM, "Orta" notifications@github.com wrote:

@hpique https://github.com/hpique they are logic tests though, these
ones are not ran as application tests so they can't access UIView/UIFonts
stuff.

Calling them unit tests was to give it a clue towards what sort of things
you should be doing in there

Reply to this email directly or view it on GitHubhttps://github.com/CocoaPods/pod-template/pull/33#issuecomment-39112398
.

hpique commented Mar 31, 2014

@orta I thought all iOS tests ran in the simulator now. Are you saying this
UnitTests project won't work for UI components? That's a huge chunks of the
pods.

(didn't try the pull yet, can do later at home if needed)
On Mar 31, 2014 6:54 PM, "Orta" notifications@github.com wrote:

@hpique https://github.com/hpique they are logic tests though, these
ones are not ran as application tests so they can't access UIView/UIFonts
stuff.

Calling them unit tests was to give it a clue towards what sort of things
you should be doing in there

Reply to this email directly or view it on GitHubhttps://github.com/CocoaPods/pod-template/pull/33#issuecomment-39112398
.

@orta

This comment has been minimized.

Show comment
Hide comment
@orta

orta Mar 31, 2014

Member

right now these are pure unit tests just for testing functionality, there's a reason it's not yet in cocoapods/master

I'm looking at offering some options but want to start simple

Member

orta commented Mar 31, 2014

right now these are pure unit tests just for testing functionality, there's a reason it's not yet in cocoapods/master

I'm looking at offering some options but want to start simple

@schneiderandre

This comment has been minimized.

Show comment
Hide comment
@schneiderandre

schneiderandre Apr 4, 2014

I know xctool is the default test tool on Travis, but another option is Xcode's xcodebuild in combination with xcpretty.
The .travis.yml file would then look like this:

language: objective-c
before_install: gem install xcpretty -N
script: xcodebuild -workspace Example/UnitTests.xcworkspace -scheme UnitTests -sdk iphonesimulator test | xcpretty -c

I know xctool is the default test tool on Travis, but another option is Xcode's xcodebuild in combination with xcpretty.
The .travis.yml file would then look like this:

language: objective-c
before_install: gem install xcpretty -N
script: xcodebuild -workspace Example/UnitTests.xcworkspace -scheme UnitTests -sdk iphonesimulator test | xcpretty -c

This comment has been minimized.

Show comment
Hide comment
@orta

orta Apr 4, 2014

Owner

I'd been thinking about this for me own stuff, will give it a test there before moving it en-masse

Owner

orta replied Apr 4, 2014

I'd been thinking about this for me own stuff, will give it a test there before moving it en-masse

This comment has been minimized.

Show comment
Hide comment
@schneiderandre

schneiderandre Apr 4, 2014

I'm very happy with this setup. I like to work with the tools provided by Xcode and @supermarin's approach in just piping the output. 👍

I'm very happy with this setup. I like to work with the tools provided by Xcode and @supermarin's approach in just piping the output. 👍

This comment has been minimized.

Show comment
Hide comment
@orta

orta Apr 4, 2014

Owner

Great, and you use expecta ( which is what I wanted to be assured was working, and which is why I have to update xctool ) I've got some code that needs to be a pod, so early next week I'll get this up and running and ensure all is good 👍

Owner

orta replied Apr 4, 2014

Great, and you use expecta ( which is what I wanted to be assured was working, and which is why I have to update xctool ) I've got some code that needs to be a pod, so early next week I'll get this up and running and ensure all is good 👍

This comment has been minimized.

Show comment
Hide comment
@schneiderandre

schneiderandre Apr 4, 2014

🎉 Great. If I can help in any way, just let me know.

🎉 Great. If I can help in any way, just let me know.

This comment has been minimized.

Show comment
Hide comment
@orta

orta Apr 4, 2014

Owner

woo, thanks marin

Owner

orta replied Apr 4, 2014

woo, thanks marin

This comment has been minimized.

Show comment
Hide comment
@schneiderandre

schneiderandre Apr 4, 2014

@supermarin good point, thanks.

@supermarin good point, thanks.

This comment has been minimized.

Show comment
Hide comment
@schneiderandre

schneiderandre Apr 4, 2014

I've added the pipefail option and extracted the Example/ path so that it's slightly cleaner.

language: objective-c
before_install: gem install xcpretty -N
script:
- cd Example
- set -o pipefail
- xcodebuild -workspace UnitTests -scheme UnitTests -sdk iphonesimulator test | xcpretty -c

I've added the pipefail option and extracted the Example/ path so that it's slightly cleaner.

language: objective-c
before_install: gem install xcpretty -N
script:
- cd Example
- set -o pipefail
- xcodebuild -workspace UnitTests -scheme UnitTests -sdk iphonesimulator test | xcpretty -c

This comment has been minimized.

Show comment
Hide comment
@supermarin

supermarin Apr 4, 2014

BTW, a better place to put this script is in Rakefile, so the CI configuration is as agnostic as possible.
Then it'd look like:

language: objective-c
before_install: rake install:tools
script:
- rake ci:test

BTW, a better place to put this script is in Rakefile, so the CI configuration is as agnostic as possible.
Then it'd look like:

language: objective-c
before_install: rake install:tools
script:
- rake ci:test

This comment has been minimized.

Show comment
Hide comment
@orta

orta Apr 4, 2014

Owner

^

Owner

orta replied Apr 4, 2014

^

.travis.yml
@@ -0,0 +1,12 @@
+language: objective-c
+rvm: 1.9.3
+before_install: gem install cocoapods

This comment has been minimized.

@jk

jk May 8, 2014

Contributor

Probably add --no-ri --no-rdoc to speed up the installation of CP?!

@jk

jk May 8, 2014

Contributor

Probably add --no-ri --no-rdoc to speed up the installation of CP?!

This comment has been minimized.

@orta

orta May 8, 2014

Member

agree

@orta

orta May 8, 2014

Member

agree

+ - export LANG=en_US.UTF-8
+ - brew update
+ - brew uninstall xctool
+ - brew install xctool

This comment has been minimized.

@kylef

kylef May 21, 2014

Contributor

Let's use xcpretty and not xctool 👍.

@supermarin ❤️

@kylef

kylef May 21, 2014

Contributor

Let's use xcpretty and not xctool 👍.

@supermarin ❤️

@kylef

This comment has been minimized.

Show comment
Hide comment
@kylef

kylef May 21, 2014

Contributor

What's the hold up on this? Anything I can do to help?

(Also won't merge because of conflict)

Contributor

kylef commented May 21, 2014

What's the hold up on this? Anything I can do to help?

(Also won't merge because of conflict)

@@ -2,6 +2,7 @@
[![Version](http://cocoapod-badges.herokuapp.com/v/${POD_NAME}/badge.png)](http://cocoadocs.org/docsets/${POD_NAME})
[![Platform](http://cocoapod-badges.herokuapp.com/p/${POD_NAME}/badge.png)](http://cocoadocs.org/docsets/${POD_NAME})
+[![Build Status](https://travis-ci.org/${USER_NAME}/${POD_NAME}.svg)](https://travis-ci.org/${USER_NAME}/${POD_NAME})

This comment has been minimized.

@kylef

kylef May 21, 2014

Contributor

${USER_NAME} is coming from ENV['GIT_COMMITTER_NAME'] which is commonly a full name and not the GitHub username. We'd need to find a different solution to make this work. I might also be uploading this to an organisation repository such as CocoaPods or AFNetworking. So would be nice to be able to change the git username.

Since we're doing this here, we should set the source from example to https://github.com/username/podname.

@kylef

kylef May 21, 2014

Contributor

${USER_NAME} is coming from ENV['GIT_COMMITTER_NAME'] which is commonly a full name and not the GitHub username. We'd need to find a different solution to make this work. I might also be uploading this to an organisation repository such as CocoaPods or AFNetworking. So would be nice to be able to change the git username.

Since we're doing this here, we should set the source from example to https://github.com/username/podname.

This comment has been minimized.

@orta

orta May 21, 2014

Member

@Keithbsmiley or you recommended a way to commonly find it in the git config - think that's doable still?

@orta

orta May 21, 2014

Member

@Keithbsmiley or you recommended a way to commonly find it in the git config - think that's doable still?

This comment has been minimized.

@kylef

kylef May 21, 2014

Contributor

There isn't really an accurate way.

Perhaps we can do #45 but abort and error if it's missing?

@kylef

kylef May 21, 2014

Contributor

There isn't really an accurate way.

Perhaps we can do #45 but abort and error if it's missing?

This comment has been minimized.

@segiddins

segiddins May 23, 2014

Member

We'll probably want to make the badge also be from shields when I push that change

@segiddins

segiddins May 23, 2014

Member

We'll probably want to make the badge also be from shields when I push that change

@orta

This comment has been minimized.

Show comment
Hide comment
@orta

orta Jun 19, 2014

Member

closing this PR. I have new things in the works on this but I don't want to drag around the discussion.

Member

orta commented Jun 19, 2014

closing this PR. I have new things in the works on this but I don't want to drag around the discussion.

@orta orta closed this Jun 19, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment