Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit b67e373

Browse files
committed
Linux add local installer
1 parent 1d1104e commit b67e373

File tree

7 files changed

+109
-7
lines changed

7 files changed

+109
-7
lines changed

.github/workflows/beta-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
cmake-flags: "-DCORTEX_VARIANT=beta -DCORTEX_CPP_VERSION='v${{ needs.get-update-version.outputs.new_version }}' -DCMAKE_TOOLCHAIN_FILE=/home/runner/actions-runner/_work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
9393
channel: beta
9494
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
95+
cortex-llamacpp-version: ${{ needs.get-cortex-llamacpp-latest-version.outputs.cortex_llamacpp_latest_version }}
9596

9697
update_release_draft:
9798
needs: [build-macos-x64, build-macos-arm64, build-windows-x64, build-linux-x64]

.github/workflows/nightly-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ jobs:
9898
runs-on: ubuntu-20-04
9999
cmake-flags: "-DCORTEX_VARIANT=nightly -DCORTEX_CPP_VERSION='v${{ needs.get-update-version.outputs.new_version }}' -DCMAKE_TOOLCHAIN_FILE=/home/runner/actions-runner/_work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
100100
channel: nightly
101+
cortex-llamacpp-version: ${{ needs.get-cortex-llamacpp-latest-version.outputs.cortex_llamacpp_latest_version }}
101102

102103
update-latest-version:
103104
runs-on: ubuntu-latest

.github/workflows/stable-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ jobs:
9292
cmake-flags: "-DCORTEX_VARIANT=prod -DCORTEX_CPP_VERSION='v${{ needs.get-update-version.outputs.new_version }}' -DCMAKE_TOOLCHAIN_FILE=/home/runner/actions-runner/_work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
9393
channel: stable
9494
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
95+
cortex-llamacpp-version: ${{ needs.get-cortex-llamacpp-latest-version.outputs.cortex_llamacpp_latest_version }}
9596

9697
update_release_draft:
9798
needs: [build-macos-x64, build-macos-arm64, build-windows-x64, build-linux-x64]

.github/workflows/template-build-linux-x64.yml

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ on:
4444
type: string
4545
default: 'nightly'
4646
description: 'The channel to use for this job'
47+
cortex-llamacpp-version:
48+
required: true
49+
type: string
50+
default: '0.0.0'
51+
description: 'The version of cortex-llamacpp to use for this job'
4752
secrets:
4853
DELTA_AWS_S3_BUCKET_NAME:
4954
required: false
@@ -128,11 +133,41 @@ jobs:
128133
cd engine
129134
make pre-package DESTINATION_BINARY_NAME="${{ steps.set-output-params.outputs.destination_binary_name }}"
130135
131-
- name: Build Installers
136+
- name: Build network Installers
132137
shell: bash
133138
run: |
134139
cd engine
135140
make build-installer PACKAGE_NAME="${{ steps.set-output-params.outputs.package_name }}" SOURCE_BINARY_PATH="../../cortex/${{ steps.set-output-params.outputs.destination_binary_name }}" VERSION=${{ inputs.new_version }} DESTINATION_BINARY_NAME="${{ steps.set-output-params.outputs.destination_binary_name }}" DATA_FOLDER_NAME="${{ steps.set-output-params.outputs.data_folder_name }}" CONFIGURATION_FILE_NAME="${{ steps.set-output-params.outputs.configuration_file_name }}" UNINSTALLER_FILE_NAME="${{ steps.set-output-params.outputs.uninstaller_file_name }}"
141+
mv ${{ steps.set-output-params.outputs.package_name }}.deb ${{ steps.set-output-params.outputs.package_name }}-network.deb
142+
143+
- name: Build local Installers
144+
run: |
145+
mkdir -p engine/templates/linux/dependencies
146+
cd engine/templates/linux/dependencies
147+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-avx-cuda-11-7.tar.gz
148+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-avx-cuda-12-0.tar.gz
149+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-avx.tar.gz
150+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-avx2-cuda-11-7.tar.gz
151+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-avx2-cuda-12-0.tar.gz
152+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-avx2.tar.gz
153+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-avx512-cuda-11-7.tar.gz
154+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-avx512-cuda-12-0.tar.gz
155+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-avx512.tar.gz
156+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-noavx-cuda-11-7.tar.gz
157+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-noavx-cuda-12-0.tar.gz
158+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-noavx.tar.gz
159+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-linux-amd64-vulkan.tar.gz
160+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cuda-11-7-linux-amd64.tar.gz
161+
wget https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cuda-12-0-linux-amd64.tar.gz
162+
cd ..
163+
164+
# Remove network package
165+
ls -al
166+
rm -rf ${{ steps.set-output-params.outputs.package_name }}
167+
rm ${{ steps.set-output-params.outputs.package_name }}.deb
168+
chmod +x create_deb_local.sh
169+
./create_deb_local.sh ${{ steps.set-output-params.outputs.package_name }} ${{ inputs.new_version }} ../../cortex/${{ steps.set-output-params.outputs.destination_binary_name }} ${{ steps.set-output-params.outputs.destination_binary_name }} ${{ steps.set-output-params.outputs.data_folder_name }} ${{ steps.set-output-params.outputs.configuration_file_name }};
170+
cp ${{ steps.set-output-params.outputs.package_name }}.deb ../../${{ steps.set-output-params.outputs.package_name }}-local.deb
136171
137172
- name: Package
138173
run: |
@@ -148,16 +183,23 @@ jobs:
148183
- name: Upload Artifact
149184
uses: actions/upload-artifact@v4
150185
with:
151-
name: cortex-${{ inputs.new_version }}-linux-amd64-installer
152-
path: ./engine/${{ steps.set-output-params.outputs.package_name }}.deb
186+
name: cortex-${{ inputs.new_version }}-linux-amd64-network-installer
187+
path: ./engine/${{ steps.set-output-params.outputs.package_name }}-network.deb
188+
189+
- name: Upload Artifact
190+
uses: actions/upload-artifact@v4
191+
with:
192+
name: cortex-${{ inputs.new_version }}-linux-amd64-local-installer
193+
path: ./engine/${{ steps.set-output-params.outputs.package_name }}-local.deb
153194

154195
- name: upload to aws s3 if public provider is aws
155196
if: inputs.public_provider == 'aws-s3'
156197
run: |
157198
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/temp-latest/linux-amd64-cortex-nightly.tar.gz
158199
159200
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/v${{ inputs.new_version }}/linux-amd64/cortex-nightly.tar.gz
160-
aws s3 cp ./engine/${{ steps.set-output-params.outputs.package_name }}.deb s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/v${{ inputs.new_version }}/linux-amd64/cortex-${{ inputs.new_version }}-linux-amd64-installer.deb
201+
aws s3 cp ./engine/${{ steps.set-output-params.outputs.package_name }}-network.deb s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/v${{ inputs.new_version }}/linux-amd64/cortex-${{ inputs.new_version }}-linux-amd64-network-installer.deb
202+
aws s3 cp ./engine/${{ steps.set-output-params.outputs.package_name }}-local.deb s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/v${{ inputs.new_version }}/linux-amd64/cortex-${{ inputs.new_version }}-linux-amd64-local-installer.deb
161203
env:
162204
AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
163205
AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
@@ -182,6 +224,17 @@ jobs:
182224
uses: actions/upload-release-asset@v1.0.1
183225
with:
184226
upload_url: ${{ inputs.upload_url }}
185-
asset_path: ./engine/${{ steps.set-output-params.outputs.package_name }}.deb
186-
asset_name: cortex-${{ inputs.new_version }}-linux-amd64-installer.deb
227+
asset_path: ./engine/${{ steps.set-output-params.outputs.package_name }}-network.deb
228+
asset_name: cortex-${{ inputs.new_version }}-linux-amd64-network-installer.deb
229+
asset_content_type: application/octet-stream
230+
231+
- name: Upload release assert if public provider is github
232+
if: inputs.public_provider == 'github'
233+
env:
234+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
235+
uses: actions/upload-release-asset@v1.0.1
236+
with:
237+
upload_url: ${{ inputs.upload_url }}
238+
asset_path: ./engine/${{ steps.set-output-params.outputs.package_name }}-local.deb
239+
asset_name: cortex-${{ inputs.new_version }}-linux-amd64-local-installer.deb
187240
asset_content_type: application/octet-stream

.github/workflows/template-noti-discord.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ jobs:
3131
- Local Installer: https://delta.jan.ai/cortex/v{{ VERSION }}/windows-amd64/cortex-{{ VERSION }}-windows-amd64-local-installer.exe
3232
- macOS Intel: https://delta.jan.ai/cortex/v{{ VERSION }}/mac-amd64/cortex-{{ VERSION }}-mac-amd64-installer.pkg
3333
- macOS Apple Silicon: https://delta.jan.ai/cortex/v{{ VERSION }}/mac-arm64/cortex-{{ VERSION }}-mac-arm64-installer.pkg
34-
- Linux Deb: https://delta.jan.ai/cortex/v{{ VERSION }}/linux-amd64/cortex-{{ VERSION }}-linux-amd64-installer.deb
34+
- Linux Deb:
35+
- Network Installer: https://delta.jan.ai/cortex/v{{ VERSION }}/linux-amd64/cortex-{{ VERSION }}-linux-amd64-network-installer.deb
36+
- Local Installer: https://delta.jan.ai/cortex/v{{ VERSION }}/linux-amd64/cortex-{{ VERSION }}-linux-amd64-local-installer.deb
3537
- Github action run: https://github.com/janhq/cortex.cpp/actions/runs/{{ GITHUB_RUN_ID }}
3638
env:
3739
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
PACKAGE_NAME=$1
2+
VERSION=$2
3+
SOURCE_BINARY_PATH=$3
4+
DESTINATION_BINARY_NAME=$4
5+
DATA_FOLDER_NAME=$5
6+
CONFIGURATION_FILE_NAME=$6
7+
8+
mkdir -p $PACKAGE_NAME/DEBIAN
9+
10+
mkdir -p $PACKAGE_NAME/usr/bin
11+
cp $SOURCE_BINARY_PATH $PACKAGE_NAME/usr/bin/$DESTINATION_BINARY_NAME
12+
13+
mkdir -p $PACKAGE_NAME/tmp/$DESTINATION_BINARY_NAME-dependencies
14+
cp dependencies/* $PACKAGE_NAME/tmp/$DESTINATION_BINARY_NAME-dependencies
15+
16+
export DESTINATION_BINARY_NAME
17+
18+
cp postinst_local $PACKAGE_NAME/DEBIAN/postinst
19+
sed -i "2s/.*/DESTINATION_BINARY_NAME=$DESTINATION_BINARY_NAME/" $PACKAGE_NAME/DEBIAN/postinst
20+
21+
cp prerm $PACKAGE_NAME/DEBIAN/prerm
22+
sed -i "3s/.*/DESTINATION_BINARY_NAME=$DESTINATION_BINARY_NAME/" $PACKAGE_NAME/DEBIAN/prerm
23+
24+
export DATA_FOLDER_NAME CONFIGURATION_FILE_NAME
25+
26+
cp postrm $PACKAGE_NAME/DEBIAN/postrm
27+
sed -i "3s/.*/DATA_FOLDER_NAME=$DATA_FOLDER_NAME/" $PACKAGE_NAME/DEBIAN/postrm
28+
sed -i "4s/.*/CONFIGURATION_FILE_NAME=$CONFIGURATION_FILE_NAME/" $PACKAGE_NAME/DEBIAN/postrm
29+
30+
chmod 755 $PACKAGE_NAME/DEBIAN/postinst
31+
chmod 755 $PACKAGE_NAME/DEBIAN/postrm
32+
chmod 755 $PACKAGE_NAME/DEBIAN/prerm
33+
34+
export PACKAGE_NAME VERSION
35+
36+
envsubst < control > $PACKAGE_NAME/DEBIAN/control
37+
38+
dpkg-deb --build $PACKAGE_NAME $PACKAGE_NAME.deb
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
DESTINATION_BINARY_NAME=cortex
3+
USER_TO_RUN_AS=${SUDO_USER:-$(whoami)}
4+
echo "Download cortex.llamacpp engines by default for user $USER_TO_RUN_AS"
5+
sudo -u $USER_TO_RUN_AS /usr/bin/$DESTINATION_BINARY_NAME --verbose engines install cortex.llamacpp -s /tmp/$DESTINATION_BINARY_NAME-dependencies
6+
rm -rf /tmp/$DESTINATION_BINARY_NAME-dependencies

0 commit comments

Comments
 (0)