2023-12-15 19:33:52 +00:00
|
|
|
name: test
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
generate:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2024-01-14 17:19:45 +00:00
|
|
|
arch: [amd64, arm64]
|
|
|
|
exclude:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
arch: arm64
|
|
|
|
- os: windows-latest
|
|
|
|
arch: arm64
|
2023-12-15 19:33:52 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2024-01-14 17:19:45 +00:00
|
|
|
env:
|
|
|
|
GOARCH: ${{ matrix.arch }}
|
2023-12-15 19:33:52 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-01-12 17:03:06 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-12-15 19:33:52 +00:00
|
|
|
with:
|
2024-01-18 19:51:34 +00:00
|
|
|
go-version: '1.21'
|
2023-12-15 19:33:52 +00:00
|
|
|
cache: true
|
|
|
|
- run: go get ./...
|
|
|
|
- run: go generate -x ./...
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
2024-01-14 17:19:45 +00:00
|
|
|
name: ${{ matrix.os }}-${{ matrix.arch }}-libraries
|
2023-12-22 20:17:37 +00:00
|
|
|
path: llm/llama.cpp/build/**/lib/*
|
|
|
|
generate-cuda:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
cuda-version:
|
|
|
|
- '11.8.0'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: nvidia/cuda:${{ matrix.cuda-version }}-devel-ubuntu20.04
|
|
|
|
steps:
|
|
|
|
- run: |
|
|
|
|
apt-get update && apt-get install -y git build-essential curl
|
|
|
|
curl -fsSL https://github.com/Kitware/CMake/releases/download/v3.28.1/cmake-3.28.1-linux-x86_64.tar.gz \
|
|
|
|
| tar -zx -C /usr --strip-components 1
|
|
|
|
env:
|
|
|
|
DEBIAN_FRONTEND: noninteractive
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: '1.21'
|
|
|
|
cache: true
|
|
|
|
- run: go get ./...
|
|
|
|
- run: |
|
|
|
|
git config --global --add safe.directory /__w/ollama/ollama
|
|
|
|
go generate -x ./...
|
|
|
|
env:
|
|
|
|
OLLAMA_SKIP_CPU_GENERATE: '1'
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: cuda-${{ matrix.cuda-version }}-libraries
|
|
|
|
path: llm/llama.cpp/build/**/lib/*
|
|
|
|
generate-rocm:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
rocm-version:
|
|
|
|
- '5.7.1'
|
|
|
|
- '6.0'
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: rocm/dev-ubuntu-20.04:${{ matrix.rocm-version }}
|
|
|
|
steps:
|
|
|
|
- run: |
|
|
|
|
apt-get update && apt-get install -y git build-essential curl rocm-libs
|
|
|
|
curl -fsSL https://github.com/Kitware/CMake/releases/download/v3.28.1/cmake-3.28.1-linux-x86_64.tar.gz \
|
|
|
|
| tar -zx -C /usr --strip-components 1
|
|
|
|
env:
|
|
|
|
DEBIAN_FRONTEND: noninteractive
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: '1.21'
|
|
|
|
cache: true
|
|
|
|
- run: go get ./...
|
|
|
|
- run: |
|
|
|
|
git config --global --add safe.directory /__w/ollama/ollama
|
|
|
|
go generate -x ./...
|
|
|
|
env:
|
|
|
|
OLLAMA_SKIP_CPU_GENERATE: '1'
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: rocm-${{ matrix.rocm-version }}-libraries
|
|
|
|
path: llm/llama.cpp/build/**/lib/*
|
2023-12-15 19:33:52 +00:00
|
|
|
lint:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2024-01-14 17:19:45 +00:00
|
|
|
arch: [amd64, arm64]
|
|
|
|
exclude:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
arch: arm64
|
|
|
|
- os: windows-latest
|
|
|
|
arch: arm64
|
|
|
|
- os: macos-latest
|
|
|
|
arch: amd64
|
2023-12-15 19:33:52 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2024-01-14 17:19:45 +00:00
|
|
|
env:
|
|
|
|
GOARCH: ${{ matrix.arch }}
|
|
|
|
CGO_ENABLED: "1"
|
2023-12-15 19:33:52 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
2024-01-12 17:03:06 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-12-15 19:33:52 +00:00
|
|
|
with:
|
2024-01-18 19:51:34 +00:00
|
|
|
go-version: '1.21'
|
2023-12-15 19:33:52 +00:00
|
|
|
cache: false
|
2024-01-25 01:29:47 +00:00
|
|
|
- run: |
|
|
|
|
mkdir -p llm/llama.cpp/build/linux/${{ matrix.arch }}/stub/lib/
|
|
|
|
touch llm/llama.cpp/build/linux/${{ matrix.arch }}/stub/lib/stub.so
|
|
|
|
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
|
|
|
- run: |
|
|
|
|
mkdir -p llm/llama.cpp/build/darwin/${{ matrix.arch }}/stub/lib/
|
|
|
|
touch llm/llama.cpp/build/darwin/${{ matrix.arch }}/stub/lib/stub.dylib
|
|
|
|
touch llm/llama.cpp/ggml-metal.metal
|
|
|
|
if: ${{ startsWith(matrix.os, 'macos-') }}
|
|
|
|
- run: |
|
|
|
|
mkdir -p llm/llama.cpp/build/windows/${{ matrix.arch }}/stub/lib/
|
|
|
|
touch llm/llama.cpp/build/windows/${{ matrix.arch }}/stub/lib/stub.dll
|
|
|
|
if: ${{ startsWith(matrix.os, 'windows-') }}
|
2023-12-15 19:33:52 +00:00
|
|
|
- uses: golangci/golangci-lint-action@v3
|
|
|
|
test:
|
2024-01-19 17:20:19 +00:00
|
|
|
needs: generate
|
2023-12-15 19:33:52 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2024-01-18 03:00:30 +00:00
|
|
|
arch: [amd64]
|
2024-01-14 17:19:45 +00:00
|
|
|
exclude:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
arch: arm64
|
|
|
|
- os: windows-latest
|
|
|
|
arch: arm64
|
2023-12-15 19:33:52 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2024-01-13 00:28:00 +00:00
|
|
|
env:
|
|
|
|
GOARCH: ${{ matrix.arch }}
|
|
|
|
CGO_ENABLED: "1"
|
2023-12-15 19:33:52 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
2024-01-12 17:03:06 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-12-15 19:33:52 +00:00
|
|
|
with:
|
2024-01-18 19:51:34 +00:00
|
|
|
go-version: '1.21'
|
2023-12-15 19:33:52 +00:00
|
|
|
cache: true
|
|
|
|
- run: go get
|
|
|
|
- uses: actions/download-artifact@v4
|
|
|
|
with:
|
2024-01-14 17:19:45 +00:00
|
|
|
name: ${{ matrix.os }}-${{ matrix.arch }}-libraries
|
2023-12-15 19:33:52 +00:00
|
|
|
path: llm/llama.cpp/build
|
|
|
|
- run: go build
|
|
|
|
- run: go test -v ./...
|
2023-12-23 00:06:35 +00:00
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.os }}-binaries
|
|
|
|
path: ollama
|