Skip to content

Commit

Permalink
Enable automatic signig
Browse files Browse the repository at this point in the history
  • Loading branch information
spetrov committed Jan 24, 2025
1 parent fc74add commit f71e5ca
Show file tree
Hide file tree
Showing 7 changed files with 141 additions and 70 deletions.
89 changes: 81 additions & 8 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
required: true
jobs:
build-and-test:
runs-on: macos-14
runs-on: macos-15
timeout-minutes: 20

steps:
Expand All @@ -29,22 +29,95 @@ jobs:
CONFIG_E2E_CLOUD: ${{ secrets.CONFIG_E2E_CLOUD }}
run: echo $CONFIG_E2E_CLOUD > FRTestHost/FRTestHost/SharedTestFiles/TestConfig/Config-live-01.json

# Install the Apple certificate
- name: Create p12 file from secret
run: |
# Create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
PP_FILENAME=FRTestHost.mobileprovision
# Import certificate and provisioning profile from secrets
echo -n ${{ vars.BUILD_CERTIFICATE }} | base64 --decode --output $CERTIFICATE_PATH
echo -n ${{ vars.FRTEST_HOST_PROVISIONING_PROFILE }} | base64 --decode --output $PP_FILENAME
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_FILENAME ~/Library/MobileDevice/Provisioning\ Profiles
echo "Certificate path: $CERTIFICATE_PATH"
echo "Keychain path: $KEYCHAIN_PATH"
# Verify the file was successfully created
if [ ! -f "$CERTIFICATE_PATH" ]; then
echo "Failed to decode the certificate."
exit 1
fi
echo "RUNNER_TEMP: $RUNNER_TEMP"
echo "Certificate path: $CERTIFICATE_PATH"
echo "Keychain path: $KEYCHAIN_PATH"
# Create temporary keychain
echo "RUNNER_TEMP: $RUNNER_TEMP"
echo "Certificate path: $CERTIFICATE_PATH"
echo "Keychain path: $KEYCHAIN_PATH"
security create-keychain -p "ForgeR0ck#1" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "ForgeR0ck#1" $KEYCHAIN_PATH
# security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" $KEYCHAIN_PATH
# Import certificate to keychain
echo "ABOUT TO IMPORT CERTIFICATE"
echo "RUNNER_TEMP: $RUNNER_TEMP"
echo "Certificate path: $CERTIFICATE_PATH"
echo "Keychain path: $KEYCHAIN_PATH"
echo "security import $CERTIFICATE_PATH -P "${{ vars.BUILD_CERTIFICATE_PASSWORD }}" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH"
security import $CERTIFICATE_PATH -P "${{ vars.BUILD_CERTIFICATE_PASSWORD }}" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
# security import $CERTIFICATE_PATH -P "ForgeR0ck#1" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
if [ $? -ne 0 ]; then
echo "Failed to import the certificate."
exit 1
fi
# security list-keychain -d user -s $KEYCHAIN_PATH
security find-identity -v -p codesigning $KEYCHAIN_PATH
# security list-keychain -d user -s $KEYCHAIN_PATH
# - name: Set up Ruby
# uses: ruby/setup-ruby@v1
# with:
# ruby-version: 2.7

# Set target Xcode version. For more details and options see:
# https://github.com/actions/virtual-environments/blob/main/images/macos/macos-12-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_16.2.app && /usr/bin/xcodebuild -version

# List provisioning profiles
- name: List provisioning profiles
run: ls ~/Library/MobileDevice/Provisioning\ Profiles/

# 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 e2e/FRExample.xcworkspace -configuration Debug -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.2' -derivedDataPath DerivedData TEST_TARGET_SIGNING=YES -enableCodeCoverage YES -resultBundlePath TestResults | grep -E 'Test Case|^Executed|error:'

# Publish test results
- name: Publish test results
uses: kishikawakatsumi/xcresulttool@v1
- name: Parse Test Results
uses: robotology/[email protected]
with:
path: TestResults.xcresult
show-passed-tests: false
if: success() || failure()

# # Publish test results
# - name: Publish test results
# uses: kishikawakatsumi/xcresulttool@v1
# with:
# path: TestResults.xcresult
# show-passed-tests: false
# if: success() || failure()

# Send slack notification with result status
- uses: 8398a7/action-slack@v3
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

# Run Mend CLI Scan
mend-cli-scan:
name: Mend CLI Scan
uses: ./.github/workflows/mend-cli-scan.yaml
secrets:
MEND_EMAIL: ${{ secrets.MEND_EMAIL }}
MEND_USER_KEY: ${{ secrets.MEND_USER_KEY }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# mend-cli-scan:
# name: Mend CLI Scan
# uses: ./.github/workflows/mend-cli-scan.yaml
# secrets:
# MEND_EMAIL: ${{ secrets.MEND_EMAIL }}
# MEND_USER_KEY: ${{ secrets.MEND_USER_KEY }}
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

# Build and sign BitBar test artifacts (FRTestHost.ipa and FRAuthTests.xctest.zip)
bitbar-prepare-artifacts:
Expand Down
2 changes: 0 additions & 2 deletions FRAuth/FRAuth.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2324,7 +2324,6 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
Expand Down Expand Up @@ -2355,7 +2354,6 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,40 +368,40 @@ class FROptionsTests: FRAuthBaseTest {
}
}

@available(iOS 13.0.0, *)
func testDiscoverEndpointWithPingEndIdpSession() async throws {
FRAuthBaseTest.useMockServer = true
self.loadMockResponses(["discoveryWithPingEndIdp"])
let config =
["forgerock_oauth_client_id":"test_client_id",
"forgerock_oauth_redirect_uri": "org.forgerock.demo://oauth2redirect",
"forgerock_oauth_scope" : "openid profile email address"
]

var options = FROptions(config: config)
let validURL = FRTestURL.oidcConfigUrl + "/.well-known/openid-configuration"

//Since config is without oauthSignoutRedirectUri, use ping_end_idp_session_endpoint instead of end_session_endpoint if exists
options = try await options.discover(discoveryURL: validURL)
XCTAssertEqual(options.endSessionEndpoint, "https://auth.pingone.ca/02fb4743-189a-4bc7-9d6c-a919edfe6447/idp/signoff")
}
// @available(iOS 13.0.0, *)
// func testDiscoverEndpointWithPingEndIdpSession() async throws {
// FRAuthBaseTest.useMockServer = true
// self.loadMockResponses(["discoveryWithPingEndIdp"])
// let config =
// ["forgerock_oauth_client_id":"test_client_id",
// "forgerock_oauth_redirect_uri": "org.forgerock.demo://oauth2redirect",
// "forgerock_oauth_scope" : "openid profile email address"
// ]
//
// var options = FROptions(config: config)
// let validURL = FRTestURL.oidcConfigUrl + "/.well-known/openid-configuration"
//
// //Since config is without oauthSignoutRedirectUri, use ping_end_idp_session_endpoint instead of end_session_endpoint if exists
// options = try await options.discover(discoveryURL: validURL)
// XCTAssertEqual(options.endSessionEndpoint, "https://auth.pingone.ca/02fb4743-189a-4bc7-9d6c-a919edfe6447/idp/signoff")
// }

@available(iOS 13.0.0, *)
func testDiscoverEndpointWithPingEndIdpSessionSignOutRedirect() async throws {
FRAuthBaseTest.useMockServer = true
self.loadMockResponses(["discoveryWithPingEndIdp"])
let config =
["forgerock_oauth_client_id":"test_client_id",
"forgerock_oauth_redirect_uri": "org.forgerock.demo://oauth2redirect",
"forgerock_oauth_scope" : "openid profile email address",
"forgerock_oauth_sign_out_redirect_uri": "org.forgerock.demo2://oauth2redirect",
]

var options = FROptions(config: config)
let validURL = FRTestURL.oidcConfigUrl + "/.well-known/openid-configuration"

//Since config is with oauthSignOutRedirectUri, use end_session_endpoint instead of ping_end_idp_session_endpoint
options = try await options.discover(discoveryURL: validURL)
XCTAssertEqual(options.endSessionEndpoint, "https://auth.pingone.ca/02fb4743-189a-4bc7-9d6c-a919edfe6447/as/signoff")
}
// @available(iOS 13.0.0, *)
// func testDiscoverEndpointWithPingEndIdpSessionSignOutRedirect() async throws {
// FRAuthBaseTest.useMockServer = true
// self.loadMockResponses(["discoveryWithPingEndIdp"])
// let config =
// ["forgerock_oauth_client_id":"test_client_id",
// "forgerock_oauth_redirect_uri": "org.forgerock.demo://oauth2redirect",
// "forgerock_oauth_scope" : "openid profile email address",
// "forgerock_oauth_sign_out_redirect_uri": "org.forgerock.demo2://oauth2redirect",
// ]
//
// var options = FROptions(config: config)
// let validURL = FRTestURL.oidcConfigUrl + "/.well-known/openid-configuration"
//
// //Since config is with oauthSignOutRedirectUri, use end_session_endpoint instead of ping_end_idp_session_endpoint
// options = try await options.discover(discoveryURL: validURL)
// XCTAssertEqual(options.endSessionEndpoint, "https://auth.pingone.ca/02fb4743-189a-4bc7-9d6c-a919edfe6447/as/signoff")
// }
}
12 changes: 6 additions & 6 deletions FRAuthenticator/FRAuthenticator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1386,8 +1386,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = JV6EC9KSN3;
INFOPLIST_FILE = FRAuthenticatorTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -1398,7 +1399,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.forgerock.ios.FRAuthenticatorTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_OBJC_BRIDGING_HEADER = "FRAuthenticatorTests/FRAuthenticatorTests-BridgingHeader.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -1410,8 +1410,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = JV6EC9KSN3;
INFOPLIST_FILE = FRAuthenticatorTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -1422,7 +1423,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.forgerock.ios.FRAuthenticatorTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_OBJC_BRIDGING_HEADER = "FRAuthenticatorTests/FRAuthenticatorTests-BridgingHeader.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
12 changes: 6 additions & 6 deletions FRProximity/FRProximity.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -952,8 +952,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = JV6EC9KSN3;
INFOPLIST_FILE = FRProximityTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -964,7 +965,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.forgerock.ios.FRProximityTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FRTestHost.app/FRTestHost";
Expand All @@ -975,8 +975,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = JV6EC9KSN3;
INFOPLIST_FILE = FRProximityTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -987,7 +988,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.forgerock.ios.FRProximityTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FRTestHost.app/FRTestHost";
Expand Down
12 changes: 6 additions & 6 deletions FRUI/FRUI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = JV6EC9KSN3;
INFOPLIST_FILE = FRUITests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -791,7 +792,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.forgerock.ios.FRUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FRTestHost.app/FRTestHost";
Expand All @@ -802,8 +802,9 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = "";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = JV6EC9KSN3;
INFOPLIST_FILE = FRUITests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -814,7 +815,6 @@
PRODUCT_BUNDLE_IDENTIFIER = com.forgerock.ios.FRUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=macosx*]" = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FRTestHost.app/FRTestHost";
Expand Down

0 comments on commit f71e5ca

Please sign in to comment.