Skip to content

Commit

Permalink
Merge pull request #37 from rheinfabrik/feature/travis-ci
Browse files Browse the repository at this point in the history
Continuous Integration
  • Loading branch information
Felix Jendrusch committed Feb 18, 2015
2 parents d755c69 + b63c256 commit 18c21f7
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: objective-c
osx_image: xcode611
before_install:
- brew update
- brew outdated carthage || brew upgrade carthage || brew install carthage
- gem install xcpretty
script:
- scripts/cibuild
8 changes: 6 additions & 2 deletions HeimdallTests/NSURLRequestExtensionsSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,12 @@ class NSMutableURLRequestExtensionsSpec: QuickSpec {
context("when given parameters") {
it("sets the body with encoded parameyers") {
request.setHTTPBody(parameters: [ "#key1": "%value1", "#key2": "%value2" ])

expect(NSString(data: request.HTTPBody!, encoding: NSUTF8StringEncoding)).to(equal("%23key2=%25value2&%23key1=%25value1"))

var components = NSString(data: request.HTTPBody!, encoding: NSUTF8StringEncoding)?.componentsSeparatedByString("&") as? [String]
components = components?.sorted { $0 < $1 }

expect(components?[0]).to(equal("%23key1=%25value1"))
expect(components?[1]).to(equal("%23key2=%25value2"))
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Heimdall is an [OAuth 2.0](https://tools.ietf.org/html/rfc6749) client specifica

If you are familiar with [ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa), also check out [ReactiveHeimdall](https://github.com/rheinfabrik/ReactiveHeimdall)!

[![Build Status](https://travis-ci.org/rheinfabrik/Heimdall.swift.svg)](https://travis-ci.org/rheinfabrik/Heimdall.swift)

## Example

Before requesting an access token, the client must be configured appropriately:
Expand Down
Binary file added scripts/certificates/development.p12
Binary file not shown.
69 changes: 69 additions & 0 deletions scripts/cibuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

export SCRIPT_DIR=$(dirname "$0")

##
## Configuration Variables
##

# The name of the keychain to create for iOS code signing.
KEYCHAIN=ios-build.keychain

##
## Build Process
##

main ()
{
import_certs

carthage bootstrap --platform iOS

set -o pipefail && xcodebuild -project Heimdall.xcodeproj -scheme "Heimdall" test -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c
local status=$?

delete_keychain
exit $status
}

import_certs ()
{
# If this environment variable is missing, we must not be running on Travis.
if [ -z "$KEY_PASSWORD" ]
then
return 0
fi

echo "*** Setting up code signing..."
local password=cibuild

# Create a temporary keychain for code signing.
security create-keychain -p "$password" "$KEYCHAIN"
security default-keychain -s "$KEYCHAIN"
security unlock-keychain -p "$password" "$KEYCHAIN"
security set-keychain-settings -t 3600 -l "$KEYCHAIN"

# Download the certificate for the Apple Worldwide Developer Relations
# Certificate Authority.
local certpath="$SCRIPT_DIR/apple_wwdr.cer"
curl 'https://developer.apple.com/certificationauthority/AppleWWDRCA.cer' > "$certpath"
security import "$certpath" -k "$KEYCHAIN" -T /usr/bin/codesign

# Import our development certificate.
security import "$SCRIPT_DIR/certificates/development.p12" -k "$KEYCHAIN" -P "$KEY_PASSWORD" -T /usr/bin/codesign
}

delete_keychain ()
{
if [ -z "$KEY_PASSWORD" ]
then
return 0
fi

security delete-keychain "$KEYCHAIN"
}

export -f import_certs
export -f delete_keychain

main

0 comments on commit 18c21f7

Please sign in to comment.