Skip to content

Commit

Permalink
Merge pull request #322 from ForgeRock/ci-fix
Browse files Browse the repository at this point in the history
SDKS-3735 Fix CI
  • Loading branch information
spetrov authored Jan 30, 2025
2 parents 683fd0f + b63839f commit 6f774c0
Show file tree
Hide file tree
Showing 19 changed files with 179 additions and 97 deletions.
46 changes: 34 additions & 12 deletions .github/workflows/bitbar-prepare-artifacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
required: true

# 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`
# 2. Convert your certificate to Base64 string: `base64 -i 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:
Expand All @@ -27,7 +27,7 @@ on:
# 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`
# 4. Convert the file to Base64 string: `base64 -i 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'
Expand All @@ -36,14 +36,24 @@ on:
SLACK_WEBHOOK_URL:
description: 'Slack Notifier Incoming Webhook URL'
required: true

env:
BUILD_DIR: /tmp/build
CONFIGURATION: Debug
SCHEME: FRTestHostBitBar
WORKSPACE: e2e/FRExample.xcworkspace
DEVELOPMENT_TEAM: 9QSE66762D
XCODE_VERSION: '15.4'
SDK: iphoneos17.5

jobs:
prepare-device-farm-artifacts:
runs-on: macos-14

steps:
# Clone the repo
- name: Clone the repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
Expand Down Expand Up @@ -83,19 +93,31 @@ jobs:
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
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md
- name: Select Xcode
run: sudo xcode-select -switch /Applications/Xcode_15.4.app && /usr/bin/xcodebuild -version
run: sudo xcode-select -switch /Applications/Xcode_${{ env.XCODE_VERSION }}.app && /usr/bin/xcodebuild -version

- name: build-for-testing and sign
run: xcodebuild -scheme FRTestHostBitBar -sdk iphoneos17.5 -workspace e2e/FRExample.xcworkspace -configuration Debug clean build BUILD_DIR=~/build/ DEVELOPMENT_TEAM=JV6EC9KSN3 -allowProvisioningUpdates -destination generic/platform=iOS -derivedDataPath ~/build/derivedData/ build-for-testing
run: |
xcodebuild \
-scheme ${{ env.SCHEME }} \
-sdk ${{ env.SDK}} \
-workspace ${{ env.WORKSPACE }} \
-configuration ${{ env.CONFIGURATION }} \
clean build \
BUILD_DIR=${{ env.BUILD_DIR }} \
DEVELOPMENT_TEAM=${{ env.DEVELOPMENT_TEAM }} \
-allowProvisioningUpdates \
-destination generic/platform=iOS \
-derivedDataPath ${{ env.BUILD_DIR }}/derivedData \
build-for-testing
# Prepare BitBar artifacts:
- name: Prepare BitBar artifacts
run: |
pwd
ls -la
cd ~/build/Debug-iphoneos/
cd ${{ env.BUILD_DIR }}/Debug-iphoneos/
cp -r FRTestHost.app/PlugIns/FRAuthTests.xctest .
zip -r -X FRAuthTests.xctest.zip FRAuthTests.xctest
mkdir Payload
Expand All @@ -104,21 +126,21 @@ jobs:
# Publish e2e tests and app build artifacts
- name: Publish FRTestHost.ipa
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: success()
with:
name: FRTestHost.ipa
path: ~/build/Debug-iphoneos/FRTestHost.ipa
path: ${{ env.BUILD_DIR }}/Debug-iphoneos/FRTestHost.ipa

- name: Publish FRAuthTests.xctest.zip
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: success()
with:
name: FRAuthTests.xctest.zip
path: ~/build/Debug-iphoneos/FRAuthTests.xctest.zip
path: ${{ env.BUILD_DIR }}/Debug-iphoneos/FRAuthTests.xctest.zip

# Send slack notification ONLY if any of the steps above fail
- name: Send slack notification
- name: Send slack notification if something goes wrong
uses: 8398a7/action-slack@v3
with:
status: custom
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bitbar-results.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
bitbar-project-id:
description: BitBar Project ID
type: string
default: 207050144
default: ${{ vars.BITBAR_PROJECT_ID }}

bitbar-run-id:
description: BitBar Run ID
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/bitbar-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ on:
bitbar-project-id:
description: BitBar project id
type: string
default: 207050144
default: ${{ vars.BITBAR_PROJECT_ID }}

bitbar-device-group-id:
description: The device group id to run tests against
type: string
default: 45011
default: ${{ vars.BITBAR_DEVICE_GROUP_ID }}

bitbar-os-type:
description: OS Type
Expand All @@ -20,7 +20,7 @@ on:
bitbar-framework-id:
description: The framework id
type: string
default: 590
default: ${{ vars.BITBAR_FRAMEWORK_ID }}

outputs:
bitbar-run-id:
Expand All @@ -45,12 +45,12 @@ jobs:
steps:
# Get the test artifacts prepared in previous step
- name: Get FRTestHost.ipa BitBar artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: FRTestHost.ipa

- name: Get the FRAuthTests.xctest.zip BitBar artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: FRAuthTests.xctest.zip

Expand Down
64 changes: 54 additions & 10 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,23 @@ on:
SLACK_WEBHOOK_URL:
description: 'Slack Notifier Webhook'
required: true

env:
WORKSPACE: e2e/FRExample.xcworkspace
SCHEME: FRTestHost
CONFIGURATION: Debug
DESTINATION: platform=iOS Simulator,name=iPhone 16,OS=18.2
XCODE_VERSION: '16.2'

jobs:
build-and-test:
runs-on: macos-14
runs-on: macos-15
timeout-minutes: 20

steps:
# Clone the repo
- name: Clone the repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
Expand All @@ -30,21 +38,57 @@ jobs:
run: echo $CONFIG_E2E_CLOUD > FRTestHost/FRTestHost/SharedTestFiles/TestConfig/Config-live-01.json

# Set target Xcode version. For more details and options see:
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-12-Readme.md
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md
- name: Select Xcode
run: sudo xcode-select -switch /Applications/Xcode_15.4.app && /usr/bin/xcodebuild -version
run: sudo xcode-select -switch /Applications/Xcode_${{ env.XCODE_VERSION }}.app && /usr/bin/xcodebuild -version


# # Restore `xcresultparser` from cache
# # TBD: Fix the restore of the xcresultparser tool. It is not working as expected at the moment, causing the build to fail...
# - name: Restore xcresultparser from cache
# id: cache-xcresultparser
# uses: actions/cache@v3
# with:
# path: /opt/homebrew/bin/xcresultparser
# key: ${{ runner.os }}-xcresultparser
# restore-keys: |
# ${{ runner.os }}-xcresultparser

# Install xcresultparser
- name: Install xcresultparser
run: |
brew tap a7ex/homebrew-formulae
brew install xcresultparser
echo "Installed xcresultparser..."
# Run all tests
- name: Run tests
run: xcodebuild test -scheme FRTestHost -workspace e2e/FRExample.xcworkspace -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 14,OS=17.5' -derivedDataPath DerivedData -enableCodeCoverage YES -resultBundlePath TestResults | xcpretty && exit ${PIPESTATUS[0]}
run: |
xcodebuild test \
-scheme FRTestHost \
-workspace ${{ env.WORKSPACE }} \
-configuration ${{ env.CONFIGURATION}} \
-destination '${{ env.DESTINATION }}' \
-derivedDataPath DerivedData \
TEST_TARGET_SIGNING=YES \
-enableCodeCoverage YES \
-resultBundlePath TestResults | grep -E 'Test Case|^Executed|error:'
# Publish test results
# Convert test results to JUnit format
- name: Convert Test Results to JUnit
run: xcresultparser -o junit TestResults.xcresult > test-report.xml

# Publish the test results
- name: Publish test results
uses: kishikawakatsumi/xcresulttool@v1
with:
path: TestResults.xcresult
show-passed-tests: false
if: success() || failure()
uses: dorny/test-reporter@v1
with:
name: Unit tests results
path: './test*.xml'
list-suites: 'all'
list-tests: 'all'
fail-on-error: 'true'
reporter: java-junit

# Send slack notification with result status
- uses: 8398a7/action-slack@v3
Expand Down
34 changes: 22 additions & 12 deletions FRAuth/FRAuth.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
9527F63F2CA32942008475B7 /* AA_12_ReCaptchaEnterpriseCallbackTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9527F63E2CA32942008475B7 /* AA_12_ReCaptchaEnterpriseCallbackTest.swift */; };
9536C56C2B865DD600B2DFDD /* AA_08_TextInputCallbackTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9536C56B2B865DD600B2DFDD /* AA_08_TextInputCallbackTest.swift */; };
959D7D98290B4B9200A1F22F /* AA-05-DeviceBindingCallbackTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 959D7D97290B4B9200A1F22F /* AA-05-DeviceBindingCallbackTest.swift */; };
95A391252D47F91B00079F4C /* discoveryWithPingEndIdp.json in Resources */ = {isa = PBXBuildFile; fileRef = 95A391232D47F91B00079F4C /* discoveryWithPingEndIdp.json */; };
95A812F02C516FC4001CDFCB /* AA_11_TextOutputCallbackTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95A812EF2C516FC4001CDFCB /* AA_11_TextOutputCallbackTest.swift */; };
95E180B42992A6F20087457D /* AA-06-DeviceSigningVerifierCallbackTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95E180B32992A6F20087457D /* AA-06-DeviceSigningVerifierCallbackTest.swift */; };
95EB7E4D2B8D010B00B59CD6 /* AA_09_PingOneProtectInitializeCallbackTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95EB7E4C2B8D010B00B59CD6 /* AA_09_PingOneProtectInitializeCallbackTest.swift */; };
Expand Down Expand Up @@ -383,6 +384,7 @@
9527F63E2CA32942008475B7 /* AA_12_ReCaptchaEnterpriseCallbackTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AA_12_ReCaptchaEnterpriseCallbackTest.swift; sourceTree = "<group>"; };
9536C56B2B865DD600B2DFDD /* AA_08_TextInputCallbackTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AA_08_TextInputCallbackTest.swift; sourceTree = "<group>"; };
959D7D97290B4B9200A1F22F /* AA-05-DeviceBindingCallbackTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AA-05-DeviceBindingCallbackTest.swift"; sourceTree = "<group>"; };
95A391232D47F91B00079F4C /* discoveryWithPingEndIdp.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = discoveryWithPingEndIdp.json; sourceTree = "<group>"; };
95A812EF2C516FC4001CDFCB /* AA_11_TextOutputCallbackTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AA_11_TextOutputCallbackTest.swift; sourceTree = "<group>"; };
95E180B32992A6F20087457D /* AA-06-DeviceSigningVerifierCallbackTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AA-06-DeviceSigningVerifierCallbackTest.swift"; sourceTree = "<group>"; };
95EB7E4C2B8D010B00B59CD6 /* AA_09_PingOneProtectInitializeCallbackTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AA_09_PingOneProtectInitializeCallbackTest.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -715,6 +717,14 @@
path = AppIntegrity;
sourceTree = "<group>";
};
95A391242D47F91B00079F4C /* Discovery */ = {
isa = PBXGroup;
children = (
95A391232D47F91B00079F4C /* discoveryWithPingEndIdp.json */,
);
path = Discovery;
sourceTree = "<group>";
};
A529AFD82CD010CB00F60F68 /* SelfService */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1388,6 +1398,7 @@
D5888C4C25664EDF0041FD94 /* MockResponseData */ = {
isa = PBXGroup;
children = (
95A391242D47F91B00079F4C /* Discovery */,
A529AFD82CD010CB00F60F68 /* SelfService */,
D5888C4D25664EDF0041FD94 /* AM */,
D5888C5025664EDF0041FD94 /* OAuth2 */,
Expand Down Expand Up @@ -1795,6 +1806,7 @@
D5888C2B25664E920041FD94 /* SecondFactorFlow.png in Resources */,
D5888C9F25664EDF0041FD94 /* AuthTree_TermsAndConditionsNode.json in Resources */,
D5888CA825664EDF0041FD94 /* AuthTree_SecondFactorChoiceNode.json in Resources */,
95A391252D47F91B00079F4C /* discoveryWithPingEndIdp.json in Resources */,
D5888CB225664EDF0041FD94 /* AuthTree_AttributeCollectorsNode.json in Resources */,
D5888CAE25664EDF0041FD94 /* AuthTree_DeviceCollectorNodeWithMessage.json in Resources */,
D5888C9125664EDF0041FD94 /* OAuth2_AuthorizeRedirect_Failure.json in Resources */,
Expand Down Expand Up @@ -2251,10 +2263,10 @@
buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 9QSE66762D;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down Expand Up @@ -2288,10 +2300,10 @@
buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 9QSE66762D;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down Expand Up @@ -2324,10 +2336,9 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 9QSE66762D;
INFOPLIST_FILE = FRAuthTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -2355,10 +2366,9 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 9QSE66762D;
INFOPLIST_FILE = FRAuthTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import XCTest
class AA_09_PingOneProtectInitializeCallbackTest: CallbackBaseTest {

static var USERNAME: String = "sdkuser"
let options = FROptions(url: "https://openam-protect2.forgeblocks.com/am",
let options = FROptions(url: "https://openam-sdks2.forgeblocks.com/am",
realm: "alpha",
enableCookie: true,
cookieName: "c1c805de4c9b333",
cookieName: "9dfa82bc124226d",
timeout: "180",
authServiceName: "TEST_PING_ONE_PROTECT_INITIALIZE",
oauthThreshold: "60",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import XCTest
class AA_10_PingOneProtectEvaluateCallbackTest: CallbackBaseTest {

static var USERNAME: String = "sdkuser"
let options = FROptions(url: "https://openam-protect2.forgeblocks.com/am",
let options = FROptions(url: "https://openam-sdks2.forgeblocks.com/am",
realm: "alpha",
enableCookie: true,
cookieName: "c1c805de4c9b333",
cookieName: "9dfa82bc124226d",
timeout: "180",
authServiceName: "TEST_PING_ONE_PROTECT_EVALUATE",
oauthThreshold: "60",
Expand Down
Loading

0 comments on commit 6f774c0

Please sign in to comment.