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

Commit 25cab6a

Browse files
committed
CICD - add teamplate for each os
1 parent 93851e9 commit 25cab6a

File tree

1 file changed

+182
-0
lines changed

1 file changed

+182
-0
lines changed
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
name: build-windows-x64
2+
on:
3+
workflow_call:
4+
inputs:
5+
ref:
6+
required: true
7+
type: string
8+
default: 'refs/heads/main'
9+
public_provider:
10+
required: true
11+
type: string
12+
default: none
13+
description: 'none: build only, github: build and publish to github, aws s3: build and publish to aws s3'
14+
new_version:
15+
required: true
16+
type: string
17+
default: ''
18+
upload_url:
19+
required: true
20+
type: string
21+
default: ''
22+
runs-on:
23+
required: false
24+
type: string
25+
default: 'windows-cuda-12-0'
26+
description: 'The runner to use for this job'
27+
cmake-flags:
28+
required: false
29+
type: string
30+
default: ''
31+
description: 'The cmake flags to use for this job'
32+
build-deps-cmake-flags:
33+
required: false
34+
type: string
35+
default: ''
36+
description: 'The cmake flags to use for this job'
37+
ccache-dir:
38+
required: false
39+
type: string
40+
default: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
41+
description: 'The ccache directory to use for this job'
42+
package-name:
43+
required: false
44+
type: string
45+
default: 'cortexcpp-nightly'
46+
description: 'The package name to use for this job'
47+
secrets:
48+
DELTA_AWS_S3_BUCKET_NAME:
49+
required: false
50+
DELTA_AWS_ACCESS_KEY_ID:
51+
required: false
52+
DELTA_AWS_SECRET_ACCESS_KEY:
53+
required: false
54+
AZURE_KEY_VAULT_URI:
55+
required: false
56+
AZURE_CLIENT_ID:
57+
required: false
58+
AZURE_TENANT_ID:
59+
required: false
60+
AZURE_CLIENT_SECRET:
61+
required: false
62+
AZURE_CERT_NAME:
63+
required: false
64+
65+
jobs:
66+
build-windows-x64:
67+
runs-on: ${{ inputs.runs-on }}
68+
permissions:
69+
contents: write
70+
steps:
71+
- name: Getting the repo
72+
uses: actions/checkout@v3
73+
with:
74+
ref: ${{ inputs.ref }}
75+
76+
- uses: actions/setup-dotnet@v3
77+
if: runner.os == 'Windows'
78+
with:
79+
dotnet-version: "8.0.x"
80+
81+
- name: Install jq
82+
uses: dcarbone/[email protected]
83+
84+
- name: Install dependencies on Windows
85+
run: |
86+
choco install make pkgconfiglite ccache awscli 7zip ninja -y
87+
dotnet tool install --global AzureSignTool
88+
89+
- name: Download ccache from s3
90+
if: runner.os == 'Windows'
91+
continue-on-error: true
92+
run: |
93+
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
94+
refreshenv
95+
aws s3 cp s3://${{ secrets.MINIO_BUCKET_NAME }}/cortex-cpp-windows-amd64 ${{ inputs.ccache-dir }} --recursive --endpoint ${{ secrets.MINIO_ENDPOINT }}
96+
env:
97+
AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
98+
AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
99+
AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"
100+
101+
- name: Configure vcpkg
102+
run: |
103+
cd engine
104+
make configure-vcpkg
105+
106+
- name: Build
107+
run: |
108+
cd engine
109+
make build CMAKE_EXTRA_FLAGS="${{ inputs.cmake-flags }}" BUILD_DEPS_CMAKE_EXTRA_FLAGS="${{ inputs.build-deps-cmake-flags }}"
110+
111+
- name: Pre-package
112+
run: |
113+
cd engine
114+
make pre-package
115+
116+
- name: Code Signing binaries
117+
run: |
118+
cd engine
119+
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 }}"
120+
121+
- name: Build Installers
122+
shell: bash
123+
run: |
124+
cd engine
125+
make build-installer PACKAGE_NAME=${{ inputs.package-name }} VERSION=${{ inputs.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"
126+
127+
- name: Compile .ISS to .EXE Installer
128+
uses: Minionguyjpro/[email protected]
129+
if: runner.os == 'Windows'
130+
with:
131+
path: engine/templates/windows/installer-nightly.iss
132+
options: /O+
133+
134+
- name: Codesign for windows installer
135+
if: runner.os == 'Windows'
136+
run: |
137+
cd engine
138+
%USERPROFILE%\.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 ".\templates\windows\setup.exe";'
139+
140+
- name: Package
141+
run: |
142+
cd engine
143+
make package
144+
145+
- name: Upload Artifact
146+
uses: actions/upload-artifact@v2
147+
with:
148+
name: cortex-windows-amd64-${{ inputs.new_version }}
149+
path: ./engine/cortex
150+
151+
- name: Upload Artifact
152+
uses: actions/upload-artifact@v2
153+
with:
154+
name: cortex-windows-amd64-installer-${{ inputs.new_version }}
155+
path: ./engine/templates/windows/setup.exe
156+
157+
- name: Upload release assert if public provider is github
158+
if: ${{ inputs.public_provider }} == 'github'
159+
uses: actions/[email protected]
160+
with:
161+
upload_url: ${{ inputs.upload_url }}
162+
asset_path: ./engine/cortex.tar.gz
163+
asset_name: cortex-${{ inputs.new_version }}-windows-amd64.tar.gz
164+
asset_content_type: application/zip
165+
166+
- name: Upload release assert if public provider is github
167+
if: ${{ inputs.public_provider }} == 'github'
168+
uses: actions/[email protected]
169+
with:
170+
upload_url: ${{ inputs.upload_url }}
171+
asset_path: ./engine/cortex.tar.gz
172+
asset_name: cortex-${{ inputs.new_version }}-windows-amd64.tar.gz
173+
asset_content_type: application/zip
174+
175+
- name: Upload release assert if public provider is github
176+
if: ${{ inputs.public_provider }} == 'github'
177+
uses: actions/[email protected]
178+
with:
179+
upload_url: ${{ inputs.upload_url }}
180+
asset_path: ./engine/templates/windows/setup.exe
181+
asset_name: cortex-windows-amd64-installer-${{ inputs.new_version }}.exe
182+
asset_content_type: application/zip

0 commit comments

Comments
 (0)