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

Initial Gemini SDK commit #32

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: check

on:
pull_request:
push:
branches: main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
check:
runs-on: macos-latest
env:
MINT_PATH: ${{ github.workspace }}/mint
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: 3.6

- name: Cache Mint packages
uses: actions/cache@v3
with:
path: ${{ env.MINT_PATH }}
key: ${{ runner.os }}-mint-${{ hashFiles('**/Mintfile') }}
restore-keys: ${{ runner.os }}-mint-

- name: Setup check
run: |
brew update
brew install mint
mint bootstrap

- name: Style
run: scripts/style.sh test-only

- name: Whitespace
run: scripts/check_whitespace.sh

- name: Filename spaces
run: scripts/check_filename_spaces.sh

- name: Copyrights
run: scripts/check_copyright.sh
30 changes: 30 additions & 0 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: cli

on:
pull_request:
schedule:
# Run every day at 11pm (PST) - cron uses UTC times
- cron: '0 7 * * *'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if a nightly cron job is necessary for this yet, but I'm fine to keep it if I'm missing something

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will let us know if it breaks


concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
swift-build-run:
strategy:
matrix:
target: [macOS]
os: [macos-13]
include:
- os: macos-13
xcode: Xcode_15.0.1
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Initialize xcodebuild
run: xcodebuild -list
- name: Build CLI
run: scripts/third_party/travis/retry.sh scripts/build.sh GenerativeAICLI macOS build Examples/GenerativeAICLI
31 changes: 31 additions & 0 deletions .github/workflows/samples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: samples

on:
pull_request:
schedule:
# Run every day at 11pm (PST) - cron uses UTC times
- cron: '0 7 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
swift-build-run:
strategy:
matrix:
# Test build with debug and release configs (whether or not DEBUG is set and optimization level)
build: [build, archive]
os: [macos-13]
include:
- os: macos-13
xcode: Xcode_15.0.1
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Initialize xcodebuild
run: xcodebuild -list
- name: Build the sample
run: scripts/third_party/travis/retry.sh scripts/build.sh GenerativeAISample iOS ${{ matrix.build }} Examples/GenerativeAISample/GenerativeAISample.xcodeproj
30 changes: 30 additions & 0 deletions .github/workflows/spm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: spm

on:
pull_request:
schedule:
# Run every day at 11pm (PST) - cron uses UTC times
- cron: '0 7 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
swift-build-run:
strategy:
matrix:
target: [iOS, macOS]
os: [macos-13]
include:
- os: macos-13
xcode: Xcode_15.0.1
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Xcode
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer
- name: Initialize xcodebuild
run: xcodebuild -list
- name: Build and unit test
run: scripts/third_party/travis/retry.sh scripts/build.sh generative-ai-swift ${{ matrix.target }} test
87 changes: 34 additions & 53 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,57 +1,38 @@
# Created by https://www.toptal.com/developers/gitignore/api/macos,xcode
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,xcode

### macOS ###
# General
# OS X
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Xcode ###
## User settings
# Xcode
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Xcode 8 and earlier
*.xcscmblueprint
*.xccheckout

### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcodeproj/project.xcworkspace/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings

# End of https://www.toptal.com/developers/gitignore/api/macos,xcode

# This file contains the PaLM API key - don't check it in
PaLM-Info.plist
profile
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcworkspace

# Swift Package Manager
Package.resolved
**/.build
**/.swiftpm
.netrc

# Bad sorts get generated if the package .xcscheme is not regenerated.
# Anything committed to xcshareddata gets propagated to clients. (#8167)
.swiftpm/xcode/xcshareddata/

# Mint package manager
Mint

# CLI Tool
Apps/GoogleAICLI/GoogleAICLI.xcodeproj/xcshareddata/xcschemes/*
GenerativeAI-Info.plist
37 changes: 37 additions & 0 deletions Examples/GenerativeAICLI/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import PackageDescription

let package = Package(
name: "GenerativeAICLI",
platforms: [.macOS(.v13)],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.2.0"),
.package(name: "GoogleGenerativeAI", path: "../../"),
],
targets: [
.executableTarget(
name: "generate-content",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "GoogleGenerativeAI", package: "GoogleGenerativeAI"),
],
path: "Sources"
),
]
)
Loading
Loading