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

Massive project reorganization and thread-safety updates for Swift 6. #211

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ec930e2
Massive project reorganization and thread-safety updates for Swift 6.
mikenachbaur-okta Oct 26, 2024
6c95329
Uncomment products
mikenachbaur-okta Oct 26, 2024
e2eb963
Update Swift to 5.10
mikenachbaur-okta Oct 27, 2024
1198a63
Update swift lint warnings
mikenachbaur-okta Oct 28, 2024
6a1a81b
Update swift versions to test
mikenachbaur-okta Oct 28, 2024
d718677
Update action to use the proper xcode version
mikenachbaur-okta Oct 28, 2024
89f08d5
Update variable used for the matrix destination
mikenachbaur-okta Oct 28, 2024
84e68cb
Update CI tests to run VisionOS tests on the appropriate platform
mikenachbaur-okta Oct 28, 2024
26ed076
Update github runners to use
mikenachbaur-okta Oct 28, 2024
6d8542b
Updates to get tests building on Linux
mikenachbaur-okta Oct 29, 2024
58c314f
Minor updates
mikenachbaur-okta Oct 29, 2024
d37de8f
Rearrange package to include macros within OktaConcurrency
mikenachbaur-okta Oct 30, 2024
d09f527
Fix how test mock resource bundles are found to work across platforms
mikenachbaur-okta Oct 30, 2024
24d6c22
Fix compile problem in a test function
mikenachbaur-okta Oct 30, 2024
2f7b2cb
Enable more tests
mikenachbaur-okta Oct 30, 2024
16b6a8b
Fix issues with mock function
mikenachbaur-okta Oct 30, 2024
7b6bafb
Fix mock function usage in some tests
mikenachbaur-okta Oct 30, 2024
d40817e
Fix problem with dependency chain for APIClientTestCommon
mikenachbaur-okta Oct 30, 2024
9f07a6a
Streamline some tests for reliability
mikenachbaur-okta Oct 30, 2024
3de733f
Tweak web auth provider test timing
mikenachbaur-okta Oct 30, 2024
7f6e664
Enable more tests, work around CI timing problems
mikenachbaur-okta Oct 30, 2024
a2c9700
Rename duplicate filenames
mikenachbaur-okta Oct 31, 2024
727d168
Improve versioning and useragent string generation
mikenachbaur-okta Nov 8, 2024
8b449b4
Update useragent versioning and migration locking
mikenachbaur-okta Nov 11, 2024
e917747
Github made breaking changes to the runner images
mikenachbaur-okta Nov 11, 2024
3c76f04
Updated simulator names to match the Xcode versions
mikenachbaur-okta Nov 11, 2024
1f35cb4
Fix cocoapods error
mikenachbaur-okta Nov 12, 2024
b4895fb
The previous update didn't work
mikenachbaur-okta Nov 12, 2024
f4ce8c5
Update test timing for slower test runners
mikenachbaur-okta Nov 12, 2024
a52323f
Resolve Swift 6 vs 5.10 issues
mikenachbaur-okta Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
80 changes: 46 additions & 34 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,24 @@ on:
- 'Tests/**/*.swift'

env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
NSUnbufferedIO: YES

jobs:
SwiftBuild:
name: Swift Unit Tests
strategy:
matrix:
os: [macos-latest-large, ubuntu-latest]
swift_version: ["5.9", "5.10"]
os: [macos-15-large, ubuntu-latest]
swift_version: ["5.10", "6.0"]
exclude:
- os: ubuntu-latest
swift_version: "6.0"
env:
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- uses: swift-actions/setup-swift@v2
- uses: SwiftyLab/setup-swift@v1
with:
swift-version: ${{ matrix.swift_version }}
- name: Get swift version
Expand All @@ -47,7 +51,9 @@ jobs:

Cocoapods:
name: CocoaPods Build
runs-on: macos-latest-xlarge # Running on xlarge to use arm64 chipset
env:
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
runs-on: macos-15-xlarge # Running on xlarge to use arm64 chipset
timeout-minutes: 10
needs:
- SwiftBuild
Expand All @@ -65,29 +71,35 @@ jobs:

XcodeBuild:
name: Xcode Unit Tests
runs-on: macos-latest-xlarge
strategy:
matrix:
destination:
- "platform=iOS Simulator,OS=16.4,name=iPhone 14 Pro Max"
- "platform=iOS Simulator,OS=17.5,name=iPhone 15 Pro Max"
- "platform=tvOS Simulator,OS=17.5,name=Apple TV"
- "platform=visionOS Simulator,OS=1.2,name=Apple Vision Pro"
- "platform=watchOS Simulator,OS=10.5,name=Apple Watch Series 7 (45mm)"
- "platform=macOS,name=My Mac"
include:
- destination: "platform=iOS Simulator,OS=16.4,name=iPhone 14 Pro Max"
xcode_version: "15.4"
os: macos-14-large
- destination: "platform=iOS Simulator,OS=18.1,name=iPhone 16 Pro Max"
xcode_version: "16.0"
os: macos-15-large
- destination: "platform=tvOS Simulator,OS=18.1,name=Apple TV"
xcode_version: "16.0"
os: macos-15-large
- destination: "platform=visionOS Simulator,OS=1.2,name=Apple Vision Pro"
xcode_version: "15.4"
os: macos-14-xlarge
- destination: "platform=visionOS Simulator,OS=2.0,name=Apple Vision Pro"
xcode_version: "16.0"
os: macos-15-xlarge
- destination: "platform=watchOS Simulator,OS=11.1,name=Apple Watch Series 10 (46mm)"
xcode_version: "16.0"
os: macos-15-large
- destination: "platform=macOS,name=My Mac"
xcode_version: "16.0"
os: macos-15-large
runs-on: ${{ matrix.os }}
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer
timeout-minutes: 25
steps:
- name: Set test variables
run: |
echo "DESTINATION=${{matrix.destination}}" >> "$GITHUB_ENV"

destination="${{matrix.destination}}"
if [[ $destination =~ "tvOS" ]] || [[ $destination =~ "watchOS" ]]; then
echo "SKIP_WEBAUTHENTICATIONUI=true" >> "$GITHUB_ENV"
echo "WebAuthenticationUI is unsupported on this platform"
else
echo "SKIP_WEBAUTHENTICATIONUI=false" >> "$GITHUB_ENV"
fi
- uses: actions/checkout@master
- name: Build AuthFoundation
run: |
Expand All @@ -96,55 +108,55 @@ jobs:
-derivedDataPath ../Build/DerivedData \
-clonedSourcePackagesDirPath ../Build/ClonedSources \
-scheme AuthFoundation \
-destination "$DESTINATION" 2>&1
-destination "${{ matrix.destination }}" 2>&1
- name: Test AuthFoundation
run: |
set -o pipefail && xcodebuild test \
-derivedDataPath ../Build/DerivedData \
-clonedSourcePackagesDirPath ../Build/ClonedSources \
-scheme AuthFoundation \
-destination "$DESTINATION" 2>&1
-destination "${{ matrix.destination }}" 2>&1
- name: Build OktaDirectAuth
run: |
set -o pipefail && xcodebuild build \
-derivedDataPath ../Build/DerivedData \
-clonedSourcePackagesDirPath ../Build/ClonedSources \
-scheme OktaDirectAuth \
-destination "$DESTINATION" 2>&1
-destination "${{ matrix.destination }}" 2>&1
- name: Test OktaDirectAuth
run: |
set -o pipefail && xcodebuild test \
-derivedDataPath ../Build/DerivedData \
-clonedSourcePackagesDirPath ../Build/ClonedSources \
-scheme OktaDirectAuth \
-destination "$DESTINATION" 2>&1
-destination "${{ matrix.destination }}" 2>&1
- name: Build OktaOAuth2
run: |
set -o pipefail && xcodebuild build \
-derivedDataPath ../Build/DerivedData \
-clonedSourcePackagesDirPath ../Build/ClonedSources \
-scheme OktaOAuth2 \
-destination "$DESTINATION" 2>&1
-destination "${{ matrix.destination }}" 2>&1
- name: Test OktaOAuth2
run: |
set -o pipefail && xcodebuild test \
-derivedDataPath ../Build/DerivedData \
-clonedSourcePackagesDirPath ../Build/ClonedSources \
-scheme OktaOAuth2 \
-destination "$DESTINATION" 2>&1
-destination "${{ matrix.destination }}" 2>&1
- name: Build WebAuthenticationUI
if: env.SKIP_WEBAUTHENTICATIONUI != 'true'
if: "!contains(matrix.destination, 'tvOS') && !contains(matrix.destination, 'watchOS')"
run: |
set -o pipefail && xcodebuild build \
-derivedDataPath ../Build/DerivedData \
-clonedSourcePackagesDirPath ../Build/ClonedSources \
-scheme WebAuthenticationUI \
-destination "$DESTINATION" 2>&1
-destination "${{ matrix.destination }}" 2>&1
- name: Test WebAuthenticationUI
if: env.SKIP_WEBAUTHENTICATIONUI != 'true'
if: "!contains(matrix.destination, 'tvOS') && !contains(matrix.destination, 'watchOS')"
run: |
set -o pipefail && xcodebuild test \
-derivedDataPath ../Build/DerivedData \
-clonedSourcePackagesDirPath ../Build/ClonedSources \
-scheme WebAuthenticationUI \
-destination "$DESTINATION" 2>&1
-destination "${{ matrix.destination }}" 2>&1
3 changes: 3 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ closure_parameter_position:

attributes:
severity: error
always_on_line_above:
- "@Synchronized"
- "@HasLock"
collection_alignment:
severity: error
control_statement:
Expand Down
89 changes: 79 additions & 10 deletions OktaAuthFoundation.podspec
Original file line number Diff line number Diff line change
@@ -1,29 +1,98 @@
Pod::Spec.new do |s|
s.name = "OktaAuthFoundation"
s.module_name = "AuthFoundation"
s.version = "1.8.2"
s.version = "2.0.0"
s.summary = "Okta Authentication Foundation"
s.description = <<-DESC
Provides the foundation and common features used to authenticate users, managing the lifecycle and storage of tokens and credentials, and provide a base for other Okta SDKs to build upon.
DESC
s.swift_version = "5.10"
s.platforms = {
:ios => "12.0",
:tvos => "12.0",
:ios => "13.0",
:tvos => "13.0",
:visionos => "1.0",
:watchos => "7.0",
:osx => "10.13"
:macos => "10.15",
:osx => "10.15"
}
s.ios.deployment_target = "12.0"
s.tvos.deployment_target = "12.0"
s.ios.deployment_target = "13.0"
s.tvos.deployment_target = "13.0"
s.visionos.deployment_target = "1.0"
s.watchos.deployment_target = "7.0"
s.osx.deployment_target = "10.13"
s.macos.deployment_target = "10.15"
s.osx.deployment_target = "10.15"

s.homepage = "https://github.com/okta/okta-mobile-swift"
s.license = { :type => "APACHE2", :file => "LICENSE" }
s.authors = { "Okta Developers" => "[email protected]"}
s.source = { :git => "https://github.com/okta/okta-mobile-swift.git", :tag => s.version.to_s }
s.source_files = "Sources/AuthFoundation/**/*.swift"
s.resource_bundles = { "AuthFoundation" => "Sources/AuthFoundation/Resources/**/*" }
s.swift_version = "5.9"

s.subspec "OktaConcurrency" do |ss|
ss.name = "OktaConcurrency"
ss.source_files = "Sources/OktaConcurrency/**/*.swift"
ss.preserve_paths = ["Package.swift", "Sources/OktaClientMacros/**/*.swift"]
script = <<-SCRIPT.squish
env -i PATH="$PATH" "$SHELL" -l -c
"swift build -c release --product OktaClientMacros
--sdk \\"`xcrun --show-sdk-path`\\"
--package-path \\"$PODS_TARGET_SRCROOT\\"
--scratch-path \\"${PODS_BUILD_DIR}/Macros/OktaClientMacros\\""
SCRIPT
ss.script_phase = {
:name => 'Build OktaClientMacros plugin',
:script => script,
:input_files => Dir.glob("{Package.swift,Sources/OktaClientMacros/**/*.swift}").map {
|path| "$(PODS_TARGET_SRCROOT)/#{path}"
},
:output_files => ['$(PODS_BUILD_DIR)/Macros/OktaClientMacros/release/OktaClientMacros'],
:execution_position => :before_compile
}
ss.user_target_xcconfig = {
'OTHER_SWIFT_FLAGS' => <<-FLAGS.squish
-Xfrontend -load-plugin-executable
-Xfrontend ${PODS_BUILD_DIR}/Macros/OktaClientMacros/release/OktaClientMacros#OktaClientMacros
FLAGS
}
end

s.subspec "OktaUtilities" do |ss|
ss.name = "OktaUtilities"
ss.source_files = "Sources/OktaUtilities/**/*.swift"
ss.dependency "OktaAuthFoundation/OktaConcurrency"
end

s.subspec "APIClient" do |ss|
ss.name = "APIClient"
ss.source_files = "Sources/APIClient/**/*.swift"
ss.resources = "Sources/APIClient/Resources/**/*"
ss.dependency "OktaAuthFoundation/OktaUtilities"
end

s.subspec "JWT" do |ss|
ss.name = "JWT"
ss.source_files = "Sources/JWT/**/*.swift"
ss.resources = "Sources/JWT/Resources/**/*"
ss.dependency "OktaAuthFoundation/OktaUtilities"
ss.dependency "OktaAuthFoundation/OktaConcurrency"
ss.dependency "OktaAuthFoundation/APIClient"
end

s.subspec "Keychain" do |ss|
ss.name = "Keychain"
ss.source_files = "Sources/Keychain/**/*.swift"
ss.resources = "Sources/Keychain/Resources/**/*"
ss.dependency "OktaAuthFoundation/OktaConcurrency"
end

s.subspec "Core" do |ss|
ss.source_files = "Sources/AuthFoundation/**/*.swift"
ss.resource_bundles = { "AuthFoundation" => "Sources/AuthFoundation/Resources/**/*" }
ss.dependency "OktaAuthFoundation/OktaUtilities"
ss.dependency "OktaAuthFoundation/OktaConcurrency"
ss.dependency "OktaAuthFoundation/Keychain"
ss.dependency "OktaAuthFoundation/APIClient"
ss.dependency "OktaAuthFoundation/JWT"
end

s.default_subspecs = "Core"
end
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@
"version" : "1.0.0"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-syntax",
"state" : {
"revision" : "0687f71944021d616d34d922343dcef086855920",
"version" : "600.0.1"
}
},
{
"identity" : "swiftotp",
"kind" : "remoteSourceControl",
Expand Down
32 changes: 32 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"pins" : [
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-plugin",
"state" : {
"revision" : "85e4bb4e1cd62cec64a4b8e769dcefdf0c5b9d64",
"version" : "1.4.3"
}
},
{
"identity" : "swift-docc-symbolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-docc-symbolkit",
"state" : {
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-syntax",
"state" : {
"revision" : "0687f71944021d616d34d922343dcef086855920",
"version" : "600.0.1"
}
}
],
"version" : 2
}
Loading
Loading