Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #7 from nodes-vapor/updated-ci
Browse files Browse the repository at this point in the history
Updated CI
  • Loading branch information
steffendsommer committed Oct 23, 2017
2 parents 613e3b9 + d230b45 commit d3f8221
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 14 deletions.
19 changes: 19 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
jobs:
build:
docker:
- image: buildpack-deps:trusty
steps:
- checkout
- run:
name: Install Swift
command: 'eval "$(curl -sL https://apt.vapor.sh)"'
- run:
name: Install Vapor toolbox
command: |
sudo apt-get install --yes vapor
sudo apt-get install --yes cmysql
sudo chmod -R a+rx /usr/
- run:
name: Run Tests
command: |
swift test -Xswiftc -DNOJSON
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ before_install:
brew tap vapor/tap;
brew update;
brew install vapor;
brew install cmysql;
gem install xcpretty;

script:
- set -o pipefail
- swift build
- swift build -c release
- swift package generate-xcodeproj --enable-code-coverage
- xcodebuild -scheme Gatekeeper -enableCodeCoverage YES test
- xcodebuild -scheme Gatekeeper -enableCodeCoverage YES test | xcpretty

after_success:
- bash <(curl -s https://codecov.io/bash)
2 changes: 1 addition & 1 deletion Sources/RateLimiter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public struct RateLimiter: Middleware {
}

public func respond(to request: Request, chainingTo next: Responder) throws -> Response {
guard let peer = request.peerAddress?.address() else {
guard let peer = request.peerHostname else {
throw Abort(
.forbidden,
metadata: nil,
Expand Down
8 changes: 6 additions & 2 deletions Tests/GatekeeperTests/GatekeeperTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,18 @@ extension GatekeeperTests {
}

func getHTTPRequest() -> Request {
return try! Request(method: .get, uri: "http://localhost:8080/")
return Request(method: .get, uri: "http://localhost:8080/")
}

func getHTTPSRequest() -> Request {

var headers = [HeaderKey: String]()
headers["X-Forwarded-For"] = "192.168.1.2"

return try! Request(
method: .get,
uri: URI("https://localhost:8080/"),
peerAddress: PeerAddress(stream: "192.168.1.2")
headers: headers
)
}
}
Expand Down
10 changes: 0 additions & 10 deletions circle.yml

This file was deleted.

0 comments on commit d3f8221

Please sign in to comment.