Skip to content

Commit

Permalink
Merge pull request #2 from basemind-ai/sdk-implementation
Browse files Browse the repository at this point in the history
feat: implement SDK
  • Loading branch information
Goldziher authored Dec 11, 2023
2 parents 9654311 + c24032e commit 1104aa2
Show file tree
Hide file tree
Showing 17 changed files with 1,648 additions and 732 deletions.
4 changes: 2 additions & 2 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version = 1

exclude_patterns = ["package/**", "example-app/**"]
exclude_patterns = ["Sources/BaseMindGateway/**"]

test_patterns = ["**/Tests/**"]
test_patterns = ["Tests/**"]

[[analyzers]]
name = "test-coverage"
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'CodeQL'

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: '16 20 * * 5'

jobs:
analyze:
name: Analyze
runs-on: macos-latest
timeout-minutes: 360
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Swift
uses: swift-actions/setup-swift@v1
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: swift
- name: Build
run: swift build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: '/language:swift'
34 changes: 34 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Test'
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
DEEPSOURCE_DSN: ${{secrets.DEEPSOURCE_DSN}}
jobs:
test:
runs-on: macos-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Swift
uses: swift-actions/setup-swift@v1
- name: Download the DeepSource CLI
run: curl https://deepsource.io/cli | sh
- name: Run tests
run: swift test --enable-code-coverage
- name: Create Coverage Report
uses: maxep/[email protected]
with:
output-file: ./coverage/lcov.info
- name: Upload Coverage Report
run: ./bin/deepsource report --analyzer test-coverage --key swift --value-file ./coverage/lcov.info
4 changes: 3 additions & 1 deletion .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Swift
uses: swift-actions/setup-swift@v1
- name: Setup Node
Expand All @@ -21,7 +23,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- name: Install Task
uses: arduino/setup-task@v1
- name: Install Pre-Commit
Expand Down
96 changes: 7 additions & 89 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,90 +1,8 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm

.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build/

# Accio dependency management
Dependencies/
.accio/

# fastlane
#
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
.DS_Store
*.dSYM
*.dSYM.zip
*.ipa
node_modules/
xcuserdata/
tmp/
55 changes: 25 additions & 30 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
default_stages: [commit]
repos:
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: "v9.10.0"
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies:
- "@commitlint/cli"
- "@commitlint/config-conventional"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.5.0"
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: "package"
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
hooks:
- id: prettier
exclude: "package"
- repo: github.com/nicklockwood/SwiftFormat
rev: ""
hooks:
- id: swiftformat
- repo: github.com/realm/SwiftLint
rev: ""
hooks:
- id: swiftlint
entry: swiftlint --fix --strict
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: 'v9.10.0'
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies:
- '@commitlint/cli'
- '@commitlint/config-conventional'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.5.0'
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: 'package'
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pre-commit/mirrors-prettier
rev: 'v4.0.0-alpha.4'
hooks:
- id: prettier
exclude: 'package'
- repo: https://github.com/nicklockwood/SwiftFormat
rev: '0.52.11'
hooks:
- id: swiftformat
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.9
92 changes: 92 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/BaseMind.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BaseMindClient"
BuildableName = "BaseMindClient"
BlueprintName = "BaseMindClient"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BaseMindClientTests"
BuildableName = "BaseMindClientTests"
BlueprintName = "BaseMindClientTests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BaseMindClientTests"
BuildableName = "BaseMindClientTests"
BlueprintName = "BaseMindClientTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BaseMindClient"
BuildableName = "BaseMindClient"
BlueprintName = "BaseMindClient"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/grpc/grpc-swift.git",
"state" : {
"revision" : "663a85221ecf93e4b8fb1f0fdd34d4b27ae78665",
"version" : "1.20.0"
"revision" : "6ade19f0b57f5fc436dfecfced83f3c84d1095b9",
"version" : "1.21.0"
}
},
{
Expand All @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-http-types",
"state" : {
"revision" : "4c542094de9b8316809a28ef51c434ee6ce6ee43",
"version" : "1.0.1"
"revision" : "1827dc94bdab2eb5f2fc804e9b0cb43574282566",
"version" : "1.0.2"
}
},
{
Expand Down
Loading

0 comments on commit 1104aa2

Please sign in to comment.