I am using fastlane in github actions to build my project, this is my github actions script:
name: Cruise-CI
on:
push:
branches: [ main ]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout#v2
- uses: actions/setup-java#v1
with:
java-version: '12.x'
- uses: subosito/flutter-action#v1
with:
flutter-version: '1.22.5'
- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_12.1.app/Contents/Developer'
- name: Bundle install
run: cd ./ios && bundle install && bundle update fastlane
- name: Install tools
run: |
flutter precache
flutter pub get
cd ./ios && pod repo update && pod install
#- run: flutter pub get
#- run: flutter build apk
#- run: flutter build ios --release --no-codesign
- name: Setup SSH Keys and known_hosts for fastlane match
run: |
SSH_PATH="$HOME/.ssh"
mkdir -p "$SSH_PATH"
touch "$SSH_PATH/known_hosts"
echo "$PRIVATE_KEY" > "$SSH_PATH/id_rsa"
chmod 700 "$SSH_PATH"
ssh-keyscan github.com >> ~/.ssh/known_hosts
chmod 600 "$SSH_PATH/known_hosts"
chmod 600 "$SSH_PATH/id_rsa"
eval $(ssh-agent)
ssh-add "$SSH_PATH/id_rsa"
env:
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Deploy to TestFlight/PGY
run: |
cd ./ios && bundle exec fastlane beta
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
GIT_URL: ${{ secrets.GIT_URL }}
PGY_USER_KEY: ${{ secrets.PGY_USER_KEY }}
PGY_API_KEY: ${{ secrets.PGY_API_KEY }}
TEAM_ID: ${{ secrets.TEAM_ID }}
ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}
FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS: ${{ secrets.DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS }}
and this is my Fastfile script:
update_fastlane
default_platform(:ios)
platform :ios do
desc "Push a new beta build to pgy"
before_all do
ENV["CACHE_GIT_URL"] = ENV["GIT_URL"]
end
lane :beta do
xcode_select('/Applications/Xcode_12.1.app')
if is_ci
create_keychain(
name: ENV['MATCH_KEYCHAIN_NAME'],
password: ENV["MATCH_KEYCHAIN_PASSWORD"],
default_keychain: true,
unlock: true,
timeout: 3600,
lock_when_sleeps: false
)
end
match(
app_identifier: ENV["APP_IDENTIFIER"],
git_url: ENV["GIT_URL"],
type: "adhoc",
readonly: is_ci,
keychain_name: ENV['MATCH_KEYCHAIN_NAME'],
keychain_password: ENV["MATCH_KEYCHAIN_PASSWORD"]
)
build_app(
workspace: "Runner.xcworkspace",
scheme: "Runner",
export_method: "ad-hoc"
)
pgyer(
api_key: ENV['PGY_API_KEY'],
user_key: ENV['PGY_USER_KEY']
)
end
end
but when runs in github actions shows this error:
** ARCHIVE FAILED **
The following build commands failed:
PhaseScriptExecution Run\ Script /Users/runner/Library/Developer/Xcode/DerivedData/Runner-gzzbtgmsqethlzedjqlbspydxjjv/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Runner.build/Release-iphoneos/Runner.build/Script-9740EEB61CF901F6004384FC.sh
(1 failure)
[04:51:35]: Exit status: 65
[04:51:35]:
[04:51:35]: Maybe the error shown is caused by using the wrong version of Xcode
[04:51:35]: Found multiple versions of Xcode in '/Applications/'
[04:51:35]: Make sure you selected the right version for your project
[04:51:35]: This build process was executed using '/Applications/Xcode_12.1.app'
[04:51:35]: If you want to update your Xcode path, either
[04:51:35]:
[04:51:35]: - Specify the Xcode version in your Fastfile
[04:51:35]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
[04:51:35]:
[04:51:35]: - Specify an absolute path to your Xcode installation in your Fastfile
[04:51:35]: ▸ xcode_select "/Applications/Xcode8.app"
[04:51:35]:
[04:51:35]: - Manually update the path using
[04:51:35]: ▸ sudo xcode-select -s /Applications/Xcode.app
[04:51:35]:
+---------------+------------------------------+
| Build environment |
+---------------+------------------------------+
| xcode_path | /Applications/Xcode_12.1.app |
| gym_version | 2.171.0 |
| export_method | ad-hoc |
| sdk | iPhoneOS14.1.sdk |
+---------------+------------------------------+
[04:51:35]: ▸ ../../../hostedtoolcache/flutter/1.22.5-stable/x64/packages/flutter/lib/src/widgets/scroll_view.dart:588:9: Context: Found this candidate, but the arguments don't match.
[04:51:35]: ▸ const CustomScrollView({
[04:51:35]: ▸ ^^^^^^^^^^^^^^^^
[04:51:35]: ▸ Command PhaseScriptExecution failed with a nonzero exit code
[04:51:35]:
[04:51:35]: ⬆️ Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[04:51:35]: 📋 For the complete and more detailed error log, check the full log at:
[04:51:35]: 📋 /Users/runner/Library/Logs/gym/Runner-Runner.log
[04:51:35]:
[04:51:35]: Looks like fastlane ran into a build/archive error with your project
[04:51:35]: It's hard to tell what's causing the error, so we wrote some guides on how
[04:51:35]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[04:51:35]: Before submitting an issue on GitHub, please follow the guide above and make
[04:51:35]: sure your project is set up correctly.
[04:51:35]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[04:51:35]: the full commands printed out in yellow in the above log.
[04:51:35]: Make sure to inspect the output above, as usually you'll find more error information there
[04:51:35]:
+------------------------------------+--------------------------------------------------------+
| Lane Context |
+------------------------------------+--------------------------------------------------------+
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | ios |
| LANE_NAME | ios beta |
| KEYCHAIN_PATH | ~/Library/Keychains/*** |
| ORIGINAL_DEFAULT_KEYCHAIN | "/Users/runner/Library/Keychains/login.keychain-db" |
| SIGH_PROFILE_TYPE | ad-hoc |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"com.earth.dolphin"=>"match AdHoc com.earth.dolphin"} |
+------------------------------------+--------------------------------------------------------+
[04:51:35]: Error building the application - see the log above
I have already tried to specify the version of xcode in fastlane file like this:
xcode_select('/Applications/Xcode_12.1.app')
but still not work, what should I do to fix this? I also tried to change the xcode version to 12.3 follow this doc like this:
xcode_select('/Applications/Xcode_12.3.app')
still now work.
You are running on the latest MacOS image (which, at time of writing, is macos-10.15 with Xcode 12.4.0.0.1.1610135815—see installed tools):
jobs:
build:
runs-on: macos-latest
But you are trying to select a specific version of Xcode to use:
- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_12.1.app/Contents/Developer'
The latest MacOS version (and the installed Xcode version) are liable to change if you use the -latest suffix when specifying the runs-on image.
Ensure that your MacOS and Xcode versions are compatible or just remove the Select Xcode version step entirely.
Related
i having the follow error:
Command: app-store-connect publish --path /Users/builder/clone/build/ios/ipa/zimexahse.ipa --key-id '$APP_STORE_CONNECT_KEY_IDENTIFIER' --issuer-id '$APP_STORE_CONNECT_ISSUER_ID' --private-key #env:APP_STORE_CONNECT_PUBLISHER_PRIVATE_KEY
error: argument --private-key: Provided value in environment variable "APP_STORE_CONNECT_PUBLISHER_PRIVATE_KEY" is not valid. Provided value is not a valid PEM encoded private key
codemagic.yaml
workflows:
ios-workflow-id:
name: iOS Workflow
max_build_duration: 120
instance_type: mac_mini_m1
environment:
node: 14.17.6
npm: latest
ios_signing:
distribution_type: development # or: ad_hoc | development | enterprise
bundle_identifier: ...
groups:
- appstore_credentials
vars:
APP_ID: ...
BUNDLE_ID: "..."
XCODE_WORKSPACE: "....xcworkspace"
XCODE_SCHEME: "..."
scripts:
- name: install node dependencies
script: |
yarn install
# npm install --legacy-peer-deps
- name: Set Info.plist values
script: |
PLIST=$CM_BUILD_DIR/$XCODE_SCHEME/Info.plist
PLIST_BUDDY=/usr/libexec/PlistBuddy
$PLIST_BUDDY -c "Add :ITSAppUsesNonExemptEncryption bool false" $PLIST
- name: Install CocoaPods dependencies
script: |
cd ios && pod install
- name: Set up provisioning profiles settings on Xcode project
script: xcode-project use-profiles
- name: Increment build number
script: |
cd $CM_BUILD_DIR/ios
LATEST_BUILD_NUMBER=$(app-store-connect get-latest-app-store-build-number "$APP_ID")
agvtool new-version -all $(($LATEST_BUILD_NUMBER + 1))
- name: Build ipa for distribution
script: |
xcode-project build-ipa \
--workspace "$CM_BUILD_DIR/ios/$XCODE_WORKSPACE" \
--scheme "$XCODE_SCHEME" \
--archive-flags="-destination 'generic/platform=iOS'"
artifacts:
- build/ios/ipa/*.ipa
- /tmp/xcodebuild_logs/*.log
- $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.app
- $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.dSYM
publishing:
app_store_connect:
api_key: $APP_STORE_CONNECT_PRIVATE_KEY
key_id: $APP_STORE_CONNECT_KEY_IDENTIFIER
issuer_id: $APP_STORE_CONNECT_ISSUER_ID
submit_to_testflight: true
beta_groups:
- ...
submit_to_app_store: false
the api key was already configured in codemagic
make sure APP_STORE_CONNECT_PUBLISHER_PRIVATE_KEY variable includes -----BEGIN OPENSSH PRIVATE KEY----- and -----END OPENSSH PRIVATE KEY----- lines (depends on the key format it can be RSA instead of OPENSSH)
Because the personal developer only could have 3 distribution certificate(https://help.apple.com/xcode/mac/current/#/dev3a05256b8), I have more than 3 apps, so I have to make different app use the same certificate, this is what I am trying to do.
Step 1: export the certificate from keychain
step 2: generate the cert file and pem file by using this command:
openssl pkcs12 -nocerts -nodes -out key.pem -in Certificates.p12
openssl aes-256-cbc -k 225843 -in key.pem -out MLD9L5TNVK.p12 -a
openssl aes-256-cbc -k 225843 -in Certificates.cer -out MLD9L5TNVK.cer -a
then add the MLD9L5TNVK.p12 and MLD9L5TNVK.cer file to the certificate repo that management by fastlane match.
step 3: using fastlane match to generate the provision file:
fastlane match adhoc
but when I using this command to publish the ios package in GitHub Actions:
- name: Deploy to TestFlight/PGY
run: |
cd ./ios
bundle exec fastlane beta
env:
FLUTTER_ROOT: ${{ secrets.FLUTTER_ROOT }}
APPLE_ID: ${{ secrets.APPLE_ID }}
GIT_URL: ${{ secrets.GIT_URL }}
PGY_USER_KEY: ${{ secrets.PGY_USER_KEY }}
PGY_API_KEY: ${{ secrets.PGY_API_KEY }}
TEAM_ID: ${{ secrets.TEAM_ID }}
ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}
FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
show this error message:
No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "***" with a private key was found. (in target 'Runner' from project 'Runner')
this is the detail log output:
+-----------------------------------------------------------+-----------------------------------------------------------+
| Summary for gym 2.191.0 |
+-----------------------------------------------------------+-----------------------------------------------------------+
| workspace | Runner.xcworkspace |
| scheme | Runner |
| export_method | ad-hoc |
| export_options.provisioningProfiles.com.reddwarf.musicapp | match AdHoc com.reddwarf.musicapp 1629273389 |
| clean | false |
| output_directory | . |
| output_name | Runner |
| silent | false |
| skip_package_ipa | false |
| skip_package_pkg | false |
| build_path | /Users/runner/Library/Developer/Xcode/Archives/2021-08-18 |
| result_bundle | false |
| buildlog_path | ~/Library/Logs/gym |
| destination | generic/platform=iOS |
| skip_profile_detection | false |
| skip_package_dependencies_resolution | false |
| disable_package_automatic_updates | false |
| use_system_scm | false |
| xcode_path | /Applications/Xcode_12.4.app |
+-----------------------------------------------------------+-----------------------------------------------------------+
[10:05:55]: $ set -o pipefail && xcodebuild -workspace Runner.xcworkspace -scheme Runner -destination 'generic/platform=iOS' -archivePath /Users/runner/Library/Developer/Xcode/Archives/2021-08-18/Runner\ 2021-08-18\ 10.05.55.xcarchive archive | tee /Users/runner/Library/Logs/gym/Runner-Runner.log | xcpretty
[10:06:00]: ▸ ❌ error: No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "***" with a private key was found. (in target 'Runner' from project 'Runner')
[10:06:00]: ▸ The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
[10:06:00]: ▸ ** ARCHIVE FAILED **
❌ error: No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "***" with a private key was found. (in target 'Runner' from project 'Runner')
The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
** ARCHIVE FAILED **
[10:06:00]: Exit status: 65
[10:06:00]:
[10:06:00]: Maybe the error shown is caused by using the wrong version of Xcode
[10:06:00]: Found multiple versions of Xcode in '/Applications/'
[10:06:00]: Make sure you selected the right version for your project
[10:06:00]: This build process was executed using '/Applications/Xcode_12.4.app'
[10:06:00]: If you want to update your Xcode path, either
[10:06:00]:
[10:06:00]: - Specify the Xcode version in your Fastfile
[10:06:00]: ▸ xcversion(version: "8.1") # Selects Xcode 8.1.0
[10:06:00]:
[10:06:00]: - Specify an absolute path to your Xcode installation in your Fastfile
[10:06:00]: ▸ xcode_select "/Applications/Xcode8.app"
[10:06:00]:
[10:06:00]: - Manually update the path using
[10:06:00]: ▸ sudo xcode-select -s /Applications/Xcode.app
[10:06:00]:
+---------------+------------------------------+
| Build environment |
+---------------+------------------------------+
| xcode_path | /Applications/Xcode_12.4.app |
| gym_version | 2.191.0 |
| export_method | ad-hoc |
| sdk | iPhoneOS14.4.sdk |
+---------------+------------------------------+
[10:06:00]: ▸ note: Building targets in parallel
[10:06:00]: ▸ note: Planning build
[10:06:00]: ▸ note: Constructing build description
[10:06:00]: ▸ error: No signing certificate "iOS Distribution" found: No "iOS Distribution" signing certificate matching team ID "***" with a private key was found. (in target 'Runner' from project 'Runner')
[10:06:00]: ▸ warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99. (in target 'Flutter' from project 'Pods')
[10:06:00]:
[10:06:00]: ⬆️ Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[10:06:00]: 📋 For the complete and more detailed error log, check the full log at:
[10:06:00]: 📋 /Users/runner/Library/Logs/gym/Runner-Runner.log
[10:06:00]:
[10:06:00]: Looks like fastlane ran into a build/archive error with your project
[10:06:00]: It's hard to tell what's causing the error, so we wrote some guides on how
[10:06:00]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[10:06:00]: Before submitting an issue on GitHub, please follow the guide above and make
[10:06:00]: sure your project is set up correctly.
[10:06:00]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[10:06:00]: the full commands printed out in yellow in the above log.
[10:06:00]: Make sure to inspect the output above, as usually you'll find more error information there
[10:06:00]:
+------------------------------------+---------------------------------------------------------------------------+
| Lane Context |
+------------------------------------+---------------------------------------------------------------------------+
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | ios |
| LANE_NAME | ios beta |
| KEYCHAIN_PATH | ~/Library/Keychains/*** |
| ORIGINAL_DEFAULT_KEYCHAIN | "/Users/runner/Library/Keychains/***.keychain-db" |
| SIGH_PROFILE_TYPE | ad-hoc |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"com.reddwarf.musicapp"=>"match AdHoc com.reddwarf.musicapp 1629273389"} |
+------------------------------------+---------------------------------------------------------------------------+
[10:06:00]: Error building the application - see the log above
+------+------------------+-------------+
| fastlane summary |
+------+------------------+-------------+
| Step | Action | Time (in s) |
+------+------------------+-------------+
| 1 | default_platform | 0 |
| 2 | xcode_select | 0 |
| 3 | create_keychain | 0 |
| 4 | is_ci | 0 |
| 5 | match | 2 |
| 💥 | build_app | 8 |
+------+------------------+-------------+
[10:06:00]: fastlane finished with errors
[!] Error building the application - see the log above
Error: Process completed with exit code 1.
why would this happen? what should I do to fix this problem?Any help is appreciated. I can not revoke the certificate because the certificate is using now. I also tried to find the iOS Distribution but failed:
did not found the "iOS distribution".
If you want to use a single developer and/or distribution certificate for multiple apps belonging to the same development team, you may use the same signing identities repository and branch to store the signing identities for your apps:
Matchfile example for both App #1 and #2:
git_url("https://github.com/example/example-repo.git")
git_branch("master")
match will reuse certificates and will create separate provisioning profiles for each app.
I'm trying to replace our iOS project's horrible Jenkins setup with Github Actions. I think I have all the pieces in place, but I'm getting a failure I don't understand. In the step where I run xcodebuild to build and test the app, I'm getting an error that xcpretty is an unknown command, despite being installed via bundler in a previous step. Here are the relevant files:
build-and-run.yml
---
name: Build & Test
on:
# Run tests when a PR merges.
push:
branches:
- develop
# Run tests when PRs are created or updated.
pull_request:
types: [opened, synchronize, reopened]
# Allow the workflow to be run manually.
workflow_dispatch:
env:
DEVELOPER_DIR: /Applications/Xcode_12.app/Contents/Developer
jobs:
test:
name: Build & Test
runs-on: 'macos-latest'
steps:
- name: Checkout Project
uses: actions/checkout#v2
with:
ref: develop
- name: Setup Ruby
uses: ruby/setup-ruby#v1.46.0
with:
ruby-version: 2.7.1
- name: Restore Ruby Cache
uses: actions/cache#v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gem-
- name: Restore Pod Cache
uses: actions/cache#v1
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Bundle Install
run: |
bundle config path vendor/bundle
bundle install --without=documentation --jobs 4 --retry 3
- name: Install Cocoapods
run: pod install --repo-update
- name: Show Xcode Version
run: xcode-select -p
- name: Show Build Settings
run: xcodebuild -workspace ./MyApp.xcworkspace -scheme 'MyApp-Test' -destination 'platform=iOS Simulator,name=iPhone 11' -showBuildSettings
- name: Test MyApp
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace MyApp.xcworkspace -scheme MyApp-Test -destination 'platform=iOS Simulator,name=iPhone 11' -enableCodeCoverage YES -derivedDataPath build/derived-data clean test | xcpretty -s
- name: Run Danger
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
run: bundle exec danger
Gemfile (we don't use fastlane in the action, but I have to keep it in the Gemfile for now so the builds don't break on our Jenkins box):
source 'https://rubygems.org'
ruby '2.7.1'
gem 'cocoapods'
gem 'danger'
gem 'fastlane'
gem 'xcpretty'
gem 'danger-slather'
gem 'danger-swiftlint'
gem 'danger-xcode_summary'
gem 'xcpretty-json-formatter'
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
In the Bundle Install step, the xcpretty gem is being installed:
Fetching xcpretty 0.3.0
Installing xcpretty 0.3.0
The Install Cocoapods step also works fine (probably because Cocoapods is pre-installed). When it gets to the Test MyApp step, the invocation creates an error:
Run set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace MyApp.xcworkspace -scheme MyApp-Test -destination 'platform=iOS Simulator,name=iPhone 11' -enableCodeCoverage YES -derivedDataPath build/derived-data clean test | xcpretty -s
/Users/runner/work/_temp/9d3633bf-6dae-45d7-a303-1c68abb63d53.sh: line 1: xcpretty: command not found
And then the workflow hangs for a very long time, so I usually cancel it. Any idea why xcpretty is not being found? My thought is, the directory where the gem is installed isn't in the search path, but I'm not sure about how I would do that. I'm sure there's a reasonable solution to this, but I'm having trouble finding it and am tired of banging my head against a wall.
I was facing the same issue while setting up fastlane to run my Xcode tests.
Finally, solved the issue by adding PATH in Jenkinsfile as below.
Note that SampleProject-TestCase-Executions is Sample app on my Desktop.
Please find GitHub Demo App for more info.
node {
stage "Run Fast file"
sh '''
cd /Users/bhooshanpatil/Desktop/SampleProject-TestCase-Executions
export PATH="$PATH:/usr/local/bin:/usr/local/bin:/usr/local/sbin$:"
fastlane scan
'''
}
Unfortunately, my solution was not at all tidy. I had to path into the gem installation directory and directly reference the gem executable. Thankfully, the relative path doesn't change, so I could just hardcode it into the test script. Maybe there's a more elegant solution, but once I got it working, I just dropped it.
And sorry if you're trying to reproduce this, but it was over a year ago and I left the company, so I don't have access to what the path was.
Jenkins -> Manage Jenkins -> Configure System -> Global properties -> Environment variables -> Name: LC_ALL, Value: en_US.UTF-8
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:
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.
my shell code:
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
ls -al
cd NIMDemo/
ls -al
bundle install
bundle exec fastlane release
when i clicked Build Now button on jenkins, build failed with error:
bundle exec fastlane $'release\E'
[16:05:31]: [32m------------------------------[0m
[16:05:31]: [32m--- Step: default_platform ---[0m
[16:05:31]: [32m------------------------------[0m
+------------------+-----+
| [33mLane Context[0m |
+------------------+-----+
| DEFAULT_PLATFORM | ios |
+------------------+-----+
[16:05:31]: [31mCould not find lane 'ios release'. Available lanes: ios release, ios tests[0m
+------+------------------+-------------+
| [32mfastlane summary[0m |
+------+------------------+-------------+
| Step | Action | Time (in s) |
+------+------------------+-------------+
| 1 | default_platform | 0 |
+------+------------------+-------------+
[16:05:31]: [31mfastlane finished with errors[0m
[31m
[!] Could not find lane 'ios release'. Available lanes: ios release, ios tests[0m
Build step 'Execute shell' marked build as failure
Finished: FAILURE
my Fastfile code:
default_platform(:ios)
platform :ios do
desc "upload appstore lane"
lane :release do
end
lane :tests do
run_tests(scheme: "MyAppTests")
end
end
code bundle exec fastlane release ran ok when i typed it into the terminal on the mac jenkins deployed.
ran result
What can i do to work out it. Thanks for any help.