forked from NVIDIA/TensorRT-LLM
-
Notifications
You must be signed in to change notification settings - Fork 2
260 lines (231 loc) · 10.1 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
name: CI
on:
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
workflow_dispatch:
jobs:
create-draft-release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.version }}
permissions:
contents: write
steps:
- name: Extract tag name without v prefix
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV && echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
env:
GITHUB_REF: ${{ github.ref }}
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: "${{ env.VERSION }}"
draft: true
generate_release_notes: true
prerelease: false
build-and-test:
runs-on: ${{ matrix.runs-on }}
needs: [create-draft-release]
timeout-minutes: 1440
strategy:
matrix:
include:
# - os: "windows"
# name: "cuda-12-4"
# runs-on: "windows-tensorrt-llm-0-11-0-cuda-12-4"
# run-e2e: false
# s3-key-prefix: "windows-tensorrt-llm-tensorrt-llm-0-11-0-ccache"
# ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
- os: "linux"
name: "cuda-12-4"
runs-on: "linux-tensorrt-llm-0-11-0-cuda-12-4"
run-e2e: false
s3-key-prefix: "linux-tensorrt-llm-tensorrt-llm-0-11-0-ccache"
ccache-dir: '/home/runner/.cache/ccache'
permissions:
contents: write
steps:
- name: Clone
id: checkout
uses: actions/checkout@v3
with:
submodules: recursive
lfs: true
- name: Install tools on Windows
if: runner.os == 'Windows'
run: |
choco install make pkgconfiglite ccache awscli 7zip -y
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
refreshenv
- name: Download ccache from s3
if: runner.os == 'Windows'
continue-on-error: true
run: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
refreshenv
aws s3 sync s3://${{ secrets.MINIO_BUCKET_NAME }}/${{ matrix.s3-key-prefix }} ${{ matrix.ccache-dir }} --endpoint ${{ secrets.MINIO_ENDPOINT }} --cli-read-timeout 0
env:
AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"
- name: Download ccache from s3
if: runner.os == 'Linux'
continue-on-error: true
run: |
aws s3 sync s3://${{ secrets.MINIO_BUCKET_NAME }}/${{ matrix.s3-key-prefix }} ${{ matrix.ccache-dir }} --endpoint ${{ secrets.MINIO_ENDPOINT }} --cli-read-timeout 0
env:
AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"
- name: Build Dependencies
working-directory: cpp
run: |
make build-deps
- name: Build
id: build-and-test
working-directory: cpp
run: |
make build
- name: Pre-package
working-directory: cpp
run: |
make pre-package
- name: Package
working-directory: cpp
run: |
make package
- name: Calculate SHA512 Checksum (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
CertUtil -hashfile ./cpp/tensorrt_llm/cortex.tensorrt-llm/cortex.tensorrt-llm.tar.gz SHA512 | Select-String -Pattern "^[0-9a-fA-F]+$" | Out-File sha512.txt
$size = (Get-Item ./cpp/tensorrt_llm/cortex.tensorrt-llm/cortex.tensorrt-llm.tar.gz).length
echo "checksum=$(Get-Content sha512.txt)" >> $env:GITHUB_ENV
echo "size=$size" >> $env:GITHUB_ENV
- name: Calculate SHA512 Checksum (Linux)
if: runner.os == 'Linux'
run: |
sha512sum ./cpp/tensorrt_llm/cortex.tensorrt-llm/cortex.tensorrt-llm.tar.gz | awk '{ print $1 }' > sha512.txt
size=$(stat -c%s ./cpp/tensorrt_llm/cortex.tensorrt-llm/cortex.tensorrt-llm.tar.gz)
echo "checksum=$(cat sha512.txt)" >> $GITHUB_ENV
echo "size=$size" >> $GITHUB_ENV
## Write for matrix outputs workaround
- uses: cloudposse/github-action-matrix-outputs-write@v1
id: out
with:
matrix-step-name: ${{ github.job }}
matrix-key: ${{ matrix.os }}-${{ matrix.name }}
outputs: |-
sha512: ${{ env.checksum }}
size: ${{ env.size }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: cortex.tensorrt-llm-${{ matrix.os }}-${{ matrix.name }}
path: cpp/tensorrt_llm/cortex.tensorrt-llm/cortex.tensorrt-llm.tar.gz
- uses: actions/[email protected]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
asset_path: cpp/tensorrt_llm/cortex.tensorrt-llm/cortex.tensorrt-llm.tar.gz
asset_name: cortex.tensorrt-llm-${{ needs.create-draft-release.outputs.version }}-${{ matrix.os }}-${{ matrix.name }}.tar.gz
asset_content_type: application/gzip
- name: Upload ccache to s3
continue-on-error: true
if: always() && runner.os == 'Windows'
run: |
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
refreshenv
aws s3 sync ${{ matrix.ccache-dir }} s3://${{ secrets.MINIO_BUCKET_NAME }}/${{ matrix.s3-key-prefix }} --endpoint ${{ secrets.MINIO_ENDPOINT }}
env:
AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"
- name: Upload ccache to s3
continue-on-error: true
if: always() && runner.os == 'Linux'
run: |
aws s3 sync ${{ matrix.ccache-dir }} s3://${{ secrets.MINIO_BUCKET_NAME }}/${{ matrix.s3-key-prefix }} --endpoint ${{ secrets.MINIO_ENDPOINT }}
env:
AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"
## Read matrix outputs
read:
runs-on: ubuntu-latest
needs: [build-and-test]
steps:
- uses: cloudposse/github-action-matrix-outputs-read@v1
id: read
with:
matrix-step-name: build-and-test
outputs:
result: "${{ steps.read.outputs.result }}"
create-checksum-file:
runs-on: ubuntu-20-04
permissions:
contents: write
needs: [read, create-draft-release]
steps:
- name: Download cuda dependencies from s3 and create checksum
run: |
wget http://minio.jan.ai:9000/cicd/dist/cuda-dependencies/12.4/linux/cuda.tar.gz -O /tmp/cuda-12-4-linux-amd64.tar.gz
# wget http://minio.jan.ai:9000/cicd/dist/cuda-dependencies/12.4/windows/cuda.tar.gz -O /tmp/cuda-12-4-windows-amd64.tar.gz
version=${{ needs.create-draft-release.outputs.version }}
outputs=${{ toJson(needs.read.outputs.result) }}
echo $outputs
echo "version: $version" > checksum.yml
echo "files:" >> checksum.yml
echo "$outputs" | jq -r --arg version "$version" '
.sha512 as $sha512 |
.size as $size |
(.sha512 | keys[]) as $key |
"- url: cortex.llamacpp-\($version)-\($key).tar.gz\n sha512: >-\n \($sha512[$key])\n size: \($size[$key])"
' >> checksum.yml
echo "- url: cuda-12-4-linux-amd64.tar.gz" >> checksum.yml
echo " sha512: >-" >> checksum.yml
echo " $(sha512sum /tmp/cuda-12-4-linux-amd64.tar.gz | awk '{ print $1 }')" >> checksum.yml
echo " size: $(stat -c%s /tmp/cuda-12-4-linux-amd64.tar.gz)" >> checksum.yml
# echo "- url: cuda-12-4-windows-amd64.tar.gz" >> checksum.yml
# echo " sha512: >-" >> checksum.yml
# echo " $(sha512sum /tmp/cuda-12-4-windows-amd64.tar.gz | awk '{ print $1 }')" >> checksum.yml
# echo " size: $(stat -c%s /tmp/cuda-12-4-windows-amd64.tar.gz)" >> checksum.yml
cat checksum.yml
- name: Upload checksum.yml to GitHub Release
uses: actions/upload-release-asset@v1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
asset_path: ./checksum.yml
asset_name: checksum.yml
asset_content_type: text/yaml
- name: upload cuda-12-4-linux-amd64.tar.gz to Github Release
uses: actions/upload-release-asset@v1
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
asset_path: /tmp/cuda-12-4-linux-amd64.tar.gz
asset_name: cuda-12-4-linux-amd64.tar.gz
asset_content_type: application/gzip
# - name: upload cuda-12-4-windows-amd64.tar.gz to Github Release
# uses: actions/upload-release-asset@v1
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
# asset_path: /tmp/cuda-12-4-windows-amd64.tar.gz
# asset_name: cuda-12-4-windows-amd64.tar.gz
# asset_content_type: application/gzip