Reputation: 1906
I am working on Gitlab CI, but getting some issue relate to test run, as below command is working on terminal and given perfectly test result but somehow its now run on gitlab CI.
below is my .gitlab-ci.yml
stages:
- build
build_project:
stage: build
script:
- xcodebuild clean -workspace "First Container.xcworkspace" -scheme "First Container" | xcpretty
- xcodebuild test -workspace "First Container.xcworkspace" -scheme "First Container" -destination 'platform=iOS Simulator,name=iPhone 8 Plus,OS=11.3' | xcpretty
tags:
- ios_11-3
- xcode_9-3
- osx_10-13-4
below command work on my terminal:
$ xcodebuild test -workspace "First Container.xcworkspace" -scheme "First Container" -destination 'platform=iOS Simulator,name=iPhone 8 Plus,OS=11.3' | xcpretty
but it stuck when I run on CI, my gitlab-runner not launch iPhone simulator and run the test, build is working
Upvotes: 6
Views: 2038
Reputation: 507
I'm a little late, but it's better than nothing at all.
As @acastano and @Nikolay have said, make sure your registration for the gitlab-runner was correct. My mistake was, as a macOS-User I followed the Linux instead of the macOS-Registration. Otherwise remove the gitlab-runner from GitLab.com Settings » CI / CD » Runners » Remove Runner
and register again.
After that change your .gitlab-ci.yml
as follow:
stages:
- build
variables:
LC_ALL: "en_US.UTF-8"
build_project:
stage: build
script:
- xcodebuild clean -project testProject.xcodeproj -scheme testProject+ | xcpretty
- xcodebuild test -project testProject.xcodeproj -scheme testProject+ -destination 'platform=iOS Simulator,name=iPhone X,OS=12.1' | xcpretty -s
The variables: LC_ALL: "en_US.UTF-8"
is important, otherwise the gitlab-runner displays an error. Now start the gitlab-runner:
gitlab-runner start
gitlab-runner install
gitlab-runner run
Make sure you never use sudo
. Finally check your Gitlab CI:
Upvotes: 1
Reputation: 9055
Do not use sudo
when you do gitlab-runner register
and later gitlab-runner start
. That way it will run in user-mode (as opposed to system-mode). If you've already used sudo
, remove the runner (from GitLab Web UI) and register again.
Upvotes: 2
Reputation: 807
This was happening to me. The reason was because I was running the runner in system mode.
I changed to use mode and it worked after changing the permissions in the folders needed.
Upvotes: 0