0

I am interested in running build for my Swift project on CI with GitHub Actions

I use the following ci.yml:

Build:
    runs-on: macOS-latest
    
    steps:
      - name: Install Swift
        uses: slashmo/install-swift@v0.2.1
        with:
          version: 5.7
      - name: Checkout
        uses: actions/checkout@v1
      - name: Build
        uses: sersoft-gmbh/xcodebuild-action@v2
        with:
          project: <Project>.xcodeproj
          scheme: <Scheme>
          destination: "platform=iOS Simulator,name=iPhone 14 Pro Max"
          action: build

I am facing a problem here:

xcodebuild: error: Could not resolve package dependencies:
    package at '/Users/runner/work/path/to/my/package' is using Swift tools version 5.7.0 but the installed version is 5.5.0

I want to use swift-tools-version equal to 5.7.0, not the lower one

Please, help me install the version I need

Daniel Pustotin
  • 237
  • 1
  • 9
  • I'm experiencing the same issue, but using the image `macOS-12` instead of the `macOS-latest`. You'll have the same error message but instead of having `5.5.0` as the installed version, it will say `5.6.0`. I've been checking and looks like we either need to wait until they propagate new runner images. – CSolanaM Sep 27 '22 at 15:38

1 Answers1

1

Looks like I made it work. I added this step in my workflow:

      - name: Select Xcode
        run: sudo xcode-select -s "/Applications/Xcode_14.0.1.app"

and then specified the simulator environment:

        env:
          destination: 'platform=iOS Simulator,name=iPhone 14 Pro,OS=16.0'
CSolanaM
  • 3,138
  • 1
  • 20
  • 21
  • That you for your solution! May be you know how to handle the following error with this config: `xcode-select: error: invalid developer directory '/Applications/Xcode_14.0.1.app'` – Daniel Pustotin Sep 29 '22 at 19:22
  • 1
    According to this thread we are having the ability to use xcode-version 14.0 since next week https://github.com/actions/runner-images/issues/6225 – Daniel Pustotin Sep 29 '22 at 19:31
  • True, I just saw that. Before, in that same thread, they were saying that the new image was already applied and we only needed to wait for changes propagation, now they say there were some issues. Looks like everything makes sense for now. As per your question, did you add it with double or single quotes? – CSolanaM Sep 29 '22 at 20:17
  • I just copied your variant. So, double quotes) Did you managed that working? Please, help me) – Daniel Pustotin Sep 29 '22 at 20:42
  • Did you try changing the runner image you're using from `runs-on: macOS-latest` to `runs-on: macOS-12` ? – CSolanaM Sep 29 '22 at 21:05
  • That is magic! Idk why `macOS-latest` does not support Xcode-14, while `macOS-12` does! Anyway, that is better to wait the updated macOS image on the 3rd of October 2022 – Daniel Pustotin Sep 30 '22 at 19:44