Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build iOS artifact for real iPhones #488

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/patrol_cli-prepare-ios.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: patrol_cli prepare ios

on:
push:

jobs:
main:
name: Build iphoneos artifact
runs-on: macos-12

defaults:
run:
working-directory: AutomatorServer/ios

steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.2
bundler-cache: true

- name: Install fastlane
run: |
gem install bundler
cd android && bundle install
cd ..
cd ios && bundle install

- name: Download mobile-tools
uses: actions/checkout@v3
with:
repository: leancodepl/mobile-tools
path: mobile-tools

- name: Add mobile-tools to PATH
run: |
echo $GITHUB_WORKSPACE/mobile-tools/bin >> $GITHUB_PATH

- name: Set version data
run: |
tag=${{ github.ref_name }}
echo "RELEASE_NOTES=$(link_changelog $tag)" >> $GITHUB_ENV
echo "IS_PRERELEASE=$(is_prerelease $tag)" >> $GITHUB_ENV

- name: Set artifact names
run: |
tag=${{ github.ref_name }}
prefix=patrol_cli-v
version=${tag#"$prefix"} # version without the prefix
echo "version: $version"
server_file="server-$version.apk"
instrumentation_file="instrumentation-$version.apk"
ios_zip_directory="ios-$version.zip"
ios_server_file="AutomatorServerUITests-Runner-$version.app"
echo "server file: $server_file"
echo "instrumentation file: $instrumentation_file"
echo "ios zip directory: $ios_zip_directory"
echo "ios server file: $ios_server_file"
# exporting
echo "VERSION=$version" >> $GITHUB_ENV
echo "SERVER_FILE=$server_file" >> $GITHUB_ENV
echo "INSTRUMENTATION_FILE=$instrumentation_file" >> $GITHUB_ENV
echo "IOS_ZIP_DIRECTORY=$ios_zip_directory" >> $GITHUB_ENV
echo "IOS_SERVER_FILE=$ios_server_file" >> $GITHUB_ENV

- name: Set up secrets
run: echo "APPLE_DEVELOPER_TEAM_ID=${{ secrets.APPLE_DEVELOPER_TEAM_ID }}" >> $GITHUB_ENV

- uses: webfactory/ssh-agent@v0.6.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

# - name: Create Personal Access Token used to access leancodepl/certificates
# run: echo "MATCH_GIT_BASIC_AUTHORIZATION=${{ secrets.PERSONAL_ACCESS_TOKEN_BASE64 }}" >> $GITHUB_ENV

# - name: Create MATCH_GIT_PRIVATE_KEY
# run: echo "MATCH_GIT_PRIVATE_KEY=${{ secrets.MATCH_GIT_PRIVATE_KEY }} >> $GITHUB_ENV"

- name: Create MATCH_PASSWORD
run: echo "MATCH_PASSWORD=${{ secrets.MATCH_PASSWORD }}" >> $GITHUB_ENV

- name: fastlane match
run: bundle exec fastlane match --skip_certificate_matching true

- name: make_artifacts
run: ./make_artifacts iphoneos arm64 "$VERSION"
18 changes: 14 additions & 4 deletions AutomatorServer/ios/AutomatorServer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,11 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = U3EG6EALX7;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = U3EG6EALX7;
GENERATE_INFOPLIST_FILE = YES;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -303,6 +305,7 @@
PRODUCT_BUNDLE_IDENTIFIER = pl.leancode.AutomatorServerUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match Development pl.leancode.AutomatorServerUITests.xctrunner";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
Expand All @@ -319,9 +322,11 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = U3EG6EALX7;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = U3EG6EALX7;
GENERATE_INFOPLIST_FILE = YES;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -332,6 +337,7 @@
PRODUCT_BUNDLE_IDENTIFIER = pl.leancode.AutomatorServerUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "match Development pl.leancode.AutomatorServerUITests.xctrunner";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
Expand Down Expand Up @@ -461,6 +467,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = U3EG6EALX7;
Expand All @@ -479,6 +486,7 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = pl.leancode.AutomatorServer;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -490,6 +498,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = U3EG6EALX7;
Expand All @@ -508,6 +517,7 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = pl.leancode.AutomatorServer;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "98B3653828903325008B5B8B"
BuildableName = "AutomatorServerUITests.xctest"
BlueprintName = "AutomatorServerUITests"
ReferencedContainer = "container:AutomatorServer.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
36 changes: 25 additions & 11 deletions AutomatorServer/ios/make_artifacts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'

cd "$(dirname "$0")"

Expand All @@ -13,19 +14,32 @@ if [ -z "$sdk" ] || [ -z "$arch" ] || [ -z "$version" ]; then
fi


args=(
-project AutomatorServer.xcodeproj
-scheme AutomatorServerUITests
-derivedDataPath ./DerivedData
-sdk "$sdk"
-arch "$arch"
)

if [ "$sdk" == "iphonesimulator" ]; then
args+=(CODE_SIGN_IDENTITY="")
args+=(CODE_SIGNING_REQUIRED="NO")
args+=(CODE_SIGN_ENTITLEMENTS="")
args+=(CODE_SIGNING_ALLOWED="NO")
fi
# else
# args+=(PROVISIONING_PROFILE="a3fa47d1-b647-4a95-b66d-7f54d0bcb975")
# fi

echo "arguments to xcodebuild build-for-testing:"
for arg in "${args[@]}"; do
echo "arg: $arg"
done

mkdir -p ./artifacts

xcodebuild \
build-for-testing \
-project AutomatorServer.xcodeproj \
-scheme AutomatorServer \
-derivedDataPath ./DerivedData \
-sdk "$sdk" \
-arch "$arch" \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED="NO" \
CODE_SIGN_ENTITLEMENTS="" \
CODE_SIGNING_ALLOWED="NO"
xcodebuild build-for-testing "${args[@]}"

cp -r \
"./DerivedData/Build/Products/Debug-$sdk/AutomatorServerUITests-Runner.app" \
Expand Down