2023-05-23 15:12:48 +00:00
|
|
|
name: Build and Release
|
|
|
|
|
|
|
|
on: push
|
|
|
|
|
2024-03-29 21:32:40 +00:00
|
|
|
env:
|
|
|
|
GRPC_VERSION: v1.58.0
|
|
|
|
|
2023-05-23 19:47:47 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
|
2023-12-26 18:19:37 +00:00
|
|
|
concurrency:
|
|
|
|
group: ci-releases-${{ github.head_ref || github.ref }}-${{ github.repository }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2023-05-23 15:12:48 +00:00
|
|
|
jobs:
|
|
|
|
build-linux:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- build: 'avx2'
|
|
|
|
defines: ''
|
|
|
|
- build: 'avx'
|
|
|
|
defines: '-DLLAMA_AVX2=OFF'
|
|
|
|
- build: 'avx512'
|
|
|
|
defines: '-DLLAMA_AVX512=ON'
|
2024-02-13 08:35:39 +00:00
|
|
|
- build: 'cuda12'
|
|
|
|
defines: ''
|
|
|
|
- build: 'cuda11'
|
|
|
|
defines: ''
|
2023-05-23 15:12:48 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Clone
|
2023-10-21 06:55:44 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-05-29 21:11:29 +00:00
|
|
|
with:
|
2023-05-23 15:12:48 +00:00
|
|
|
submodules: true
|
2024-04-11 13:10:32 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-08-23 23:18:58 +00:00
|
|
|
with:
|
2024-03-29 21:32:40 +00:00
|
|
|
go-version: '1.21.x'
|
|
|
|
cache: false
|
2023-05-23 15:12:48 +00:00
|
|
|
- name: Dependencies
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install build-essential ffmpeg
|
2024-02-13 08:35:39 +00:00
|
|
|
- name: Install CUDA Dependencies
|
|
|
|
if: ${{ matrix.build == 'cuda12' || matrix.build == 'cuda11' }}
|
|
|
|
run: |
|
|
|
|
if [ "${{ matrix.build }}" == "cuda12" ]; then
|
|
|
|
export CUDA_VERSION=12-3
|
|
|
|
else
|
|
|
|
export CUDA_VERSION=11-7
|
|
|
|
fi
|
|
|
|
curl -O https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
|
|
|
|
sudo dpkg -i cuda-keyring_1.1-1_all.deb
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y cuda-nvcc-${CUDA_VERSION} libcublas-dev-${CUDA_VERSION}
|
2024-01-05 22:16:33 +00:00
|
|
|
- name: Cache grpc
|
|
|
|
id: cache-grpc
|
2024-04-11 14:35:27 +00:00
|
|
|
uses: actions/cache@v4
|
2024-01-05 22:16:33 +00:00
|
|
|
with:
|
|
|
|
path: grpc
|
2024-03-29 21:32:40 +00:00
|
|
|
key: ${{ runner.os }}-grpc-${{ env.GRPC_VERSION }}
|
2024-01-05 22:16:33 +00:00
|
|
|
- name: Build grpc
|
|
|
|
if: steps.cache-grpc.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
2024-03-29 21:32:40 +00:00
|
|
|
git clone --recurse-submodules -b ${{ env.GRPC_VERSION }} --depth 1 --shallow-submodules https://github.com/grpc/grpc && \
|
2024-01-05 22:16:33 +00:00
|
|
|
cd grpc && mkdir -p cmake/build && cd cmake/build && cmake -DgRPC_INSTALL=ON \
|
|
|
|
-DgRPC_BUILD_TESTS=OFF \
|
2024-03-29 21:32:40 +00:00
|
|
|
../.. && sudo make --jobs 5 --output-sync=target
|
2024-01-05 22:16:33 +00:00
|
|
|
- name: Install gRPC
|
|
|
|
run: |
|
2024-03-29 21:32:40 +00:00
|
|
|
cd grpc && cd cmake/build && sudo make --jobs 5 --output-sync=target install
|
2023-05-23 15:12:48 +00:00
|
|
|
- name: Build
|
|
|
|
id: build
|
|
|
|
env:
|
2023-05-29 21:11:29 +00:00
|
|
|
CMAKE_ARGS: "${{ matrix.defines }}"
|
2023-05-23 15:12:48 +00:00
|
|
|
BUILD_ID: "${{ matrix.build }}"
|
|
|
|
run: |
|
2024-02-13 08:35:39 +00:00
|
|
|
if [ "${{ matrix.build }}" == "cuda12" ] || [ "${{ matrix.build }}" == "cuda11" ]; then
|
|
|
|
export BUILD_TYPE=cublas
|
|
|
|
export PATH=/usr/local/cuda/bin:$PATH
|
|
|
|
make dist
|
|
|
|
else
|
|
|
|
STATIC=true make dist
|
|
|
|
fi
|
2024-04-11 14:44:02 +00:00
|
|
|
- uses: actions/upload-artifact@v4
|
2023-05-23 15:12:48 +00:00
|
|
|
with:
|
2024-04-11 16:26:03 +00:00
|
|
|
name: LocalAI-linux-${{ matrix.build }}
|
2023-05-23 15:12:48 +00:00
|
|
|
path: release/
|
|
|
|
- name: Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
release/*
|
|
|
|
|
2024-02-25 23:06:18 +00:00
|
|
|
build-stablediffusion:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Clone
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: true
|
2024-04-11 13:10:32 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2024-02-25 23:06:18 +00:00
|
|
|
with:
|
2024-03-29 21:32:40 +00:00
|
|
|
go-version: '1.21.x'
|
|
|
|
cache: false
|
2024-02-25 23:06:18 +00:00
|
|
|
- name: Dependencies
|
|
|
|
run: |
|
|
|
|
sudo apt-get install -y --no-install-recommends libopencv-dev
|
|
|
|
- name: Build stablediffusion
|
|
|
|
run: |
|
|
|
|
make backend-assets/grpc/stablediffusion
|
|
|
|
mkdir -p release && cp backend-assets/grpc/stablediffusion release
|
2024-04-11 14:44:02 +00:00
|
|
|
- uses: actions/upload-artifact@v4
|
2024-02-25 23:06:18 +00:00
|
|
|
with:
|
|
|
|
name: stablediffusion
|
|
|
|
path: release/
|
|
|
|
|
2023-05-23 15:12:48 +00:00
|
|
|
build-macOS:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- build: 'avx2'
|
|
|
|
defines: ''
|
|
|
|
- build: 'avx'
|
|
|
|
defines: '-DLLAMA_AVX2=OFF'
|
|
|
|
- build: 'avx512'
|
|
|
|
defines: '-DLLAMA_AVX512=ON'
|
|
|
|
runs-on: macOS-latest
|
|
|
|
steps:
|
|
|
|
- name: Clone
|
2023-10-21 06:55:44 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-05-29 21:11:29 +00:00
|
|
|
with:
|
2023-05-23 15:12:48 +00:00
|
|
|
submodules: true
|
2024-04-11 13:10:32 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-08-23 23:18:58 +00:00
|
|
|
with:
|
2024-03-29 21:32:40 +00:00
|
|
|
go-version: '1.21.x'
|
|
|
|
cache: false
|
2023-10-16 19:46:29 +00:00
|
|
|
- name: Dependencies
|
|
|
|
run: |
|
2023-12-26 18:19:37 +00:00
|
|
|
brew install protobuf grpc
|
2023-05-23 15:12:48 +00:00
|
|
|
- name: Build
|
|
|
|
id: build
|
|
|
|
env:
|
2023-05-29 21:11:29 +00:00
|
|
|
CMAKE_ARGS: "${{ matrix.defines }}"
|
2023-05-23 15:12:48 +00:00
|
|
|
BUILD_ID: "${{ matrix.build }}"
|
|
|
|
run: |
|
2023-10-16 19:46:29 +00:00
|
|
|
export C_INCLUDE_PATH=/usr/local/include
|
|
|
|
export CPLUS_INCLUDE_PATH=/usr/local/include
|
2023-05-23 15:12:48 +00:00
|
|
|
make dist
|
2024-04-11 14:44:02 +00:00
|
|
|
- uses: actions/upload-artifact@v4
|
2023-05-23 15:12:48 +00:00
|
|
|
with:
|
2024-04-11 16:26:03 +00:00
|
|
|
name: LocalAI-MacOS-${{ matrix.build }}
|
2023-05-23 15:12:48 +00:00
|
|
|
path: release/
|
|
|
|
- name: Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
|
|
|
files: |
|
2024-02-13 08:35:39 +00:00
|
|
|
release/*
|
2024-04-11 17:22:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
build-macOS-arm64:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- build: 'avx2'
|
|
|
|
defines: ''
|
|
|
|
- build: 'avx'
|
|
|
|
defines: '-DLLAMA_AVX2=OFF'
|
|
|
|
- build: 'avx512'
|
|
|
|
defines: '-DLLAMA_AVX512=ON'
|
|
|
|
runs-on: macos-14
|
|
|
|
steps:
|
|
|
|
- name: Clone
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
- uses: actions/setup-go@v5
|
|
|
|
with:
|
|
|
|
go-version: '1.21.x'
|
|
|
|
cache: false
|
|
|
|
- name: Dependencies
|
|
|
|
run: |
|
|
|
|
brew install protobuf grpc
|
|
|
|
- name: Build
|
|
|
|
id: build
|
|
|
|
env:
|
|
|
|
CMAKE_ARGS: "${{ matrix.defines }}"
|
|
|
|
BUILD_ID: "${{ matrix.build }}"
|
|
|
|
run: |
|
|
|
|
export C_INCLUDE_PATH=/usr/local/include
|
|
|
|
export CPLUS_INCLUDE_PATH=/usr/local/include
|
|
|
|
make dist
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: LocalAI-MacOS-arm64-${{ matrix.build }}
|
|
|
|
path: release/
|
|
|
|
- name: Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
release/*
|