iOS:gitlab-runner卡在CI上

时间:2018-06-11 09:01:46

标签: ios xcode gitlab gitlab-ci gitlab-ci-runner

我正在研究Gitlab CI,但是得到一些问题与测试运行有关,因为下面的命令正在终端上工作并给出了完美的测试结果,但不知何故它现在在gitlab CI上运行。

下面是我的 .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

以下命令在我的终端上工作:

   $ xcodebuild test -workspace "First Container.xcworkspace" -scheme "First Container" -destination 'platform=iOS Simulator,name=iPhone 8 Plus,OS=11.3' | xcpretty

但是当我在CI上运行时它停滞不前,我的gitlab-runner没有启动iPhone模拟器并运行测试,构建正在运行

enter image description here

3 个答案:

答案 0 :(得分:1)

在进行sudo及以后的gitlab-runner register时,请勿使用gitlab-runner start。这样,它将以 user-mode (而不是 system-mode )运行。如果您已经使用过sudo,请从GitLab Web UI上删除流道,然后重新注册。

答案 1 :(得分:0)

这是发生在我身上。原因是因为我在系统模式下运行了运行程序。

我更改为使用模式,并且在更改了所需文件夹中的权限后,它才起作用。

答案 2 :(得分:0)

我来晚了一点,但是总比没有好。

正如@acastano和@Nikolay所说,请确保您对gitlab-runner的注册是正确的。我的错误是,作为macOS用户,我遵循Linux而不是macOS注册。否则,请从GitLab.com Settings » CI / CD » Runners » Remove Runner移除gitlab-runner并重新注册。

之后,请按照以下步骤更改您的.gitlab-ci.yml

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

variables: LC_ALL: "en_US.UTF-8"很重要,否则gitlab-runner会显示错误。现在启动gitlab-runner:

gitlab-runner start
gitlab-runner install
gitlab-runner run

确保您从不使用sudo。最后检查您的Gitlab CI:

enter image description here

相关问题