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

Commit 3320218

Browse files
authored
Windows add local installer (#1324)
1 parent 9707a3b commit 3320218

10 files changed

+472
-28
lines changed

.github/workflows/beta-build.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
get-update-version:
1010
uses: ./.github/workflows/template-get-update-version.yml
1111

12+
get-cortex-llamacpp-latest-version:
13+
uses: ./.github/workflows/template-cortex-llamacpp-latest-version.yml
14+
1215
create-draft-release:
1316
runs-on: ubuntu-latest
1417
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
@@ -35,7 +38,7 @@ jobs:
3538

3639
build-macos-x64:
3740
uses: ./.github/workflows/template-build-macos.yml
38-
needs: [get-update-version, create-draft-release]
41+
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
3942
secrets: inherit
4043
with:
4144
ref: ${{ github.ref }}
@@ -49,7 +52,7 @@ jobs:
4952

5053
build-macos-arm64:
5154
uses: ./.github/workflows/template-build-macos.yml
52-
needs: [get-update-version, create-draft-release]
55+
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
5356
secrets: inherit
5457
with:
5558
ref: ${{ github.ref }}
@@ -64,7 +67,7 @@ jobs:
6467
build-windows-x64:
6568
uses: ./.github/workflows/template-build-windows-x64.yml
6669
secrets: inherit
67-
needs: [get-update-version, create-draft-release]
70+
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
6871
with:
6972
ref: ${{ github.ref }}
7073
public_provider: github
@@ -75,11 +78,12 @@ jobs:
7578
ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
7679
channel: beta
7780
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
81+
cortex-llamacpp-version: ${{ needs.get-cortex-llamacpp-latest-version.outputs.cortex_llamacpp_latest_version }}
7882

7983
build-linux-x64:
8084
uses: ./.github/workflows/template-build-linux-x64.yml
8185
secrets: inherit
82-
needs: [get-update-version, create-draft-release]
86+
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
8387
with:
8488
ref: ${{ github.ref }}
8589
public_provider: github

.github/workflows/nightly-build.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,12 @@ jobs:
4343
get-update-version:
4444
uses: ./.github/workflows/template-get-update-version.yml
4545

46+
get-cortex-llamacpp-latest-version:
47+
uses: ./.github/workflows/template-cortex-llamacpp-latest-version.yml
48+
4649
build-macos-x64:
4750
uses: ./.github/workflows/template-build-macos.yml
48-
needs: [get-update-version, set-public-provider]
51+
needs: [get-update-version, set-public-provider, get-cortex-llamacpp-latest-version]
4952
secrets: inherit
5053
with:
5154
ref: ${{ needs.set-public-provider.outputs.ref }}
@@ -58,7 +61,7 @@ jobs:
5861

5962
build-macos-arm64:
6063
uses: ./.github/workflows/template-build-macos.yml
61-
needs: [get-update-version, set-public-provider]
64+
needs: [get-update-version, set-public-provider, get-cortex-llamacpp-latest-version]
6265
secrets: inherit
6366
with:
6467
ref: ${{ needs.set-public-provider.outputs.ref }}
@@ -72,7 +75,7 @@ jobs:
7275
build-windows-x64:
7376
uses: ./.github/workflows/template-build-windows-x64.yml
7477
secrets: inherit
75-
needs: [get-update-version, set-public-provider]
78+
needs: [get-update-version, set-public-provider, get-cortex-llamacpp-latest-version]
7679
with:
7780
ref: ${{ needs.set-public-provider.outputs.ref }}
7881
public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
@@ -82,11 +85,12 @@ jobs:
8285
build-deps-cmake-flags: "-DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
8386
ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
8487
channel: nightly
88+
cortex-llamacpp-version: ${{ needs.get-cortex-llamacpp-latest-version.outputs.cortex_llamacpp_latest_version }}
8589

8690
build-linux-x64:
8791
uses: ./.github/workflows/template-build-linux-x64.yml
8892
secrets: inherit
89-
needs: [get-update-version, set-public-provider]
93+
needs: [get-update-version, set-public-provider, get-cortex-llamacpp-latest-version]
9094
with:
9195
ref: ${{ needs.set-public-provider.outputs.ref }}
9296
public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
@@ -98,7 +102,7 @@ jobs:
98102
update-latest-version:
99103
runs-on: ubuntu-latest
100104
if: needs.set-public-provider.outputs.public_provider == 'aws-s3'
101-
needs: [get-update-version, set-public-provider, build-linux-x64, build-macos-x64, build-macos-arm64, build-windows-x64]
105+
needs: [get-update-version, set-public-provider, build-linux-x64, build-macos-x64, build-macos-arm64, build-windows-x64, get-cortex-llamacpp-latest-version]
102106
steps:
103107
- name: Update latest version
104108
id: update-latest-version
@@ -117,7 +121,7 @@ jobs:
117121
AWS_EC2_METADATA_DISABLED: "true"
118122

119123
noti-discord-nightly-and-update-url-readme:
120-
needs: [build-macos-x64, build-macos-arm64, build-windows-x64, build-linux-x64, get-update-version, set-public-provider]
124+
needs: [build-macos-x64, build-macos-arm64, build-windows-x64, build-linux-x64, get-update-version, set-public-provider, get-cortex-llamacpp-latest-version]
121125
secrets: inherit
122126
if: github.event_name == 'schedule'
123127
uses: ./.github/workflows/template-noti-discord.yaml
@@ -126,7 +130,7 @@ jobs:
126130
new_version: ${{ needs.get-update-version.outputs.new_version }}
127131

128132
noti-discord-manual:
129-
needs: [build-macos-x64, build-macos-arm64, build-windows-x64, build-linux-x64, get-update-version, set-public-provider]
133+
needs: [build-macos-x64, build-macos-arm64, build-windows-x64, build-linux-x64, get-update-version, set-public-provider, get-cortex-llamacpp-latest-version]
130134
secrets: inherit
131135
if: github.event_name == 'workflow_dispatch' && github.event.inputs.public_provider == 'aws-s3'
132136
uses: ./.github/workflows/template-noti-discord.yaml

.github/workflows/stable-build.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
get-update-version:
1010
uses: ./.github/workflows/template-get-update-version.yml
1111

12+
get-cortex-llamacpp-latest-version:
13+
uses: ./.github/workflows/template-cortex-llamacpp-latest-version.yml
14+
1215
create-draft-release:
1316
runs-on: ubuntu-latest
1417
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
@@ -35,7 +38,7 @@ jobs:
3538

3639
build-macos-x64:
3740
uses: ./.github/workflows/template-build-macos.yml
38-
needs: [get-update-version, create-draft-release]
41+
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
3942
secrets: inherit
4043
with:
4144
ref: ${{ github.ref }}
@@ -49,7 +52,7 @@ jobs:
4952

5053
build-macos-arm64:
5154
uses: ./.github/workflows/template-build-macos.yml
52-
needs: [get-update-version, create-draft-release]
55+
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
5356
secrets: inherit
5457
with:
5558
ref: ${{ github.ref }}
@@ -64,7 +67,7 @@ jobs:
6467
build-windows-x64:
6568
uses: ./.github/workflows/template-build-windows-x64.yml
6669
secrets: inherit
67-
needs: [get-update-version, create-draft-release]
70+
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
6871
with:
6972
ref: ${{ github.ref }}
7073
public_provider: github
@@ -75,11 +78,12 @@ jobs:
7578
ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
7679
channel: stable
7780
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
81+
cortex-llamacpp-version: ${{ needs.get-cortex-llamacpp-latest-version.outputs.cortex_llamacpp_latest_version }}
7882

7983
build-linux-x64:
8084
uses: ./.github/workflows/template-build-linux-x64.yml
8185
secrets: inherit
82-
needs: [get-update-version, create-draft-release]
86+
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
8387
with:
8488
ref: ${{ github.ref }}
8589
public_provider: github

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

Lines changed: 71 additions & 10 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
MINIO_BUCKET_NAME:
4954
required: false
@@ -104,6 +109,7 @@ jobs:
104109
echo "::set-output name=configuration_file_name::.cortexrc"
105110
echo "::set-output name=uninstaller_file_name::cortex-uninstall.sh"
106111
echo "::set-output name=iss_file_name::installer.iss"
112+
echo "::set-output name=local_iss_file_name::local-installer.iss"
107113
fi
108114
109115
# Set output for beta channel
@@ -114,6 +120,7 @@ jobs:
114120
echo "::set-output name=configuration_file_name::.cortexrc-beta"
115121
echo "::set-output name=uninstaller_file_name::cortex-beta-uninstall.sh"
116122
echo "::set-output name=iss_file_name::installer-beta.iss"
123+
echo "::set-output name=local_iss_file_name::local-installer-beta.iss"
117124
fi
118125
119126
# Set output for nightly channel
@@ -124,14 +131,15 @@ jobs:
124131
echo "::set-output name=configuration_file_name::.cortexrc-nightly"
125132
echo "::set-output name=uninstaller_file_name::cortex-nightly-uninstall.sh"
126133
echo "::set-output name=iss_file_name::installer-nightly.iss"
134+
echo "::set-output name=local_iss_file_name::local-installer-nightly.iss"
127135
fi
128136
129137
- name: Install jq
130138
uses: dcarbone/install-jq-action@v2.0.1
131139

132140
- name: Install dependencies on Windows
133141
run: |
134-
choco install make pkgconfiglite ccache awscli 7zip ninja -y
142+
choco install make pkgconfiglite ccache awscli 7zip ninja wget -y
135143
dotnet tool install --global AzureSignTool
136144
137145
- name: Download ccache from s3
@@ -171,30 +179,65 @@ jobs:
171179
run: |
172180
cd engine/templates/windows
173181
sed -i "s/AppVersion=1.0/AppVersion=${{ inputs.new_version }}/g" ${{ steps.set-output-params.outputs.iss_file_name }}
182+
sed -i "s/AppVersion=1.0/AppVersion=${{ inputs.new_version }}/g" ${{ steps.set-output-params.outputs.local_iss_file_name }}
174183
cat ${{ steps.set-output-params.outputs.iss_file_name }}
175184
cp ${{ steps.set-output-params.outputs.iss_file_name }} ../../../
185+
cp ${{ steps.set-output-params.outputs.local_iss_file_name }} ../../../
176186
ls ../../../
177187
178-
- name: Build Installers
188+
- name: Build network Installers
179189
shell: bash
180190
run: |
181191
cd engine
182192
make build-installer PACKAGE_NAME=${{ steps.set-output-params.outputs.package_name }} VERSION=${{ inputs.new_version }} DESTINATION_BINARY_NAME="${{ steps.set-output-params.outputs.destination_binary_name }}"
183193
ls ../
184194
195+
- name: Build local Installers
196+
shell: powershell
197+
run: |
198+
mkdir dependencies
199+
cd dependencies
200+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-avx-cuda-11-7.tar.gz
201+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-avx-cuda-12-0.tar.gz
202+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-avx.tar.gz
203+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-avx2-cuda-11-7.tar.gz
204+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-avx2-cuda-12-0.tar.gz
205+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-avx2.tar.gz
206+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-avx512-cuda-11-7.tar.gz
207+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-avx512-cuda-12-0.tar.gz
208+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-avx512.tar.gz
209+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-noavx-cuda-11-7.tar.gz
210+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-noavx-cuda-12-0.tar.gz
211+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-noavx.tar.gz
212+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cortex.llamacpp-${{ inputs.cortex-llamacpp-version }}-windows-amd64-vulkan.tar.gz
213+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cuda-11-7-windows-amd64.tar.gz
214+
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cuda-12-0-windows-amd64.tar.gz
215+
185216
- name: Enable long paths
186217
run: |
187218
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
188219
189-
- name: Compile .ISS to .EXE Installer
220+
- name: Compile .ISS to .EXE network Installer
190221
uses: nadeemjazmawe/inno-setup-action-cli@v6.0.5
191222
with:
192223
filepath: ./${{ steps.set-output-params.outputs.iss_file_name }}
193224

194-
- name: Codesign for windows installer
225+
- name: Codesign for windows network installer
226+
shell: pwsh
227+
run: |
228+
~\.dotnet\tools\azuresigntool.exe sign -kvu ${{ secrets.AZURE_KEY_VAULT_URI }} -kvi ${{ secrets.AZURE_CLIENT_ID }} -kvt ${{ secrets.AZURE_TENANT_ID }} -kvs ${{ secrets.AZURE_CLIENT_SECRET }} -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\setup.exe"
229+
mv .\setup.exe .\network-setup.exe
230+
231+
- name: Compile .ISS to .EXE local Installer
232+
uses: nadeemjazmawe/inno-setup-action-cli@v6.0.5
233+
with:
234+
filepath: ./${{ steps.set-output-params.outputs.local_iss_file_name }}
235+
236+
- name: Codesign for windows network installer
195237
shell: pwsh
196238
run: |
197239
~\.dotnet\tools\azuresigntool.exe sign -kvu ${{ secrets.AZURE_KEY_VAULT_URI }} -kvi ${{ secrets.AZURE_CLIENT_ID }} -kvt ${{ secrets.AZURE_TENANT_ID }} -kvs ${{ secrets.AZURE_CLIENT_SECRET }} -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\setup.exe"
240+
mv .\setup.exe .\local-setup.exe
198241
199242
- name: Package
200243
run: |
@@ -207,11 +250,17 @@ jobs:
207250
name: cortex-${{ inputs.new_version }}-windows-amd64
208251
path: ./engine/cortex
209252

210-
- name: Upload Artifact
253+
- name: Upload Artifact network installer
211254
uses: actions/upload-artifact@v4
212255
with:
213-
name: cortex-${{ inputs.new_version }}-windows-amd64-installer
214-
path: ./setup.exe
256+
name: cortex-${{ inputs.new_version }}-windows-amd64-network-installer
257+
path: ./network-setup.exe
258+
259+
- name: Upload Artifact local installer
260+
uses: actions/upload-artifact@v4
261+
with:
262+
name: cortex-${{ inputs.new_version }}-windows-amd64-local-installer
263+
path: ./local-setup.exe
215264

216265
- name: upload to aws s3 if public provider is aws
217266
if: inputs.public_provider == 'aws-s3'
@@ -221,7 +270,8 @@ jobs:
221270
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/temp-latest/windows-amd64-cortex-nightly.tar.gz
222271
223272
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/v${{ inputs.new_version }}/windows-amd64/cortex-nightly.tar.gz
224-
aws s3 cp ./setup.exe s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/v${{ inputs.new_version }}/windows-amd64/cortex-${{ inputs.new_version }}-windows-amd64-installer.exe
273+
aws s3 cp ./network-setup.exe s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/v${{ inputs.new_version }}/windows-amd64/cortex-${{ inputs.new_version }}-windows-amd64-network-installer.exe
274+
aws s3 cp ./local-setup.exe s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/v${{ inputs.new_version }}/windows-amd64/cortex-${{ inputs.new_version }}-windows-amd64-local-installer.exe
225275
env:
226276
AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
227277
AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
@@ -246,6 +296,17 @@ jobs:
246296
uses: actions/upload-release-asset@v1.0.1
247297
with:
248298
upload_url: ${{ inputs.upload_url }}
249-
asset_path: ./setup.exe
250-
asset_name: cortex-${{ inputs.new_version }}-windows-amd64-installer.exe
299+
asset_path: ./network-setup.exe
300+
asset_name: cortex-${{ inputs.new_version }}-windows-amd64-network-installer.exe
301+
asset_content_type: application/octet-stream
302+
303+
- name: Upload release assert if public provider is github
304+
if: inputs.public_provider == 'github'
305+
env:
306+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
307+
uses: actions/upload-release-asset@v1.0.1
308+
with:
309+
upload_url: ${{ inputs.upload_url }}
310+
asset_path: ./local-setup.exe
311+
asset_name: cortex-${{ inputs.new_version }}-windows-amd64-local-installer.exe
251312
asset_content_type: application/octet-stream
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: get-cortex-llamacpp-latest-version
2+
on:
3+
workflow_call:
4+
outputs:
5+
cortex_llamacpp_latest_version:
6+
description: 'The latest version of cortex.llamacpp engines'
7+
value: ${{ jobs.get-cortex-llamacpp-latest-version.outputs.new_version }}
8+
9+
jobs:
10+
get-cortex-llamacpp-latest-version:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
new_version: ${{ steps.version_update.outputs.new_version }}
14+
steps:
15+
- name: Install jq
16+
uses: dcarbone/install-jq-action@v2.0.1
17+
18+
- name: Update app version based on latest release tag with build number
19+
id: version_update
20+
run: |
21+
# Function to get the latest release tag
22+
get_latest_tag() {
23+
local retries=0
24+
local max_retries=3
25+
local tag
26+
while [ $retries -lt $max_retries ]; do
27+
tag=$(curl -s https://api.github.com/repos/janhq/cortex.llamacpp/releases/latest | jq -r .tag_name)
28+
if [ -n "$tag" ] && [ "$tag" != "null" ]; then
29+
echo $tag
30+
return
31+
else
32+
let retries++
33+
echo "Retrying... ($retries/$max_retries)"
34+
sleep 2
35+
fi
36+
done
37+
echo "Failed to fetch latest tag after $max_retries attempts."
38+
exit 1
39+
}
40+
41+
# Get the latest release tag from GitHub API
42+
LATEST_TAG=$(get_latest_tag)
43+
44+
# Remove the 'v' and append the build number to the version
45+
new_version="${LATEST_TAG#v}"
46+
echo "New version: $new_version"
47+
echo "::set-output name=new_version::$new_version"

.github/workflows/template-get-update-version.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
jobs:
1010
get-update-version:
1111
runs-on: ubuntu-latest
12-
environment: production
1312
outputs:
1413
new_version: ${{ steps.version_update.outputs.new_version }}
1514
steps:

0 commit comments

Comments
 (0)