I have a iOS project where I login into a 3rd party service. I have a few tests like these that I want to run locally and in my GitLab runner when I commit. Here's an example of a test method :
func testLoginWsSuccess() {
let expectation = self.expectation(description: "Login Success")
MyClient.sharedInstance().authenticate(login: "***USERNAME***", password: "***PASSWORD***") { (success, error) in
XCTAssertTrue(success)
XCTAssertNil(error)
expectation.fulfill()
}
waitForExpectations(timeout: WEBSERVICE_TIMEOUT) { (_) -> Void in }
}
My problem is how can I make it so credentials are not shown either in my GitLab pipeline nor stored in my repository. I also want to be able to run my tests locally.
So far I've thought about using sed in my job to replace the string but that shows up in my console so that's out. and for Xcode to use a .xcconfig file and have the credentials stored there but add it to the .gitignore. That would work locally but I don't know how I can set it up so my runner also has .xcconfig file to refer to.
Here is my .gitlab-ci.yml if that helps :
stages:
- build
build_project:
stage: build
script:
#Carthage
- carthage bootstrap
# Build and test project
- xcodebuild clean -project MyProject.xcodeproj -scheme MyProject | xcpretty
- xcodebuild test -project MyProject.xcodeproj -scheme MyProject -destination 'platform=iOS Simulator,name=iPhone 6s,OS=10.3.1' | xcpretty -s
tags:
- ios
- xcode8.3
Thanks for reading this.
Aucun commentaire:
Enregistrer un commentaire