Skip to content

Commit b544665

Browse files
feat: initial fusionauth swift SDK for iOS with workspace and sample quickstart (#6)
* feat: first prototype for login with ObservableObject * style: swift lint * refactor: move getUserInfo implementation to method * feat: add logout * refactor: remove print * style: update swiftlint.yml * refactor: various code improvements - Don't require view to be provided when calling authorize / logout - Logging - use Dispatch.mein.async instead of @mainactor - use @discardableResult * test: set up tests * refactor(package.swift): add macos version - the build process requires a higher macos version according to the error in the autobuild error: the library 'FusionAuth' requires macos 10.13, but depends on the product 'SwiftLintBuildToolPlugin' which requires macos 12.0; consider changing the library 'FusionAuth' to require macos 12.0 or later, or the product 'SwiftLintBuildToolPlugin' to require macos 10.13 or earlier. * build(deps): update multiple dependencies - Fix all versions to exact - Add swift-docc-plugin - Bump SwiftLint * refactor(workspace): add FusionAuthSDK workspace with FusionAuth scheme from package * ci(codeql): switch setup-xcode action to mxcl/xcodebuild - https://github.com/mxcl/xcodebuild (cherry picked from commit 3ac5cef) * refactor(workspace): add and link TestApp in to FusionAuthSDK workspace - add fusionauth-ios-mobilesdk-test-app as a submodule https://github.blog/open-source/git/working-with-submodules/ - add Quickstart TestApp to FusionAuthSDK workspace * feat: enable (theoretical) macos support * docs: test documentation from SourceDocs * refactor(workspace): Remove submodule * refactor(workspace): Add Quickstart in to Samples * fix(OAuthAuthorizationService): correct linting error * build(deps): bump fusionauth to 1.52.1 * refactor(workspace): rename quickstart app, add package dependencies differently * refactor(workspace): rename quickstart app, add package dependencies differently * ci(codeql): split in to multiple codeql workflows - split quickstart in to own workflow - add working directory defaults pointing to quickstart * ci(codeql): add package workflow * ci(codeql): add default working-directory * ci(codeql): try with setup-xcode * ci(codeql): try with limiting paths * ci(codeql): add specific codeql-config * refactor(workspace): change to relative path * ci(codeql): update build modes and fix analysis * ci(codeql): remove push and pull path filter * ci(codeql): update action version and add manual build * ci(codeql): switch to autobuild * ci(codeql): switch codeql-package to manual build * ci(codeql): switch codeql-samples-quickstart to manual build * docs: add SourceDocs script * ci(codeql): add destination matrix to samples-quickstart * refactor(codeql): add swiftlint * refactor(codeql): skipPackagePluginValidation - https://forums.swift.org/t/some-build-plug-ins-are-disabled-because-they-have-changed-or-have-never-been-enabled-enable-them-now/61075 * refactor(codeql): check disk space usage * refactor(codeql): check disk space usage with sleep * refactor(codeql): remove old xcode versions * refactor(codeql): only check what can be removed * refactor(codeql): check for old xcode and remove all except the latest * refactor(codeql): specify xcode version to be installed and kept * refactor(codeql): additional messaging and disk space check before build * build(deps): bump codeql to 3.26.6 * build(deps): bump SwiftLint and Swift Docc Plugin * build(deps): bump quickstart TestApp dependencies * refactor(gitignore): update exclustions * ci(codeql): matrix with older xcode and platform * ci(codeql): update matrix * build(deps): bump setup-python to 5.2.0 * refactor(fusionauth): add and correct docker-compose configurations * ci(codeql): execute analysis if build successful or not * ci(codeql): build with build-tests, debug and verbose * build(deps): bump Package.resolved * fix: error with closure * fix: error with closure * feat: prototyping TokenManager * ci(workflows): update timings and naming * build(deps): bump fusionauth to 1.53.2 * fix: error with closure reveting and instead enclosing them as a string to avoid build error a04a36a 72a4956 otherwise its crashing at Thread 8: Fatal error: Unexpectedly found nil while unwrapping an Optional value * build(deps): bump swiftlint and swift-docc-plugin * fix: redirectUri bundleIdentifier usage * refactor: make composition variables internal * build(deps): bump swift to 6.0.0 and xcode to 16.0 * build(deps): refactor swift to 6.0 * build(deps): downgrade swift to 5.10.1 - swift-actions/setup-swift does not yet support swift 6.0 swift-actions/setup-swift#684 swift-actions/setup-swift#683 * build(deps): downgrade xcode to 15.4 because swift 6.0.0 is not yet available * refactor(documentation): generate newest version * docs: add class descriptions * docs: generate newest version * docs: add func descriptions * docs: generate newest version * docs: generate docc version * docs: remove docc version * docs: remove all "Returns: Void" * docs: generate latest sourcedocs version * docs(README): add Getting Started, Usage and Dev Tooling draft. * test(swift): add unit tests for AuthorizationManager, TokenManager and UserInfo * test(swift): update AuthorizationManager * test(swift): lint fixes * docs: add period at the end of sentences * docs: create github default community health files - according to https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/creating-a-default-community-health-file * refactor(AuthorizationManager): allow storage to be optional * docs: update README adding more TODOs * ci(e2e-test): add initial ios-matrix workflow * ci(workflows): add fixed runner to macos-14 * ci(workflows): downgrade to xcode 16.0 * ci(workflows): downgrade to xcode 15.4 and fix swift to 5.10.1 * ci(workflows): downgrade swift-tools-version minimum to 5.8 * build(deps): downgrade PinsStorage to version 2 * build(deps): remove version binding from SwiftLint * build(deps): downgrade version SwiftLint to 0.56.0 * build(deps): downgrade version SwiftLint to 0.54.0 * build(deps): downgrade version SwiftLint to 0.53.0 * feat: implement TokenManager, Refresh Token * build(deps): split swift package in to post and pre swift 5.10 * build(deps): use SwiftLintPlugin pre swift 5.10 * ci(e2e-test): add iOS 15.5 * feat: use userInfo email or name if given_ or family_name is not available * refactor: rename TestApp to Quickstart * docs(CONTRIBUTING): add swiftformat * ci(e2e-test): add simulator runtime installation * test: base UI test login to logout * ci(e2e-test): simulator runtime installation with xcodes * refactor: remove docs script * refactor: downgrade IPHONEOS_DEPLOYMENT_TARGET to 15.0 * ci(e2e-test): simulator device for iOS 15.5 set to iPhone 13 * ci(e2e-test): simulator installation test * refactor(workspace): downgrade objectVersion to 55 * ci(e2e-test): downgrade iOS to 18.0 * refactor(workspace): convert QuickstartTests from folder to group to solve xcode compatability issue * ci(e2e-test): adjust versions * ci(e2e-test): install simulator for macos-13 --------- Co-authored-by: Colin Frick <[email protected]>
1 parent 897d5c1 commit b544665

File tree

116 files changed

+15369
-121
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+15369
-121
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: "CodeQL - Sample Quickstart configuration"
2+
3+
paths:
4+
- Samples
Lines changed: 42 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
12-
name: "CodeQL"
1+
name: "Security and Code-Quality scan with CodeQL - Package"
132

143
on:
154
push:
@@ -23,7 +12,7 @@ on:
2312

2413
jobs:
2514
analyze:
26-
name: Analyze (${{ matrix.language }})
15+
name: CodeQL Scan (${{ matrix.language }})
2716
# Runner size impacts CodeQL analysis time. To learn more, please see:
2817
# - https://gh.io/recommended-hardware-resources-for-running-codeql
2918
# - https://gh.io/supported-runners-and-hardware-resources
@@ -32,7 +21,7 @@ jobs:
3221

3322
#runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
3423
#runs-on: [ self-hosted, macos ]
35-
runs-on: ['macos-latest']
24+
runs-on: ['macos-14']
3625

3726
#timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
3827
timeout-minutes: 120
@@ -51,80 +40,81 @@ jobs:
5140
strategy:
5241
fail-fast: false
5342
matrix:
43+
# https://github.com/swiftlang/swift/releases
5444
swift: ["5.10.1"]
55-
os: [macos-latest]
56-
include:
57-
- language: swift
58-
# build-mode: autobuild
59-
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
60-
# Use `c-cpp` to analyze code written in C, C++ or both
61-
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
62-
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
45+
# https://developer.apple.com/documentation/xcode-release-notes
46+
xcode: ["15.4"]
47+
language: [swift]
48+
build-mode: [manual]
6349
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
6450
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
6551
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
6652
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
53+
6754
steps:
55+
# This step initializes the in the matrix specified version of Xcode.
6856
- name: Initialize latest xcode
6957
uses: maxim-lobanov/[email protected]
7058
with:
71-
xcode-version: latest-stable
72-
59+
xcode-version: ${{ matrix.xcode }}
60+
61+
# This step removes all other versions of Xcode from the machine.
62+
- name: Remove old xcode versions
63+
run: |
64+
echo "Searching for Xcode versions:"
65+
find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1
66+
echo "Removing old Xcode versions..."
67+
find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 | grep -v ${{ matrix.xcode }} | xargs rm -rf
68+
echo "Available Xcode versions after removal:"
69+
find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1
70+
71+
# Initialize Swift in the matrix specified version.
7372
- name: Initialize Swift
7473
uses: swift-actions/[email protected]
7574
with:
7675
swift-version: ${{ matrix.swift }}
7776

77+
# Get the Swift version.
7878
- name: Get swift version
7979
run: swift --version
8080

81+
# Checkout the repository.
8182
- name: Checkout repository
8283
uses: actions/[email protected]
8384

85+
# Initialize CodeQL.
8486
- name: Initialize CodeQL
85-
uses: github/codeql-action/[email protected].2
87+
uses: github/codeql-action/[email protected].6
8688
with:
8789
languages: ${{ matrix.language }}
88-
#build-mode: ${{ matrix.build-mode }}
89-
# If you wish to specify custom queries, you can do so here or in a config file.
90-
# By default, queries listed here will override any specified in a config file.
91-
# Prefix the list here with "+" to use these queries and those in the config file.
90+
build-mode: ${{ matrix.build-mode }}
9291

9392
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
9493
# queries: security-extended,security-and-quality
9594
queries: security-and-quality
9695

97-
# If the analyze step fails for one of the languages you are analyzing with
98-
# "We were unable to automatically build your code", modify the matrix above
99-
# to set the build mode to "manual" for that language. Then modify this step
100-
# to build your code.
10196
# ℹ️ Command-line programs to run using the OS shell.
10297
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
10398

10499

105100
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
106101
# If this step fails, then you should remove it and run the build manually (see below)
107-
- name: Autobuild
108-
uses: github/codeql-action/[email protected]
109-
110-
111-
#- if: matrix.build-mode == 'manual'
112-
# shell: bash
113-
# run: |
114-
# echo 'If you are using a "manual" build mode for one or more of the' \
115-
# 'languages you are analyzing, replace this with the commands to build' \
116-
# 'your code, for example:'
117-
# echo ' make bootstrap'
118-
# echo ' make release'
119-
#
120-
# swift build
121-
#
122-
# echo ' swift build -c release '
123-
#
124-
# exit 1
102+
#- name: Autobuild
103+
# uses: github/codeql-action/[email protected]
104+
105+
# Check disk space.
106+
- name: Check Disk Space
107+
run: |
108+
sleep 10
109+
df -h
125110
111+
# Manual build with the release configuration.
112+
- name: Manual build
113+
run: swift build --build-tests --configuration debug -v
126114

115+
# Perform CodeQL analysis after the build has completed successfully or failed.
127116
- name: Perform CodeQL Analysis
128-
uses: github/codeql-action/[email protected]
117+
uses: github/codeql-action/[email protected]
118+
if: success() || failure()
129119
with:
130120
category: "/language:${{matrix.language}}"
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: "Security and Code-Quality scan with CodeQL - Quickstart Sample"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: '28 6 * * 1'
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
jobs:
14+
analyze:
15+
name: CodeQL Scan (${{ matrix.language }})
16+
# Runner size impacts CodeQL analysis time. To learn more, please see:
17+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
18+
# - https://gh.io/supported-runners-and-hardware-resources
19+
# - https://gh.io/using-larger-runners (GitHub.com only)
20+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
21+
22+
#runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
23+
#runs-on: [ self-hosted, macos ]
24+
runs-on: [ 'macos-14' ]
25+
26+
#timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
27+
timeout-minutes: 120
28+
29+
permissions:
30+
# required for all workflows
31+
security-events: write
32+
33+
# required to fetch internal or private CodeQL packs
34+
packages: read
35+
36+
# only required for workflows in private repositories
37+
actions: read
38+
contents: read
39+
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
# https://github.com/swiftlang/swift/releases
44+
swift: [ "5.10.1" ]
45+
# https://developer.apple.com/documentation/xcode-release-notes
46+
xcode: [ "15.4" ]
47+
language: [ swift ]
48+
build-mode: [ manual ]
49+
destination:
50+
- "platform=iOS Simulator,OS=18.1,name=iPhone 15"
51+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
52+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
53+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
54+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
55+
56+
steps:
57+
# Initialize the latest version of Xcode.
58+
- name: Initialize latest xcode
59+
uses: maxim-lobanov/[email protected]
60+
with:
61+
xcode-version: ${{ matrix.xcode }}
62+
63+
# Remove any other Xcode version.
64+
- name: Remove old xcode versions
65+
run: |
66+
echo "Searching for Xcode versions:"
67+
find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1
68+
echo "Removing old Xcode versions..."
69+
find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 | grep -v ${{ matrix.xcode }} | xargs rm -rf
70+
echo "Available Xcode versions after removal:"
71+
find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1
72+
73+
# Initialize Swift in the matrix specified version.
74+
- name: Initialize Swift
75+
uses: swift-actions/[email protected]
76+
with:
77+
swift-version: ${{ matrix.swift }}
78+
79+
# Get the Swift version.
80+
- name: Get swift version
81+
run: swift --version
82+
83+
# Checkout the repository.
84+
- name: Checkout repository
85+
uses: actions/[email protected]
86+
87+
# Initialize CodeQL.
88+
- name: Initialize CodeQL
89+
uses: github/codeql-action/[email protected]
90+
with:
91+
languages: ${{ matrix.language }}
92+
build-mode: ${{ matrix.build-mode }}
93+
94+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
95+
# queries: security-extended,security-and-quality
96+
queries: security-and-quality
97+
config-file: .github/codeql/codeql-samples-config.yml
98+
99+
# ℹ️ Command-line programs to run using the OS shell.
100+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
101+
102+
103+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
104+
# If this step fails, then you should remove it and run the build manually (see below)
105+
#- name: Autobuild
106+
# uses: github/codeql-action/[email protected]
107+
108+
# Check Disk Space before the build.
109+
- name: Check Disk Space
110+
run: |
111+
sleep 10
112+
df -h
113+
114+
# Perform the build manually.
115+
- name: Manual Build
116+
run: set -o pipefail && xcodebuild -workspace FusionAuthSDK.xcworkspace/ -scheme fusionauth-quickstart-swift-ios-native -destination "${{matrix.destination}}" -skipPackagePluginValidation
117+
118+
# Perform CodeQL Analysis if the build succeeded or failed.
119+
- name: Perform CodeQL Analysis
120+
uses: github/codeql-action/[email protected]
121+
if: success() || failure()
122+
with:
123+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)