-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
182 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
name: Prepare device farm artifacts | ||
on: | ||
workflow_call: | ||
secrets: | ||
# 1. Open the keychain on your mac and export the signing certificate and private key in a Certificates.p12 file | ||
# 2. Convert your certificate to Base64 string: `base64 Certificates.p12 | pbcopy` | ||
# 3. Update the value of the CERTIFICATES_FILE_BASE64 action secret with the content of the clipboard | ||
# 4. Update the CERTIFICATES_PASSWORD action secret with the one used during the export of the certificate from the keychain | ||
CERTIFICATES_FILE_BASE64: | ||
description: 'Apple signing certificate' | ||
required: true | ||
|
||
# The password for your Apple signing certificate | ||
CERTIFICATES_PASSWORD: | ||
description: 'Apple signing certificate p12 password' | ||
required: true | ||
|
||
# A new keychain will be created during the run. The password could be any new random string. | ||
KEYCHAIN_PASSWORD: | ||
description: 'Keychain password' | ||
required: true | ||
|
||
# 1. Find the 'com.forgerock.FRTestHost' provisioning profile (~/Library/MobileDevice/Provisioning\ Profiles) | ||
# 2. Rename the file to `provisioning_profile.mobileprovision` | ||
# 3. Zip the file: `zip provisioning_profile.mobileprovision.zip provisioning_profile.mobileprovision` | ||
# 4. Convert the file to Base64 string: `base64 provisioning_profile.mobileprovision.zip | pbcopy` | ||
# 5. Update the value of the BUILD_PROVISION_PROFILE_ZIP_BASE64 action secret with the content of the clipboard | ||
BUILD_PROVISION_PROFILE: | ||
description: 'Apple build provisioning profile' | ||
required: true | ||
|
||
SLACK_WEBHOOK: | ||
description: 'Slack Notifier Incoming Webhook URL' | ||
required: true | ||
jobs: | ||
prepare-device-farm-artifacts: | ||
runs-on: macos-14 | ||
|
||
steps: | ||
# Clone the repo | ||
- name: Clone the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{github.event.pull_request.head.repo.full_name}} | ||
fetch-depth: 0 | ||
|
||
# Install the Apple certificate and provisioning profile | ||
- name: Install the Apple certificate and provisioning profile | ||
run: | | ||
# Create variables | ||
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | ||
PP_PATH_ZIP=$RUNNER_TEMP/build_pp.mobileprovision.zip | ||
PP_FILENAME=provisioning_profile.mobileprovision | ||
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | ||
# Import certificate and provisioning profile from secrets | ||
echo -n ${{ secrets.CERTIFICATES_FILE_BASE64 }} | base64 --decode -o $CERTIFICATE_PATH | ||
echo -n ${{ secrets.BUILD_PROVISION_PROFILE }} | base64 --decode -o $PP_PATH_ZIP | ||
unzip $PP_PATH_ZIP | ||
# Create temporary keychain | ||
security create-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" $KEYCHAIN_PATH | ||
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | ||
security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" $KEYCHAIN_PATH | ||
# Import certificate to keychain | ||
security import $CERTIFICATE_PATH -P "${{ secrets.CERTIFICATES_PASSWORD }}" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | ||
security list-keychain -d user -s $KEYCHAIN_PATH | ||
# Apply provisioning profile | ||
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | ||
cp $PP_FILENAME ~/Library/MobileDevice/Provisioning\ Profiles | ||
# Set target Xcode version. For more details and options see: | ||
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11-Readme.md | ||
- name: Select Xcode | ||
run: sudo xcode-select -switch /Applications/Xcode_15.4.app && /usr/bin/xcodebuild -version | ||
|
||
- name: build-for-testing and sign | ||
run: xcodebuild -scheme PingTestHost -sdk iphoneos17.5 -workspace SampleApps/Ping.xcworkspace -configuration Debug clean build BUILD_DIR=/tmp/build/ DEVELOPMENT_TEAM=9QSE66762D -allowProvisioningUpdates -destination generic/platform=iOS -derivedDataPath /tmp/build/derivedData/ build-for-testing | ||
|
||
# Prepare BitBar artifacts: | ||
- name: Prepare BitBar artifacts | ||
run: | | ||
pwd | ||
ls -la | ||
cd /tmp/build/Debug-iphoneos/ | ||
cp -r PingTestHost.app/PlugIns/DavinciTests.xctest . | ||
zip -r -X DavinciTests.xctest.zip DavinciTests.xctest | ||
mkdir Payload | ||
cp -r PingTestHost.app Payload/ | ||
zip --symlinks -qr PingTestHost.ipa Payload | ||
# Publish e2e tests and app build artifacts | ||
- name: Publish PingTestHost.ipa | ||
uses: actions/upload-artifact@v3 | ||
if: success() | ||
with: | ||
name: PingTestHost.ipa | ||
path: ~/build/Debug-iphoneos/PingTestHost.ipa | ||
|
||
- name: Publish DavinciTests.xctest.zip | ||
uses: actions/upload-artifact@v3 | ||
if: success() | ||
with: | ||
name: DavinciTests.xctest.zip | ||
path: ~/build/Debug-iphoneos/DavinciTests.xctest.zip | ||
|
||
# Send slack notification ONLY if any of the steps above fail | ||
- name: Send slack notification | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: custom | ||
fields: all | ||
custom_payload: | | ||
{ | ||
attachments: [{ | ||
title: ':no_entry: Failed to prepare BitBar test artifacts', | ||
color: 'danger', | ||
text: `\nWorkflow: ${process.env.AS_WORKFLOW} -> ${process.env.AS_JOB}\nPull request: ${process.env.AS_PULL_REQUEST}\nCommit: ${process.env.AS_COMMIT} by ${process.env.AS_AUTHOR}`, | ||
}] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | ||
if: failure() |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters