Skip to content

Commit 2e82710

Browse files
committed
CICD - add teamplate for each os
1 parent c0657f9 commit 2e82710

8 files changed

+404
-249
lines changed

.github/workflows/cortex-cpp-quality-gate.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
make package
9191
9292
- name: Upload Artifact
93-
uses: actions/upload-artifact@v2
93+
uses: actions/upload-artifact@v4
9494
with:
9595
name: cortex-${{ matrix.os }}-${{ matrix.name }}
9696
path: ./engine/cortex

.github/workflows/nightly-build.yml

+62-185
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ on:
1313
- aws-s3
1414
default: none
1515

16-
env:
17-
LLM_MODEL_URL: https://delta.jan.ai/tinyllama-1.1b-chat-v0.3.Q2_K.gguf
18-
EMBEDDING_MODEL_URL: https://catalog.jan.ai/dist/models/embeds/nomic-embed-text-v1.5.f16.gguf
19-
2016
jobs:
2117
set-public-provider:
2218
runs-on: ubuntu-latest
@@ -47,188 +43,69 @@ jobs:
4743
get-update-version:
4844
uses: ./.github/workflows/template-get-update-version.yml
4945

50-
build-and-test:
51-
runs-on: ${{ matrix.runs-on }}
46+
build-macos-x64:
47+
uses: ./.github/workflows/template-build-macos.yml
5248
needs: [get-update-version, set-public-provider]
53-
timeout-minutes: 60
54-
strategy:
55-
fail-fast: false
56-
matrix:
57-
include:
58-
- os: "linux"
59-
name: "amd64"
60-
runs-on: "ubuntu-20-04-cuda-12-0"
61-
cmake-flags: "-DCORTEX_CPP_VERSION=${{ 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"
62-
build-deps-cmake-flags: ""
63-
ccache-dir: ''
64-
- os: "mac"
65-
name: "amd64"
66-
runs-on: "macos-13"
67-
cmake-flags: "-DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
68-
build-deps-cmake-flags: ""
69-
ccache-dir: ''
70-
- os: "mac"
71-
name: "arm64"
72-
runs-on: "macos-latest"
73-
cmake-flags: "-DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DMAC_ARM64=ON -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
74-
build-deps-cmake-flags: ""
75-
ccache-dir: ''
76-
- os: "windows"
77-
name: "amd64"
78-
runs-on: "windows-cuda-12-0"
79-
cmake-flags: "-DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=C:/w/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
80-
build-deps-cmake-flags: "-DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
81-
ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
82-
steps:
83-
- name: Clone
84-
id: checkout
85-
uses: actions/checkout@v3
86-
with:
87-
submodules: recursive
88-
89-
- name: Get Cer for code signing
90-
if: runner.os == 'macOS'
91-
run: base64 -d <<< "$NOTARIZE_P8_BASE64" > /tmp/notary-key.p8
92-
shell: bash
93-
env:
94-
NOTARIZE_P8_BASE64: ${{ secrets.NOTARIZE_P8_BASE64 }}
95-
96-
- name: Install gettext-bast linux
97-
if: runner.os == 'Linux'
98-
run: sudo apt update && sudo apt install gettext-base -y
99-
100-
- uses: apple-actions/import-codesign-certs@v2
101-
continue-on-error: true
102-
if: runner.os == 'macOS'
103-
with:
104-
p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
105-
p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
106-
107-
- uses: actions/setup-dotnet@v3
108-
if: runner.os == 'Windows'
109-
with:
110-
dotnet-version: "8.0.x"
111-
112-
- name: Install choco on Windows
113-
if: runner.os == 'Windows'
114-
run: |
115-
choco install make pkgconfiglite ccache awscli 7zip ninja -y
116-
dotnet tool install --global AzureSignTool
117-
118-
- name: Download ccache from s3
119-
if: runner.os == 'Windows'
120-
continue-on-error: true
121-
run: |
122-
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
123-
refreshenv
124-
aws s3 cp s3://${{ secrets.MINIO_BUCKET_NAME }}/cortex-cpp-${{ matrix.os }}-${{ matrix.name }} ${{ matrix.ccache-dir }} --recursive --endpoint ${{ secrets.MINIO_ENDPOINT }}
125-
env:
126-
AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
127-
AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
128-
AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"
129-
130-
- name: Configure vcpkg
131-
run: |
132-
cd engine
133-
make configure-vcpkg
134-
135-
- name: Build
136-
run: |
137-
cd engine
138-
make build CMAKE_EXTRA_FLAGS="${{ matrix.cmake-flags }}" BUILD_DEPS_CMAKE_EXTRA_FLAGS="${{ matrix.build-deps-cmake-flags }}"
139-
140-
- name: Pre-package
141-
run: |
142-
cd engine
143-
make pre-package
144-
145-
- name: Code Signing binaries
146-
run: |
147-
cd engine
148-
make codesign-binary CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}" 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 }}"
149-
150-
- name: Notary macOS Binary
151-
if: runner.os == 'macOS'
152-
run: |
153-
curl -sSfL https://raw.githubusercontent.com/anchore/quill/main/install.sh | sh -s -- -b /usr/local/bin
154-
cd engine/cortex
155-
# Notarize the binary
156-
quill notarize ./cortex
157-
env:
158-
QUILL_NOTARY_KEY_ID: ${{ secrets.NOTARY_KEY_ID }}
159-
QUILL_NOTARY_ISSUER: ${{ secrets.NOTARY_ISSUER }}
160-
QUILL_NOTARY_KEY: "/tmp/notary-key.p8"
161-
162-
- name: Build Installers
163-
shell: bash
164-
run: |
165-
cd engine
166-
make build-installer PACKAGE_NAME=cortexcpp-nightly VERSION=${{ needs.get-update-version.outputs.new_version }} SOURCE_BINARY_PATH="../../cortex/cortex" DESTINATION_BINARY_NAME="cortex-nightly" DATA_FOLDER_NAME=".cortex-nightly" CONFIGURATION_FILE_NAME=".cortexrc-nightly" UNINSTALLER_FILE_NAME="cortex-nightly-uninstall.sh"
167-
168-
- name: Codesign and notary for macos installer
169-
if: runner.os == 'macOS'
170-
run: |
171-
cd engine
172-
productsign --sign "Developer ID Installer: ${{ secrets.DEVELOPER_ID }}" cortexcpp-nightly-${{ needs.get-update-version.outputs.new_version }}.pkg cortexcpp-nightly-${{ needs.get-update-version.outputs.new_version }}-signed.pkg
173-
rm cortexcpp-nightly-${{ needs.get-update-version.outputs.new_version }}.pkg
174-
mv cortexcpp-nightly-${{ needs.get-update-version.outputs.new_version }}-signed.pkg cortexcpp-nightly-${{ needs.get-update-version.outputs.new_version }}.pkg
175-
xcrun notarytool submit cortexcpp-nightly-${{ needs.get-update-version.outputs.new_version }}.pkg --apple-id ${{ secrets.APPLE_ID }} --password ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} --team-id ${{ secrets.APPLE_TEAM_ID }} --wait
176-
177-
- name: Compile .ISS to .EXE Installer
178-
uses: Minionguyjpro/[email protected]
179-
if: runner.os == 'Windows'
180-
with:
181-
path: engine/templates/windows/installer-nightly.iss
182-
options: /O+
183-
184-
- name: Codesign for windows installer
185-
if: runner.os == 'Windows'
186-
run: |
187-
cd engine
49+
secrets: inherit
50+
with:
51+
ref: ${{ needs.set-public-provider.outputs.ref }}
52+
public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
53+
new_version: ${{ needs.get-update-version.outputs.new_version }}
54+
runs-on: macos-12
55+
cmake-flags: "-DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
56+
channel: nightly
57+
arch: amd64
58+
59+
build-macos-arm64:
60+
uses: ./.github/workflows/template-build-macos.yml
61+
needs: [get-update-version, set-public-provider]
62+
secrets: inherit
63+
with:
64+
ref: ${{ needs.set-public-provider.outputs.ref }}
65+
public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
66+
new_version: ${{ needs.get-update-version.outputs.new_version }}
67+
runs-on: macos-latest
68+
cmake-flags: "-DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DMAC_ARM64=ON -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
69+
channel: nightly
70+
arch: arm64
71+
72+
build-windows-x64:
73+
uses: ./.github/workflows/template-build-windows-x64.yml
74+
secrets: inherit
75+
needs: [get-update-version, set-public-provider]
76+
with:
77+
ref: ${{ needs.set-public-provider.outputs.ref }}
78+
public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
79+
new_version: ${{ needs.get-update-version.outputs.new_version }}
80+
runs-on: windows-cuda-11-7
81+
cmake-flags: "-DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=C:/w/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
82+
build-deps-cmake-flags: "-DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
83+
ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
84+
channel: nightly
18885

189-
set PATH=%PATH%;%USERPROFILE%\.dotnet\tools
190-
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 ".\templates\windows\setup.exe";'
191-
192-
- name: Package
193-
run: |
194-
cd engine
195-
make package
196-
197-
- name: Upload Artifact
198-
uses: actions/upload-artifact@v2
199-
with:
200-
name: cortex-${{ matrix.os }}-${{ matrix.name }}
201-
path: ./engine/cortex
202-
203-
- name: Upload windwos installer
204-
if: runner.os == 'Windows'
205-
uses: actions/upload-artifact@v2
206-
with:
207-
name: cortex-${{ matrix.os }}-installer-${{ matrix.name }}
208-
path: ./engine/templates/windows/setup.exe
209-
210-
- name: Upload macos installer
211-
if: runner.os == 'macOS'
212-
uses: actions/upload-artifact@v2
213-
with:
214-
name: cortex-${{ matrix.os }}-installer-${{ matrix.name }}
215-
path: ./engine/cortexcpp-nightly.pkg
216-
217-
- name: Upload linux installer
218-
if: runner.os == 'Linux'
219-
uses: actions/upload-artifact@v2
220-
with:
221-
name: cortex-${{ matrix.os }}-installer-${{ matrix.name }}
222-
path: ./engine/cortexcpp-nightly.deb
223-
224-
- name: Upload ccache to s3
225-
continue-on-error: true
226-
if: always() && runner.os == 'Windows'
86+
build-linux-x64:
87+
uses: ./.github/workflows/template-build-linux-x64.yml
88+
secrets: inherit
89+
needs: [get-update-version, set-public-provider]
90+
with:
91+
ref: ${{ needs.set-public-provider.outputs.ref }}
92+
public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
93+
new_version: ${{ needs.get-update-version.outputs.new_version }}
94+
runs-on: ubuntu-20-04
95+
cmake-flags: "-DCORTEX_CPP_VERSION=${{ 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"
96+
channel: nightly
97+
98+
update-latest-version:
99+
runs-on: ubuntu-latest
100+
needs: [get-update-version, set-public-provider, build-linux-x64, build-macos-x64, build-macos-arm64, build-windows-x64]
101+
steps:
102+
- name: Update latest version
103+
id: update-latest-version
227104
run: |
228-
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
229-
refreshenv
230-
aws s3 cp ${{ matrix.ccache-dir }} s3://${{ secrets.MINIO_BUCKET_NAME }}/cortex-${{ matrix.os }}-${{ matrix.name }} --recursive --endpoint ${{ secrets.MINIO_ENDPOINT }}
105+
echo "{\"tag_name\": \"v${{ needs.get-update-version.outputs.new_version }}\"}" > version.json
106+
aws s3 cp version.json s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/version.json
231107
env:
232-
AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
233-
AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
234-
AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"
108+
AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
109+
AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
110+
AWS_DEFAULT_REGION: ${{ secrets.DELTA_AWS_REGION }}
111+
AWS_EC2_METADATA_DISABLED: "true"

.github/workflows/platform-openai-coverage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
AWS_EC2_METADATA_DISABLED: "true"
9696

9797
- name: Upload Artifact
98-
uses: actions/upload-artifact@v2
98+
uses: actions/upload-artifact@v4
9999
with:
100100
name: report
101101
path: |

0 commit comments

Comments
 (0)