Code Monkey home page Code Monkey logo

xcodebuild-action's Introduction

Xcodebuild Action

Tests

This action runs xcodebuild with the given options.

Note that this action needs to run on macOS. All other platforms will fail!

Inputs

See action.yml for an overview of all inputs.
For more information about the various inputs, also see man xcodebuild.

Outputs

unprocessed-command

The unprocessed command from which the executed command was resolved. E.g. paths are not resolved in this one.

executed-command

The command that was executed by this action. This will also be printed to the action output.

Example Usage

Example using a Swift Package

Note: If you have multiple products in your package, Xcode will auto-generate a my-tool-Package scheme, where my-tool is the name of your package. If you only have one product, or wish to only build a specific product, you can use the product name as scheme directly.

uses: sersoft-gmbh/xcodebuild-action@v3
with:
  spm-package: './'
  scheme: my-tool-Package
  destination: platform=macOS
  action: test
Example using an Xcode project (xcodeproj)

This will run tests configured with the MyApp scheme inside a MyApp Xcode project.

uses: sersoft-gmbh/xcodebuild-action@v3
with:
  project: MyApp.xcodeproj
  scheme: MyApp
  destination: platform=macOS
  action: test
Example using an Xcode workspace (xcworkspace)

This will run tests configured with the MyApp scheme inside a MyApp Xcode workspace.

Note for CocoaPods: Restoring the CocoaPods dependencies has to be done before running this action.

uses: sersoft-gmbh/xcodebuild-action@v3
with:
  workspace: MyApp.xcworkspace
  scheme: MyApp
  destination: platform=macOS
  action: test

xcodebuild-action's People

Contributors

cameronbroe avatar dependabot[bot] avatar ffried avatar lucasginard avatar sersoft-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xcodebuild-action's Issues

xcodebuild: error: '[app_name].xcworkspace' does not exist.

I've set up a simple workflow, and have played around with a couple different path settings, but I get this same error every single time.
xcodebuild: error: '[app_name].xcworkspace' does not exist.

name: TestAction

on:
  push:
  pull_request:
    branches: [ master, dev ]

jobs:
  build:

    runs-on: macos-latest

    steps:
    - uses: actions/checkout@v2
    - name: Xcodebuild Action
      uses: sersoft-gmbh/[email protected]
      with:
        # The path to the xcworkspace to build. Mutually exclusive with `project`.
        project: [app_name].xcworkspace
        # The scheme to build. Required when using a workspace.
        scheme: [scheme]

File structure from root of repository:
.github.com/workflows/testAction.yml
[app_name]/[app_name].xcworkspace

how/can we include pods

my project has cocoa pods dependencies that need to be built before it can run, how can I include those ?

Build and locate XCUITest Suite for device

Hi!
Trying to build and ZIP the XCUI test suite, but no matter which approach I take, I have issues retrieving the file.

I was only ever able to get the file usually located in DerivedData/**/Build/Products/Debug-iphonesimulator/
never the one which I actually need DerivedData/**/Build/Products/Debug-iphoneos/

In other words, my build target needs to be for generic/device.

Is there a setting I am missing where a runner would be built for a device?
Thank you!

## BUILD AND SAVE XCTEST RUNNER ====================================================
    - name: Build XCUITest via action
      uses: sersoft-gmbh/[email protected]
      with:
       workspace: TARGET.xcworkspace
       scheme: TARGET-UITests
       destination: generic/platform=iOS
       action: build-for-testing
       cloned-source-packages-path: "SourcePackages"
       allow-provisioning-updates: true

    - name: Save XCUI
      uses: actions/upload-artifact@v3
      with:
        name: TARGET-UITests-Runner.app
        path: TARGET-UITests-Runner.app
        
    - name: Zip Runner
      uses: vimtor/action-zip@v1
      with:
        files: TARGET-UITests-Runner.app
        dest: TARGET-UITests-Runner.zip

unable to find simulator

Thank you for the great action!

Would you please help how to specify iOS simulator correctly?

https://github.com/Lucra-Sports/ExploratoryTests/blob/11be4b4b6618b53518a8b27218f6cc4897b0075f/.github/workflows/ios-simulator.yml#L16-L29

    steps:
      - uses: maxim-lobanov/setup-xcode@v1
        with:
          xcode-version: 'latest-stable'
      - run: xcrun xctrace list devices
      - name: Checkout
        uses: actions/checkout@v3
      - name: Test
        uses: sersoft-gmbh/xcodebuild-action@v1
        with:
          project: Experiments.xcodeproj
          scheme: Experiments
          sdk: iphonesimulator
          result-bundle-path: test-results/all-tests
          destination: 'platform=iOS Simulator,name=iPhone 12'

getting:

xcodebuild: error: Unable to find a destination matching the provided destination specifier:
[19](https://github.com/Lucra-Sports/ExploratoryTests/runs/6036429190?check_suite_focus=true#step:5:19)
  		{ platform:iOS Simulator, OS:latest, name:iPhone 12 }
[20](https://github.com/Lucra-Sports/ExploratoryTests/runs/6036429190?check_suite_focus=true#step:5:20)
  
[21](https://github.com/Lucra-Sports/ExploratoryTests/runs/6036429190?check_suite_focus=true#step:5:21)
  	Ineligible destinations for the "Experiments" scheme:
[22](https://github.com/Lucra-Sports/ExploratoryTests/runs/6036429190?check_suite_focus=true#step:5:22)
  		{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
[23](https://github.com/Lucra-Sports/ExploratoryTests/runs/6036429190?check_suite_focus=true#step:5:23)
  		{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
[24](https://github.com/Lucra-Sports/ExploratoryTests/runs/6036429190?check_suite_focus=true#step:5:24)
  Error: Xcodebuild action failed (70)!

https://github.com/Lucra-Sports/ExploratoryTests/runs/6036429190?check_suite_focus=true

Using iOS platform (it does work, not only macOS) and issues with specifying spm-package

In README.md it's stated that only macOS destination will work but that appears to be false.
I've specified destination as following and it did work fine:

destination: platform=iOS Simulator,name=iPhone 13

I'm testing an SPM package and one other weird thing is that I had to set spm-package as . in order for the action to work:

spm-package: .

Here are all jobs that run during CI:

jobs:
  spm:
    name: Swift Package Manager
    runs-on: macOS-12
    steps:
      - uses: actions/checkout@v2
      - name: Resolve dependencies
        run: swift package resolve
      - uses: sersoft-gmbh/xcodebuild-action@v2
        with:
          spm-package: .
          scheme: UniversalProfile
          destination: platform=iOS Simulator,name=iPhone 13
          action: test

P.S. Thanks for this GitHub Action!

Issue choosing a simulator

getting this error when building my project

xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ platform:iOS Simulator, OS:latest, name:iPhone 11 }

Ineligible destinations for the "Ghosting Connector" scheme:
	{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Generic iOS Device }
	{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Generic iOS Simulator Device }

Getting clang error

I have the following build line:

xcodebuild -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO -project 'Split.xcodeproj' -scheme 'Split' -destination 'platform=iOS Simulator,OS=13.2.2,name=iPhone 11 Pro Max' -derivedDataPath "${GITHUB_WORKSPACE}" build | xcpretty

Which I converted to:

    - name: Build with action
      uses: sersoft-gmbh/xcodebuild-action@v1
      with:
        project: Split.xcodeproj
        scheme: Split
        destination: 'platform=iOS Simulator,OS=13.2.2,name=iPhone 11 Pro Max'
        sdk: 'iphonesimulator'
        build-settings: ONLY_ACTIVE_ARCH=NO
        derived-data-path: "${GITHUB_WORKSPACE}"
        use-xcpretty: true
        action: build

The single line version works ok, but for the action one I'm getting some clang errors:

  ▸ Compiling Split_vers.c
  
  ❌  clang: error: no such file or directory: '/Users/runner/work/ios-client/ios-client//Users/runner/work/ios-client/ios-client/ModuleCache.noindex/Session.modulevalidation'
  
  
  ▸ Compiling JFRandom.m
  
  ❌  clang: error: no such file or directory: '/Users/runner/work/ios-client/ios-client//Users/runner/work/ios-client/ios-client/ModuleCache.noindex/Session.modulevalidation'
  
  
  ▸ Compiling JFBCrypt.m
  
  ❌  clang: error: no such file or directory: '/Users/runner/work/ios-client/ios-client//Users/runner/work/ios-client/ios-client/ModuleCache.noindex/Session.modulevalidation'
  
  
  ▸ Compiling Split_vers.c
  ** BUILD FAILED **
  
  
  The following build commands failed:
  	CompileC /Users/runner/work/ios-client/ios-client/Users/runner/work/ios-client/ios-client/Build/Intermediates.noindex/Split.build/Debug-iphonesimulator/Split.build/Objects-normal/x86_64/Split_vers.o /Users/runner/work/ios-client/ios-client/Users/runner/work/ios-client/ios-client/Build/Intermediates.noindex/Split.build/Debug-iphonesimulator/Split.build/DerivedSources/Split_vers.c normal x86_64 c com.apple.compilers.llvm.clang.1_0.compiler
  	CompileC /Users/runner/work/ios-client/ios-client/Users/runner/work/ios-client/ios-client/Build/Intermediates.noindex/Split.build/Debug-iphonesimulator/Split.build/Objects-normal/x86_64/JFRandom.o /Users/runner/work/ios-client/ios-client/Split/Common/Utils/JFBCrypt/JFRandom.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
  	CompileC /Users/runner/work/ios-client/ios-client/Users/runner/work/ios-client/ios-client/Build/Intermediates.noindex/Split.build/Debug-iphonesimulator/Split.build/Objects-normal/x86_64/JFBCrypt.o /Users/runner/work/ios-client/ios-client/Split/Common/Utils/JFBCrypt/JFBCrypt.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
  (3 failures)
  Error: Xcodebuild action failed (65)!

any idea? are my parameters wrong?

I have an initial step for selecting xcode:

    - name: Select Xcode
      uses: maxim-lobanov/setup-xcode@v1
      with:
        xcode-version: 11.2

Log xcodebuild command before execution

Thank you for the great GitHub action!
We use it everyday on GitHub and self hosted runners.

Sometime we have to reproduce the failure locally and it's hard to construct exact command that caused the failure.
It would be great if action logs xcodebuild command before executing it. This way when build has failed on CI, we can copy paste it locally in attempt to reproduce the failure.

We used to do that when we simply run xcodebuild as a shell command from our workflow. Now we use action it takes time to convert action parameters to xcodebuild parameters.

Unable to build Xcode project with Automatic manage signing enabled

I have Xcode project with automatic manage signing. And trying to build it using GitHub Actions,

# Whether provisioning updates are allowed. See also `xcodebuild`'s `-allowProvisioningUpdates`.
allow-provisioning-updates: true
# Whether provisioning device registrations are allowed. See also `xcodebuild`'s `-allowProvisioningDeviceRegistration`.
allow-provisioning-device-registration: true

image

but got error

image

How does one specfiy multiple tests to be skipped?

As a dev-ops engineer, I would like to be able to specify a list of tests to skip or only test.

Here is an example yml config that will fail:

name: Swift Integration Tests

on:
  pull_request:
    branches:
  push:
    branches:
      - master

jobs:
  test:
    name: Tests
    runs-on: macos-latest
    strategy:
      matrix:
        destination: ['platform=iOS Simulator,OS=14.4,name=iPhone 12 Pro Max']

    steps:
      - name: Checkout Code
        uses: actions/checkout@v2

      - name: Build and Test
        uses: sersoft-gmbh/xcodebuild-action@v1
        with: 
          project: OurSDK.xcodeproj
          scheme: OurSDKTests
          destination: ${{ matrix.destination }}
          action: test
          skip-testing:
              - SDK/SDKFilterTests/testBlurFilter
              - SDK/SDKLocationTests/testRealLocation
              - SDK/SDKMiscTests/

This will fail due to skip-testing not expecting a sequence. This will pass:

...
    skip-testing: 'SDK/SDKFilterTests/testBlurFilter'

But now how can I define other tests to skip, given that duplicate keys with different values in YAML will simply overwrite the first key?

Composing command does not show double quotes

Composing command output is very useful for debugging failing tests locally.

Usually we copy it from log to paste to terminal locally.

Unfortunately it fails due to double quotes:

https://github.com/Lucra-Sports/ExploratoryTests/runs/6053712764?check_suite_focus=true#step:5:13

shows:
xcodebuild -project Experiments.xcodeproj -scheme Experiments -destination platform=iOS Simulator,name=iPhone 12 -resultBundlePath /Users/runner/work/ExploratoryTests/ExploratoryTests/test-results/all-tests test | xcpretty --color

while actual command should be:
xcodebuild -project Experiments.xcodeproj -scheme Experiments -destination "platform=iOS Simulator,name=iPhone 12" -resultBundlePath /Users/runner/work/ExploratoryTests/ExploratoryTests/test-results/all-tests test | xcpretty --color

where double quotes should be around long arguments: "platform=iOS Simulator,name=iPhone 12"

Second question:

Would also be possible to path for the resultBundlePath as it is in the workflow file?
For example:
instead of: /Users/runner/work/ExploratoryTests/ExploratoryTests/test-results/all-tests
to show: test-results/all-tests
as it is in the workflow file: https://github.com/Lucra-Sports/ExploratoryTests/actions/runs/2179851359/workflow#L30

This allows to run same command locally, as absolute path is different.

Thank you!

How to add Frameworks, Other Linker Flags and keys on ".plist" to project?

Hello, I'm currently working on a job to export a game engine project "Godot" to iOS, the job will export (working), and test in xcode (not working).

I've been researching a little and could do this with xcodebuild, but I'm not getting it, until I found this Action from GitHub, but I found no part to add framework in the documentation, its possible with this action?

I want to add frameworks, add linker flags and add keys on ".plist" file.

If this action can not do this, thats ok, but if possible tell me how to do this directly using the command xcodebuild, thanks

Run Xcode Test Plans

I would like to be able to run my Test Plans instead of the traditional tests. Is it possible to achieve this with this GitHub actions repository?

Add support for xcbeautify

Hi,

I found that xcpretty does not really pick up the output from Xcode test plans running in parallel but xcbeautify works fine. It would be great to add an option to use xcbeautify. I think it works the same way as xcpretty, i.e the output is piped through.

macOS test fails to CodeSign the app

running Mac OS application tests fails to code sign. When we run xcodebuild as a shell command it succeeds.

  ▸ Signing ~/DerivedData/App-.../Build/Products/Debug/App.app/Contents/Frameworks/MyFramework.framework
34
  ▸ Running script '[CP] Embed Pods Frameworks'
35
  ** TEST FAILED **
36
  
37
  
38
  The following build commands failed:
39
  	CodeSign ../DerivedData/App-.../Build/Products/Debug/App.app
40
  (1 failure)
41
  Error: Xcodebuild action failed (65)!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.