Add support for Ollama #285
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
TEST_MODEL: SlyOtis/git-auto-message:latest | |
OPENAI_API_URL: http://localhost:4010/v1 | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup nightly toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
components: rustfmt, clippy | |
toolchain: nightly | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-nightly-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: -- -D warnings | |
- name: Run cargo fmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: -- --check | |
test: | |
needs: lint | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
rust: [nightly, stable] | |
runs-on: ${{ matrix.os }} | |
continue-on-error: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Start test services | |
if: startsWith(matrix.os, 'ubuntu') | |
uses: hoverkraft-tech/[email protected] | |
with: | |
services: prism | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
override: true | |
profile: minimal | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-${{ matrix.rust }}- | |
- name: Install fish on linux | |
if: startsWith(matrix.os, 'ubuntu') | |
run: sudo apt-get install fish | |
- name: Install fish on macos | |
if: startsWith(matrix.os, 'macos') | |
run: brew install fish | |
- name: Install ollama | |
if: startsWith(matrix.os, 'ubuntu') | |
run: curl -fsSL https://ollama.com/install.sh | sh | |
- name: Run ollama | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
ollama serve & | |
ollama pull SlyOtis/git-auto-message:latest | |
- name: Run comprehensive tests | |
run: | | |
cargo build --release | |
cargo test --release | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
- name: Run integration tests (ubuntu) | |
if: startsWith(matrix.os, 'ubuntu') | |
run: ./scripts/integration-tests | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |