Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows add local installer #1324

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/beta-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
get-update-version:
uses: ./.github/workflows/template-get-update-version.yml

get-cortex-llamacpp-latest-version:
uses: ./.github/workflows/template-cortex-llamacpp-latest-version.yml

create-draft-release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
Expand All @@ -35,7 +38,7 @@ jobs:

build-macos-x64:
uses: ./.github/workflows/template-build-macos.yml
needs: [get-update-version, create-draft-release]
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
secrets: inherit
with:
ref: ${{ github.ref }}
Expand All @@ -49,7 +52,7 @@ jobs:

build-macos-arm64:
uses: ./.github/workflows/template-build-macos.yml
needs: [get-update-version, create-draft-release]
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
secrets: inherit
with:
ref: ${{ github.ref }}
Expand All @@ -64,7 +67,7 @@ jobs:
build-windows-x64:
uses: ./.github/workflows/template-build-windows-x64.yml
secrets: inherit
needs: [get-update-version, create-draft-release]
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
with:
ref: ${{ github.ref }}
public_provider: github
Expand All @@ -75,11 +78,12 @@ jobs:
ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
channel: beta
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
cortex-llamacpp-version: ${{ needs.get-cortex-llamacpp-latest-version.outputs.cortex_llamacpp_latest_version }}

build-linux-x64:
uses: ./.github/workflows/template-build-linux-x64.yml
secrets: inherit
needs: [get-update-version, create-draft-release]
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
with:
ref: ${{ github.ref }}
public_provider: github
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ jobs:
get-update-version:
uses: ./.github/workflows/template-get-update-version.yml

get-cortex-llamacpp-latest-version:
uses: ./.github/workflows/template-cortex-llamacpp-latest-version.yml

build-macos-x64:
uses: ./.github/workflows/template-build-macos.yml
needs: [get-update-version, set-public-provider]
needs: [get-update-version, set-public-provider, get-cortex-llamacpp-latest-version]
secrets: inherit
with:
ref: ${{ needs.set-public-provider.outputs.ref }}
Expand All @@ -58,7 +61,7 @@ jobs:

build-macos-arm64:
uses: ./.github/workflows/template-build-macos.yml
needs: [get-update-version, set-public-provider]
needs: [get-update-version, set-public-provider, get-cortex-llamacpp-latest-version]
secrets: inherit
with:
ref: ${{ needs.set-public-provider.outputs.ref }}
Expand All @@ -72,7 +75,7 @@ jobs:
build-windows-x64:
uses: ./.github/workflows/template-build-windows-x64.yml
secrets: inherit
needs: [get-update-version, set-public-provider]
needs: [get-update-version, set-public-provider, get-cortex-llamacpp-latest-version]
with:
ref: ${{ needs.set-public-provider.outputs.ref }}
public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
Expand All @@ -82,11 +85,12 @@ jobs:
build-deps-cmake-flags: "-DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
channel: nightly
cortex-llamacpp-version: ${{ needs.get-cortex-llamacpp-latest-version.outputs.cortex_llamacpp_latest_version }}

build-linux-x64:
uses: ./.github/workflows/template-build-linux-x64.yml
secrets: inherit
needs: [get-update-version, set-public-provider]
needs: [get-update-version, set-public-provider, get-cortex-llamacpp-latest-version]
with:
ref: ${{ needs.set-public-provider.outputs.ref }}
public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
Expand All @@ -98,7 +102,7 @@ jobs:
update-latest-version:
runs-on: ubuntu-latest
if: needs.set-public-provider.outputs.public_provider == 'aws-s3'
needs: [get-update-version, set-public-provider, build-linux-x64, build-macos-x64, build-macos-arm64, build-windows-x64]
needs: [get-update-version, set-public-provider, build-linux-x64, build-macos-x64, build-macos-arm64, build-windows-x64, get-cortex-llamacpp-latest-version]
steps:
- name: Update latest version
id: update-latest-version
Expand All @@ -117,7 +121,7 @@ jobs:
AWS_EC2_METADATA_DISABLED: "true"

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

noti-discord-manual:
needs: [build-macos-x64, build-macos-arm64, build-windows-x64, build-linux-x64, get-update-version, set-public-provider]
needs: [build-macos-x64, build-macos-arm64, build-windows-x64, build-linux-x64, get-update-version, set-public-provider, get-cortex-llamacpp-latest-version]
secrets: inherit
if: github.event_name == 'workflow_dispatch' && github.event.inputs.public_provider == 'aws-s3'
uses: ./.github/workflows/template-noti-discord.yaml
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/stable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
get-update-version:
uses: ./.github/workflows/template-get-update-version.yml

get-cortex-llamacpp-latest-version:
uses: ./.github/workflows/template-cortex-llamacpp-latest-version.yml

create-draft-release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
Expand All @@ -35,7 +38,7 @@ jobs:

build-macos-x64:
uses: ./.github/workflows/template-build-macos.yml
needs: [get-update-version, create-draft-release]
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
secrets: inherit
with:
ref: ${{ github.ref }}
Expand All @@ -49,7 +52,7 @@ jobs:

build-macos-arm64:
uses: ./.github/workflows/template-build-macos.yml
needs: [get-update-version, create-draft-release]
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
secrets: inherit
with:
ref: ${{ github.ref }}
Expand All @@ -64,7 +67,7 @@ jobs:
build-windows-x64:
uses: ./.github/workflows/template-build-windows-x64.yml
secrets: inherit
needs: [get-update-version, create-draft-release]
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
with:
ref: ${{ github.ref }}
public_provider: github
Expand All @@ -75,11 +78,12 @@ jobs:
ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
channel: stable
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
cortex-llamacpp-version: ${{ needs.get-cortex-llamacpp-latest-version.outputs.cortex_llamacpp_latest_version }}

build-linux-x64:
uses: ./.github/workflows/template-build-linux-x64.yml
secrets: inherit
needs: [get-update-version, create-draft-release]
needs: [get-update-version, create-draft-release, get-cortex-llamacpp-latest-version]
with:
ref: ${{ github.ref }}
public_provider: github
Expand Down
81 changes: 71 additions & 10 deletions .github/workflows/template-build-windows-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ on:
type: string
default: 'nightly'
description: 'The channel to use for this job'
cortex-llamacpp-version:
required: true
type: string
default: '0.0.0'
description: 'The version of cortex-llamacpp to use for this job'
secrets:
MINIO_BUCKET_NAME:
required: false
Expand Down Expand Up @@ -104,6 +109,7 @@ jobs:
echo "::set-output name=configuration_file_name::.cortexrc"
echo "::set-output name=uninstaller_file_name::cortex-uninstall.sh"
echo "::set-output name=iss_file_name::installer.iss"
echo "::set-output name=local_iss_file_name::local-installer.iss"
fi
# Set output for beta channel
Expand All @@ -114,6 +120,7 @@ jobs:
echo "::set-output name=configuration_file_name::.cortexrc-beta"
echo "::set-output name=uninstaller_file_name::cortex-beta-uninstall.sh"
echo "::set-output name=iss_file_name::installer-beta.iss"
echo "::set-output name=local_iss_file_name::local-installer-beta.iss"
fi
# Set output for nightly channel
Expand All @@ -124,14 +131,15 @@ jobs:
echo "::set-output name=configuration_file_name::.cortexrc-nightly"
echo "::set-output name=uninstaller_file_name::cortex-nightly-uninstall.sh"
echo "::set-output name=iss_file_name::installer-nightly.iss"
echo "::set-output name=local_iss_file_name::local-installer-nightly.iss"
fi
- name: Install jq
uses: dcarbone/install-jq-action@v2.0.1

- name: Install dependencies on Windows
run: |
choco install make pkgconfiglite ccache awscli 7zip ninja -y
choco install make pkgconfiglite ccache awscli 7zip ninja wget -y
dotnet tool install --global AzureSignTool
- name: Download ccache from s3
Expand Down Expand Up @@ -171,30 +179,65 @@ jobs:
run: |
cd engine/templates/windows
sed -i "s/AppVersion=1.0/AppVersion=${{ inputs.new_version }}/g" ${{ steps.set-output-params.outputs.iss_file_name }}
sed -i "s/AppVersion=1.0/AppVersion=${{ inputs.new_version }}/g" ${{ steps.set-output-params.outputs.local_iss_file_name }}
cat ${{ steps.set-output-params.outputs.iss_file_name }}
cp ${{ steps.set-output-params.outputs.iss_file_name }} ../../../
cp ${{ steps.set-output-params.outputs.local_iss_file_name }} ../../../
ls ../../../
- name: Build Installers
- name: Build network Installers
shell: bash
run: |
cd engine
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 }}"
ls ../
- name: Build local Installers
shell: powershell
run: |
mkdir dependencies
cd dependencies
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
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
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
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
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
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
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
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
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
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
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
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
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
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cuda-11-7-windows-amd64.tar.gz
wget.exe https://github.com/janhq/cortex.llamacpp/releases/download/v${{ inputs.cortex-llamacpp-version }}/cuda-12-0-windows-amd64.tar.gz
- name: Enable long paths
run: |
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
- name: Compile .ISS to .EXE Installer
- name: Compile .ISS to .EXE network Installer
uses: nadeemjazmawe/inno-setup-action-cli@v6.0.5
with:
filepath: ./${{ steps.set-output-params.outputs.iss_file_name }}

- name: Codesign for windows installer
- name: Codesign for windows network installer
shell: pwsh
run: |
~\.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"
mv .\setup.exe .\network-setup.exe
- name: Compile .ISS to .EXE local Installer
uses: nadeemjazmawe/inno-setup-action-cli@v6.0.5
with:
filepath: ./${{ steps.set-output-params.outputs.local_iss_file_name }}

- name: Codesign for windows network installer
shell: pwsh
run: |
~\.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"
mv .\setup.exe .\local-setup.exe
- name: Package
run: |
Expand All @@ -207,11 +250,17 @@ jobs:
name: cortex-${{ inputs.new_version }}-windows-amd64
path: ./engine/cortex

- name: Upload Artifact
- name: Upload Artifact network installer
uses: actions/upload-artifact@v4
with:
name: cortex-${{ inputs.new_version }}-windows-amd64-installer
path: ./setup.exe
name: cortex-${{ inputs.new_version }}-windows-amd64-network-installer
path: ./network-setup.exe

- name: Upload Artifact local installer
uses: actions/upload-artifact@v4
with:
name: cortex-${{ inputs.new_version }}-windows-amd64-local-installer
path: ./local-setup.exe

- name: upload to aws s3 if public provider is aws
if: inputs.public_provider == 'aws-s3'
Expand All @@ -221,7 +270,8 @@ jobs:
aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/temp-latest/windows-amd64-cortex-nightly.tar.gz
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
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
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
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
env:
AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
Expand All @@ -246,6 +296,17 @@ jobs:
uses: actions/upload-release-asset@v1.0.1
with:
upload_url: ${{ inputs.upload_url }}
asset_path: ./setup.exe
asset_name: cortex-${{ inputs.new_version }}-windows-amd64-installer.exe
asset_path: ./network-setup.exe
asset_name: cortex-${{ inputs.new_version }}-windows-amd64-network-installer.exe
asset_content_type: application/octet-stream

- name: Upload release assert if public provider is github
if: inputs.public_provider == 'github'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/upload-release-asset@v1.0.1
with:
upload_url: ${{ inputs.upload_url }}
asset_path: ./local-setup.exe
asset_name: cortex-${{ inputs.new_version }}-windows-amd64-local-installer.exe
asset_content_type: application/octet-stream
47 changes: 47 additions & 0 deletions .github/workflows/template-cortex-llamacpp-latest-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: get-cortex-llamacpp-latest-version
on:
workflow_call:
outputs:
cortex_llamacpp_latest_version:
description: 'The latest version of cortex.llamacpp engines'
value: ${{ jobs.get-cortex-llamacpp-latest-version.outputs.new_version }}

jobs:
get-cortex-llamacpp-latest-version:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.version_update.outputs.new_version }}
steps:
- name: Install jq
uses: dcarbone/install-jq-action@v2.0.1

- name: Update app version based on latest release tag with build number
id: version_update
run: |
# Function to get the latest release tag
get_latest_tag() {
local retries=0
local max_retries=3
local tag
while [ $retries -lt $max_retries ]; do
tag=$(curl -s https://api.github.com/repos/janhq/cortex.llamacpp/releases/latest | jq -r .tag_name)
if [ -n "$tag" ] && [ "$tag" != "null" ]; then
echo $tag
return
else
let retries++
echo "Retrying... ($retries/$max_retries)"
sleep 2
fi
done
echo "Failed to fetch latest tag after $max_retries attempts."
exit 1
}
# Get the latest release tag from GitHub API
LATEST_TAG=$(get_latest_tag)
# Remove the 'v' and append the build number to the version
new_version="${LATEST_TAG#v}"
echo "New version: $new_version"
echo "::set-output name=new_version::$new_version"
1 change: 0 additions & 1 deletion .github/workflows/template-get-update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ on:
jobs:
get-update-version:
runs-on: ubuntu-latest
environment: production
outputs:
new_version: ${{ steps.version_update.outputs.new_version }}
steps:
Expand Down
Loading
Loading