Build and test macos app - help with config.yml file


#1

Hi. I have a macos project (not iOS) that has several unit tests I would like to run on CircleCI. I have paid for the seed plan but I am struggling to get this to work. Everything I find of examples is related to iOS testing using fastlane and not applicable to my macos testing. I wonder if testing of macos apps is actually possible to do on circleCI? If so could anyone help me with a config.yml file so I can see how others are doing this? I can run my workflow using my current config.yml but it fails at xcodebuild because of lack of code signing certificates. I don’t see how I can upload my provisioning profile+certificates to CircleCI and to get everything to work properly. I see that iOS uses fastlane and gym but that does not help me on macos app. Is it possible to do unit testing on macos yet? How do I do it? An example would be fantastic.

Thanks. Cheers, Trond

My config.yml:
<version: 2
jobs:
build-and-test:
macos:
xcode: 9.2.0
working_directory: /Users/distiller/project
environment:
FL_OUTPUT_DIR: /Users/distiller/project/output
FASTLANE_LANE: test
shell: /bin/bash --login -o pipefail
steps:
- checkout
- run: mkdir FL_OUTPUT_DIR - run: bundle install - run: name: Fetch CocoaPods Specs command: | curl https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash -s cf - run: name: Install Cocoapods command: pod install - run: name: xcodebuild command: xcodebuild CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= PROVISIONING_PROFILE= -sdk macosx10.13 -destination "platform=macOS,arch=x86_64" -workspace Project.xcworkspace -scheme ProjectTests clean build-for-testing | xcpretty --color --report junit --output /Users/distiller/project/output/xcode-results.xml && exit {PIPESTATUS[0]}
- run:
name: xctool
command: xctool CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= PROVISIONING_PROFILE= -reporter pretty -reporter junit:/Users/distiller/project/output/xctool-results.xml -reporter plain:xctool.log -sdk macosx10.13 -destination “platform=macOS,arch=x86_64” -workspace Project.xcworkspace -scheme ProjectTests run-tests && exit ${PIPESTATUS[0]}
- store_artifacts:
path: /Users/distiller/project/output
- store_test_results:
path: /Users/distiller/project/output

adhoc:
macos:
xcode: 9.2.0
working_directory: /Users/distiller/project
environment:
FL_OUTPUT_DIR: /Users/distiller/project/output
FASTLANE_LANE: adhoc
shell: /bin/bash --login -o pipefail
steps:
- checkout
- run: bundle install
- run:
name: Fastlane
command: bundle exec fastlane $FASTLANE_LANE
- store_artifacts:
path: /Users/distiller/project/output/myapp.app

beta:
macos:
xcode: 9.2.0
working_directory: /Users/distiller/project
environment:
FL_OUTPUT_DIR: /Users/distiller/project/output
FASTLANE_LANE: beta
shell: /bin/bash --login -o pipefail
steps:
- checkout
- run: bundle install
- run:
name: Fastlane
command: bundle exec fastlane $FASTLANE_LANE
- store_artifacts:
path: /Users/distiller/project/output/myapp.app

workflows:
version: 2
build-test-adhoc:
jobs:
- build-and-test
- adhoc:
filters:
branches:
only: development
requires:
- build-and-test
#- beta:
#filters:
#branches:
#only: master
#requires:
#- build-and-test


#2