Merge pull request #140 from janhq/update-submodule-2024-07-11-17-06 #17
Workflow file for this run
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 Nightly Build | |
on: | |
push: | |
tags: ["v[0-9]+.[0-9]+.[0-9]+-[0-9]+.[0-9]+.[0-9]+"] | |
paths: | |
[ | |
".github/scripts/**", | |
".github/workflows/build.yml", | |
"**/CMakeLists.txt", | |
"**/Makefile", | |
"**/*.h", | |
"**/*.hpp", | |
"**/*.c", | |
"**/*.cpp", | |
"**/*.cu", | |
"**/*.cc", | |
"**/*.cxx", | |
"llama.cpp", | |
"!docs/**", | |
"!.gitignore", | |
"!README.md", | |
] | |
workflow_dispatch: | |
env: | |
LLM_MODEL_URL: https://delta.jan.ai/tinyllama-1.1b-chat-v0.3.Q2_K.gguf | |
EMBEDDING_MODEL_URL: https://catalog.jan.ai/dist/models/embeds/nomic-embed-text-v1.5.f16.gguf | |
jobs: | |
create-draft-release: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
version: ${{ steps.get_version.outputs.version }} | |
permissions: | |
contents: write | |
steps: | |
- name: Extract tag name without v prefix | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV && echo "::set-output name=version::${GITHUB_REF#refs/tags/v}" | |
env: | |
GITHUB_REF: ${{ github.ref }} | |
- name: Create Draft Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ github.ref_name }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: "${{ env.VERSION }}" | |
draft: false | |
generate_release_notes: true | |
prerelease: true | |
build-and-test: | |
runs-on: ${{ matrix.runs-on }} | |
needs: [create-draft-release] | |
timeout-minutes: 60 | |
strategy: | |
matrix: | |
include: | |
- os: "linux" | |
name: "amd64-avx2" | |
runs-on: "ubuntu-20-04" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja" | |
run-e2e: true | |
vulkan: false | |
sccache: true | |
sccache-conf-path: "/tmp/sccache.conf" | |
- os: "linux" | |
name: "amd64-noavx" | |
runs-on: "ubuntu-20-04" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DGGML_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: "/tmp/sccache.conf" | |
- os: "linux" | |
name: "amd64-avx" | |
runs-on: "ubuntu-20-04" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_AVX2=OFF -DGGML_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: "/tmp/sccache.conf" | |
- os: "linux" | |
name: "amd64-avx512" | |
runs-on: "ubuntu-20-04" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_AVX512=ON -DGGML_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: "/tmp/sccache.conf" | |
- os: "linux" | |
name: "amd64-vulkan" | |
runs-on: "ubuntu-20-04-cuda-11-7" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_VULKAN=ON -DGGML_NATIVE=OFF -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja" | |
run-e2e: false | |
vulkan: true | |
sccache: true | |
sccache-conf-path: "/tmp/sccache.conf" | |
- os: "linux" | |
name: "amd64-avx2-cuda-11-7" | |
runs-on: "ubuntu-20-04-cuda-11-7" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: "/tmp/sccache.conf" | |
- os: "linux" | |
name: "amd64-avx-cuda-11-7" | |
runs-on: "ubuntu-20-04-cuda-11-7" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_AVX2=OFF -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: "/tmp/sccache.conf" | |
- os: "linux" | |
name: "amd64-avx512-cuda-11-7" | |
runs-on: "ubuntu-20-04-cuda-11-7" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_AVX512=ON -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: "/tmp/sccache.conf" | |
- os: "linux" | |
name: "amd64-avx2-cuda-12-0" | |
runs-on: "ubuntu-20-04-cuda-12-0" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: "/tmp/sccache.conf" | |
- os: "linux" | |
name: "amd64-avx-cuda-12-0" | |
runs-on: "ubuntu-20-04-cuda-12-0" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_AVX2=OFF -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: "/tmp/sccache.conf" | |
- os: "linux" | |
name: "amd64-avx512-cuda-12-0" | |
runs-on: "ubuntu-20-04-cuda-12-0" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_AVX512=ON -DGGML_NATIVE=OFF -DGGML_CUDA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_BUILD_TYPE='Release' -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: "/tmp/sccache.conf" | |
- os: "mac" | |
name: "amd64" | |
runs-on: "macos-13" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_METAL=OFF" | |
run-e2e: true | |
vulkan: false | |
sccache: false | |
sccache-conf-path: "" | |
- os: "mac" | |
name: "arm64" | |
runs-on: "macos-latest" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DGGML_METAL_EMBED_LIBRARY=ON" | |
run-e2e: false | |
vulkan: false | |
sccache: false | |
sccache-conf-path: "" | |
- os: "windows" | |
name: "amd64-avx2" | |
runs-on: "windows-2019" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE='Release' -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -GNinja" | |
run-e2e: true | |
vulkan: false | |
sccache: false | |
sccache-conf-path: "" | |
- os: "windows" | |
name: "amd64-avx" | |
runs-on: "windows-2019" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DGGML_AVX2=OFF -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE='Release' -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -GNinja" | |
run-e2e: true | |
vulkan: false | |
sccache: false | |
sccache-conf-path: "" | |
- os: "windows" | |
name: "amd64-avx512" | |
runs-on: "windows-2019" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DGGML_AVX512=ON -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DLLAMA_BLAS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE='Release' -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: false | |
sccache-conf-path: "" | |
- os: "windows" | |
name: "amd64-vulkan" | |
runs-on: "windows-2019" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DGGML_VULKAN=ON -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE='Release' -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl -GNinja" | |
run-e2e: false | |
vulkan: true | |
sccache: false | |
sccache-conf-path: "" | |
- os: "windows" | |
name: "amd64-avx2-cuda-12-0" | |
runs-on: "windows-cuda-12-0" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_CUDA=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE='Release' -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CUDA_COMPILER_LAUNCHER=sccache -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: 'C:\sccache.conf' | |
- os: "windows" | |
name: "amd64-avx-cuda-12-0" | |
runs-on: "windows-cuda-12-0" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DGGML_AVX2=OFF -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_CUDA=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE='Release' -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CUDA_COMPILER_LAUNCHER=sccache -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: 'C:\sccache.conf' | |
- os: "windows" | |
name: "amd64-avx512-cuda-12-0" | |
runs-on: "windows-cuda-12-0" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DGGML_AVX512=ON -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_CUDA=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE='Release' -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CUDA_COMPILER_LAUNCHER=sccache -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: 'C:\sccache.conf' | |
- os: "windows" | |
name: "amd64-avx2-cuda-11-7" | |
runs-on: "windows-cuda-11-7" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_CUDA=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE='Release' -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CUDA_COMPILER_LAUNCHER=sccache -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: 'C:\sccache.conf' | |
- os: "windows" | |
name: "amd64-avx-cuda-11-7" | |
runs-on: "windows-cuda-11-7" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DGGML_AVX2=OFF -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_CUDA=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE='Release' -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CUDA_COMPILER_LAUNCHER=sccache -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: 'C:\sccache.conf' | |
- os: "windows" | |
name: "amd64-avx512-cuda-11-7" | |
runs-on: "windows-cuda-11-7" | |
cmake-flags: "-DCORTEXLLAMA_VERSION=${{needs.create-draft-release.outputs.version}} -DGGML_AVX512=ON -DGGML_NATIVE=OFF -DLLAMA_BUILD_SERVER=ON -DGGML_CUDA=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE='Release' -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CUDA_COMPILER_LAUNCHER=sccache -GNinja" | |
run-e2e: false | |
vulkan: false | |
sccache: true | |
sccache-conf-path: 'C:\sccache.conf' | |
steps: | |
- name: Clone | |
id: checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Prepare Vulkan SDK | |
if: ${{ matrix.vulkan }} | |
uses: humbletim/[email protected] | |
with: | |
vulkan-query-version: 1.3.275.0 | |
vulkan-components: Vulkan-Headers, Vulkan-Loader | |
vulkan-use-cache: true | |
- name: create sccache.conf | |
if: ${{ matrix.sccache }} | |
run: | | |
echo "[cache.s3]" > ${{ matrix.sccache-conf-path }} | |
echo 'bucket = "${{ secrets.MINIO_BUCKET_NAME }}"' >> ${{ matrix.sccache-conf-path }} | |
echo 'endpoint = "${{ secrets.MINIO_ENDPOINT }}"' >> ${{ matrix.sccache-conf-path }} | |
echo 'key_prefix = "${{ matrix.os }}-${{ matrix.name }}"' >> ${{ matrix.sccache-conf-path }} | |
echo 'use_ssl = false' >> ${{ matrix.sccache-conf-path }} | |
echo 'server_side_encryption = false' >> ${{ matrix.sccache-conf-path }} | |
echo 'no_credentials = false' >> ${{ matrix.sccache-conf-path }} | |
- name: Get Cer for code signing | |
if: runner.os == 'macOS' | |
run: base64 -d <<< "$CODE_SIGN_P12_BASE64" > /tmp/codesign.p12 | |
shell: bash | |
env: | |
CODE_SIGN_P12_BASE64: ${{ secrets.CODE_SIGN_P12_BASE64 }} | |
- uses: apple-actions/import-codesign-certs@v2 | |
if: runner.os == 'macOS' | |
with: | |
p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }} | |
p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }} | |
- uses: actions/setup-dotnet@v3 | |
if: runner.os == 'Windows' | |
with: | |
dotnet-version: "8.0.x" | |
- name: Install choco on Windows | |
if: runner.os == 'Windows' | |
run: | | |
choco install make sccache ninja -y | |
- name: Install ninja build on Linux | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt install ninja-build -y | |
- name: Add msbuild to PATH | |
if: runner.os == 'Windows' | |
uses: ilammy/[email protected] | |
- name: start scache server | |
if: ${{ matrix.sccache }} | |
run: | | |
sccache --start-server | |
env: | |
SCCACHE_BUCKET: "${{ secrets.MINIO_BUCKET_NAME }}" | |
SCCACHE_REGION: "${{ secrets.MINIO_REGION }}" | |
SCCACHE_ENDPOINT: "${{ secrets.MINIO_ENDPOINT }}" | |
SCCACHE_S3_USE_SSL: "false" | |
SCCACHE_S3_SERVER_SIDE_ENCRYPTION: "false" | |
SCCACHE_S3_KEY_PREFIX: "${{ matrix.os }}-${{ matrix.name }}" | |
SCCACHE_LOG: "debug" | |
SCCACHE_CONF: '${{ matrix.sccache-conf-path }}' | |
AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}" | |
AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}" | |
SCCACHE_IDLE_TIMEOUT: "0" | |
- name: Build | |
run: | | |
make build-example-server CMAKE_EXTRA_FLAGS="${{ matrix.cmake-flags }}" | |
- name: Pre Package | |
run: | | |
make pre-package | |
- name: Code Signing macOS | |
if: runner.os == 'macOS' | |
run: | | |
make codesign CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}" | |
- name: Code Signing Windows | |
if: runner.os == 'Windows' | |
shell: cmd | |
run: | | |
set PATH=%PATH%;%USERPROFILE%\.dotnet\tools | |
make codesign CODE_SIGN=true AZURE_KEY_VAULT_URI="${{ secrets.AZURE_KEY_VAULT_URI }}" AZURE_CLIENT_ID="${{ secrets.AZURE_CLIENT_ID }}" AZURE_TENANT_ID="${{ secrets.AZURE_TENANT_ID }}" AZURE_CLIENT_SECRET="${{ secrets.AZURE_CLIENT_SECRET }}" AZURE_CERT_NAME="${{ secrets.AZURE_CERT_NAME }}" | |
- name: Package | |
run: | | |
make package | |
- name: Run e2e testing | |
if: ${{ matrix.run-e2e }} | |
run: | | |
make run-e2e-test LLM_MODEL_URL=${{ env.LLM_MODEL_URL }} EMBEDDING_MODEL_URL=${{ env.EMBEDDING_MODEL_URL }} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: cortex.llamacpp-${{ matrix.os }}-${{ matrix.name }} | |
path: ./cortex.llamacpp | |
- uses: actions/[email protected] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create-draft-release.outputs.upload_url }} | |
asset_path: ./cortex.llamacpp.tar.gz | |
asset_name: cortex.llamacpp-${{ needs.create-draft-release.outputs.version }}-${{ matrix.os }}-${{ matrix.name }}.tar.gz | |
asset_content_type: application/gzip | |
- name: Clean | |
if: always() | |
continue-on-error: true | |
run: | | |
sccache --stop-server | |
rm ${{ matrix.sccache-conf-path }} |