Skip to content

Commit

Permalink
Initial Gemini
Browse files Browse the repository at this point in the history
Co-authored-by: Ryan Wilson <[email protected]>
Co-authored-by: Andrew Heard <[email protected]>
Co-authored-by: Peter Friese <[email protected]>
Co-authored-by: Morgan Chen <[email protected]>
  • Loading branch information
5 people committed Dec 12, 2023
1 parent f630729 commit e1c52aa
Show file tree
Hide file tree
Showing 109 changed files with 7,498 additions and 65 deletions.
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 * * *'

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

0 comments on commit e1c52aa

Please sign in to comment.