1+ name : CI Cortex CPP Nightly Build
2+
3+ on :
4+ schedule :
5+ - cron : ' 0 20 * * *' # At 8 PM UTC everyday
6+ workflow_dispatch :
7+ inputs :
8+ public_provider :
9+ type : choice
10+ description : ' Public Provider'
11+ options :
12+ - none
13+ - aws-s3
14+ default : none
15+
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+
20+ jobs :
21+ set-public-provider :
22+ runs-on : ubuntu-latest
23+ outputs :
24+ public_provider : ${{ steps.set-public-provider.outputs.public_provider }}
25+ ref : ${{ steps.set-public-provider.outputs.ref }}
26+ steps :
27+ - name : Set public provider
28+ id : set-public-provider
29+ run : |
30+ if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
31+ echo "::set-output name=public_provider::${{ github.event.inputs.public_provider }}"
32+ echo "::set-output name=ref::${{ github.ref }}"
33+ else
34+ if [ "${{ github.event_name }}" == "schedule" ]; then
35+ echo "::set-output name=public_provider::aws-s3"
36+ echo "::set-output name=ref::refs/heads/dev"
37+ elif [ "${{ github.event_name }}" == "push" ]; then
38+ echo "::set-output name=public_provider::aws-s3"
39+ echo "::set-output name=ref::${{ github.ref }}"
40+ else
41+ echo "::set-output name=public_provider::none"
42+ echo "::set-output name=ref::${{ github.ref }}"
43+ fi
44+ fi
45+
46+ # Job create Update app version based on latest release tag with build number and save to output
47+ get-update-version :
48+ uses : ./.github/workflows/template-get-update-version.yml
49+
50+ build-and-test :
51+ runs-on : ${{ matrix.runs-on }}
52+ 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 : Install choco on Windows
90+ if : runner.os == 'Windows'
91+ run : |
92+ choco install make pkgconfiglite ccache awscli 7zip ninja -y
93+
94+ - name : Download ccache from s3
95+ if : runner.os == 'Windows'
96+ continue-on-error : true
97+ run : |
98+ Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
99+ refreshenv
100+ aws s3 cp s3://${{ secrets.MINIO_BUCKET_NAME }}/cortex-cpp-${{ matrix.os }}-${{ matrix.name }} ${{ matrix.ccache-dir }} --recursive --endpoint ${{ secrets.MINIO_ENDPOINT }}
101+ env :
102+ AWS_ACCESS_KEY_ID : " ${{ secrets.MINIO_ACCESS_KEY_ID }}"
103+ AWS_SECRET_ACCESS_KEY : " ${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
104+ AWS_DEFAULT_REGION : " ${{ secrets.MINIO_REGION }}"
105+
106+ - name : Configure vcpkg
107+ run : |
108+ cd engine
109+ make configure-vcpkg
110+
111+ - name : Build
112+ run : |
113+ cd engine
114+ make build CMAKE_EXTRA_FLAGS="${{ matrix.cmake-flags }}" BUILD_DEPS_CMAKE_EXTRA_FLAGS="${{ matrix.build-deps-cmake-flags }}"
115+
116+ - name : Pre-package
117+ run : |
118+ cd engine
119+ make pre-package
120+
121+ - name : Package
122+ run : |
123+ cd engine
124+ make package
125+
126+ - name : Upload Artifact
127+ uses : actions/upload-artifact@v2
128+ with :
129+ name : cortex-cpp-${{ matrix.os }}-${{ matrix.name }}
130+ path : ./engine/cortex-cpp
131+
132+ - name : Upload ccache to s3
133+ continue-on-error : true
134+ if : always() && runner.os == 'Windows'
135+ run : |
136+ Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
137+ refreshenv
138+ aws s3 cp ${{ matrix.ccache-dir }} s3://${{ secrets.MINIO_BUCKET_NAME }}/cortex-cpp-${{ matrix.os }}-${{ matrix.name }} --recursive --endpoint ${{ secrets.MINIO_ENDPOINT }}
139+ env :
140+ AWS_ACCESS_KEY_ID : " ${{ secrets.MINIO_ACCESS_KEY_ID }}"
141+ AWS_SECRET_ACCESS_KEY : " ${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
142+ AWS_DEFAULT_REGION : " ${{ secrets.MINIO_REGION }}"
0 commit comments