9

I'm trying to make a simple workflow using github actons, so when I push for example to my master branch, it builds the code in macOS-latest and test it on OS 12.4, iPhone 11 Pro Max. Since it's very new, the tutorials are not complete, can someone lend me hand?

This is what I have for now:

name: StyleOn_Workflow

on: [push]

jobs:
  build:

    runs-on: macOS-latest
    strategy:
      matrix:
        destination: ['platform=iOS Simulator,OS=12.4,name=iPhone 11 Pro Max']

    steps:
    - uses: actions/checkout@master
    - name: Build
      run: swift build -v

  test:
      name: Test
      runs-on: macOS-latest
      strategy:
          matrix:
            destination: ['platform=iOS Simulator,OS=12.4,name=iPhone 11 Pro Max']
      steps:
        - name: Checkout
          uses: actions/checkout@master
        - name: Run tests
          run: swift test -v

Also since I'm not deploying the app to the app store, how can I do the deployment phase? Maybe merge it to the master branch? I need to have 3 phases, build, test and deploy

This is the error I'm getting:

enter image description here

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Arturo
  • 3,254
  • 2
  • 22
  • 61
  • The url `https://api.github.com/repos/actions/checkout/tarball/Development` doesn't exist. – koen Nov 15 '19 at 20:19
  • Yes, I changed it to `- uses: actions/checkout@master` and not it works but with errors too, I'll update it – Arturo Nov 15 '19 at 20:22
  • Did you get it to work finally? I also have the "root manifest not found" error – gurehbgui Jan 16 '20 at 07:49
  • @gurehbgui no, too little information – Arturo Jan 16 '20 at 13:24
  • I haven't seen anyone talk about what the difference is between swift build and xcodebuild. In addition the default action recommended by GitHub Actions uses swift build so it doesn't directly answer the question on why swift build doesn't work. – ChunWu Sep 04 '20 at 01:08

1 Answers1

11

Based on your question I think you should use xcodebuild command line tool instead of swift build and swift test.

As I see you should use a command like this for build:

set -o pipefail && xcodebuild clean -scheme $SCHEME -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH build-for-testing

And use this for testing:

set -o pipefail && xcodebuild test-without-building -xctestrun $(find . -type f -name "*.xctestrun") -destination "platform=iOS Simulator,name=$DEVICE" -derivedDataPath $DERIVED_DATA_PATH -enableCodeCoverage YES

Please note that between jobs you should upload and download the .xctestrun file.

You can find a detailed example here.

Gergely
  • 448
  • 3
  • 13