Skip to content

Commit

Permalink
chore: added git submodule for gateway proto
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldziher committed Dec 2, 2023
1 parent 31f3780 commit fbe8f1a
Show file tree
Hide file tree
Showing 14 changed files with 159 additions and 188 deletions.
5 changes: 5 additions & 0 deletions .commitlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"@commitlint/config-conventional"
]
}
15 changes: 15 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version = 1

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

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

[[analyzers]]
name = "test-coverage"
enabled = true

[[analyzers]]
name = "swift"

[analyzers.meta]
swift_version = "5.9"
6 changes: 6 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'daily'
18 changes: 18 additions & 0 deletions .github/workflows/pr-agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CodiumAI PR Agent
on:
pull_request:
issue_comment:
jobs:
pr_agent:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: write
steps:
- name: Exec PR Agent
id: pragent
uses: Codium-ai/pr-agent@main
env:
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/pr-title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: 'Lint PR Title'

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Validate'
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Swift
uses: swift-actions/setup-swift@v1
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 21
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Task
uses: arduino/setup-task@v1
- name: Install Pre-Commit
run: python -m pip install pre-commit && pre-commit install
- name: Load Cached Pre-Commit Dependencies
id: cached-pre-commit-dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit/
key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Lint
run: task lint
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "proto/gateway"]
path = proto/gateway
url = https://github.com/basemind-ai/gateway-proto
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/**
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"quoteProps": "consistent",
"semi": true,
"singleQuote": true,
"tabWidth": 4,
"trailingComma": "all",
"useTabs": true
}
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-http-types",
"state" : {
"revision" : "99d066e29effa8845e4761dd3f2f831edfdf8925",
"version" : "1.0.0"
"revision" : "4c542094de9b8316809a28ef51c434ee6ce6ee43",
"version" : "1.0.1"
}
},
{
Expand Down Expand Up @@ -95,8 +95,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "07f7f26ded8df9645c072f220378879c4642e063",
"version" : "1.25.1"
"revision" : "65e8f29b2d63c4e38e736b25c27b83e012159be8",
"version" : "1.25.2"
}
}
],
Expand Down
5 changes: 5 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Security Policy

## Reporting a Vulnerability

Please open an issue on GitHub.
189 changes: 5 additions & 184 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -1,196 +1,17 @@
version: '3'
version: "3"

tasks:
# project dependencies
install-pnpm:
cmds:
- |
if command -v brew &> /dev/null; then
brew install pnpm
else
npm install -g pnpm
fi
status:
- command -v pnpm &> /dev/null || exit 1
install-pre-commit:
cmds:
- |
if command -v brew &> /dev/null; then
brew install pre-commit
else
pip install pre-commit
fi
status:
- command -v pre-commit &> /dev/null || exit 1
install-sqlc:
cmds:
- |
if command -v brew &> /dev/null; then
brew install sqlc
else
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
fi
status:
- command -v sqlc &> /dev/null || exit 1
install-atlas:
cmds:
- |
if command -v brew &> /dev/null; then
brew install ariga/tap/atlas
else
curl -sSf https://atlasgo.sh | sh
fi
status:
- command -v atlas &> /dev/null || exit 1
install-buf:
cmds:
- |
if command -v brew &> /dev/null; then
brew install bufbuild/buf/buf
else
npm install -g @bufbuild/buf
fi
status:
- command -v buf &> /dev/null || exit 1
install-terraform:
cmds:
- |
if command -v brew &> /dev/null; then
brew tap hashicorp/tap
brew install hashicorp/tap/terraform
brew install tflint
else
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install terraform
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
fi
status:
- command -v terraform &> /dev/null || exit 1
update-brew:
cmds:
- |
if command -v brew &> /dev/null; then
brew update;
brew upgrade;
brew cleanup || true;
fi
setup:
desc: Setup the project dependencies
cmds:
- task: update-brew
- task: install-pnpm
- task: install-pre-commit
- task: install-sqlc
- task: install-atlas
- task: install-buf
- task: install-terraform
- pre-commit install && pre-commit install --hook-type commit-msg
- pnpm install -r
- go mod download
# repository management
update:android:
cmds:
- ./gradlew wrapper --gradle-version latest
- ./gradlew androidDependencies
- ./gradlew versionCatalogUpdate
lint:android:
desc: Lint the android codebase with in-built lint checks
cmds:
- ./gradlew :sdks:android:sdk:lint
- ./gradlew :sdks:android:test-app:lint
- ./gradlew spotlessApply
- command -v pre-commit &> /dev/null || brew install pre-commit
- pre-commit install && pre-commit install --hook-type commit-msg && pre-commit install-hooks
update:
desc: Update the project dependencies
cmds:
- task: update-brew
- task: update:android
- pnpm add -g pnpm && pnpm update -r --latest
- go mod tidy && go get -u ./... &> /dev/null
- pre-commit autoupdate
- swift package update
- swift outdated
lint:
desc: Lint the project
cmds:
- pre-commit run --show-diff-on-failure --color=always --all-files
- task: lint:android
# database
db:up:
desc: Bring up the local database
cmds:
- docker compose stop && docker compose up db --detach
db:down:
desc: Tear down the local database
cmds:
- docker compose down db
migrations:apply:
desc: Apply the migrations to the local database
cmds:
- task: db:up
- sleep 2
- atlas migrate apply --dir "file://sql/migrations" --url "postgresql://basemind:basemind@localhost:5432/basemind?search_path=public&sslmode=disable"
migrations:create:
desc: Create a new migration
cmds:
- task: db:up
- sleep 2
- atlas migrate diff {{.CLI_ARGS}} --dir "file://sql/migrations" --to "file://sql/schema.sql" --dev-url "postgresql://basemind:basemind@localhost:5432/basemind?search_path=public&sslmode=disable"
slqc:generate:
desc: Generate the database code from the sqlc.yaml file
cmds:
- rm -rf shared/go/db/models
- sqlc generate
slqc:vet:
desc: Lint the database schema
cmds:
- task: db:up
- sleep 2
- sqlc vet
# protobuf
buf:generate:
desc: Generate gRPC types and code from proto files
cmds:
- rm -rf gen
- npx buf generate
- rm -rf gen/go/openai
- rm -rf gen/go/cohere
- rm -rf gen/ts/gateway
- rm -rf gen/ts/ptesting
- rm -rf sdks/ios/Sources/BaseMindGateway
- mv gen/swift/gateway/v1 sdks/ios/Sources/BaseMindGateway
- rm -rf gen/swift
buf:lint:
desc: Lint the protobuf files
cmds:
- npx buf lint
buf:format:
desc: Format the protobuf files
cmds:
- npx buf format
# testing
e2e:seed:
desc: Seed the local database with testing data
cmds:
- task: db:up
- go run e2e/main.go seed
e2e:clean:
desc: Clean the local database of all testing data
cmds:
- task: db:up
- go run e2e/main.go clean
e2e:create-jwt:
desc: Create a JWT from the given applicationId arg
cmds:
- go run e2e/main.go create-jwt {{.CLI_ARGS}}
# gcp commands
gcp:deploy-emailsender:
desc: Deploys the email sender cloud function to GCP
dir: cloud-functions/emailsender
cmds:
- |
gcloud functions deploy email-sender \
--gen2 \
--runtime=go121 \
--region=europe-west3 \
--source=. \
--entry-point=SendgridEmailPubSub \
--trigger-topic=send-email
1 change: 1 addition & 0 deletions proto/gateway
Submodule gateway added at 7d6dc8

0 comments on commit fbe8f1a

Please sign in to comment.