0

The question is because we see an error after moving project to the latest Xcode 10 and Swift 4.2:

My fastfile looks like:

before_all do
  xcversion(version: "10.0")
end
lane :test do
  scan(scheme: SCHEME_NAME, code_coverage: true, output_directory: OUTPUT_PATH + 'tests')
  xcov(
    scheme: SCHEME_NAME, 
    workspace: WORKSPACE_FILE_PATH, 
    json_report: true, 
    markdown_report: true, 
    output_directory: OUTPUT_PATH + "coverage", 
    skip_slack: true,
    only_project_targets: true
  )
end

and gitlab-ci.yml:

stages:
  - build
  - test
  - deploy
  - export

build:
  stage: build
  script:
    - bundle exec pod repo update
    - bundle exec pod install
    - export
  after_script:
    - rm -rf ~/Library/Developer/Xcode/Archives || true
  artifacts:
    name: "Staff_${CI_PIPELINE_ID}"
    paths:
      - Pods/*
      - Staff.xcworkspace
  when: on_success
  tags:
      - iOS

test:
  stage: test
  before_script:
    - killall "Simulator" || true
  script:
    - bundle exec fastlane snapshot reset_simulators --force
    - bundle exec fastlane test
  after_script:
    - killall "Simulator" || true
    - rm -rf ~/Library/Developer/Xcode/Archives || true
  artifacts:
    name: "Staff_${CI_PIPELINE_ID}"
    paths:
      - fastlane/output/coverage
  when: on_success
  tags:
    - iOS

enter image description here

Scriptable
  • 19,402
  • 5
  • 56
  • 72
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
  • 1
    You need to ensure that each pod is installing a version that supports Swift 4.2. Check your pod install phase on your CI too and make sure that it runs `pod repo update` before installing/updating pods as it may not know of any updated versions. There is also a setting in the project settings for SWIFT_VERSION. Check it is set to Swift 4.2 – Scriptable Sep 19 '18 at 12:50
  • as you can see `pod repo update` is called BEFORE `pod install` under `build` stage. – Bartłomiej Semańczyk Sep 19 '18 at 12:52
  • I couldnt see that properly as it wasnt formatted very well. can you build locally on your own machine without any issues? – Scriptable Sep 19 '18 at 12:53
  • yes, I can build locally without any issues. But LOCALLY every pod has Swift version set to 4 instead of 4.2. Why it needs 4.2 on CI? – Bartłomiej Semańczyk Sep 19 '18 at 12:57
  • Does your CI server even have Swift 4.2 installed?, scrap that question. it must have to get the errors you are getting – Scriptable Sep 19 '18 at 12:58
  • compare pod version installed on your local to those on CI server – Scriptable Sep 19 '18 at 12:59
  • `cocoapods 1.5.3` on both: CI and local. Server has xcode 10 installed... so how to force pods to use older swift version? – Bartłomiej Semańczyk Sep 19 '18 at 13:04
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/180352/discussion-between-bartlomiej-semanczyk-and-scriptable). – Bartłomiej Semańczyk Sep 19 '18 at 13:20
  • I meant the individual pods that are being installed. As it appears that at the least CMMarkdownKit Pod is not a version that is updated for Swift 4.2 as the errors suggest the CI is using the Swift 4.2 compiler but the Pod isn't ready for Swift 4.2. check which version of this pod you have local and on server – Scriptable Sep 19 '18 at 13:20
  • Sorry I'm on a secure network and cant access chat – Scriptable Sep 19 '18 at 13:20
  • @Scriptable I added another related question: https://stackoverflow.com/questions/52408345/fastlane-tests-ended-with-success-but-failed-finally. Could you look at that? – Bartłomiej Semańczyk Sep 20 '18 at 06:36

0 Answers0