-
Notifications
You must be signed in to change notification settings - Fork 6
299 lines (265 loc) · 13.4 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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# This file is part of mfaktc.
# Copyright (c) 2025 NStorm (https://github.com/N-Storm/)
# Copyright (C) 2009, 2010, 2011 Oliver Weihe ([email protected])
#
# mfaktc is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# mfaktc is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with mfaktc. If not, see <http://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later
name: Build mfaktc software
on:
push:
pull_request:
workflow_dispatch:
jobs:
# Begin job "build-linux"
build-linux:
runs-on: ubuntu-latest
strategy:
# When fail-fast set to true, if one job fails, all others within the same
# matrix (i.e. Linux or Windows builds) will be aborted at the same time.
fail-fast: false
matrix:
sys:
# Specified version combination must exist as CUDA container image from NVidia: nvcr.io/nvidia/cuda:${{ matrix.sys.cuda_version }}-devel-${{ matrix.sys.ct_os }}
# Available versions can be found here: https://catalog.ngc.nvidia.com/orgs/nvidia/containers/cuda/tags (note that only Ubuntus are supported by this action)
- { cuda_version: '12.8.0', ct_os: 'ubuntu24.04' }
- { cuda_version: '12.6.3', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.6.2', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.6.1', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.6.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.5.1', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.5.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.4.1', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.4.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.3.2', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.3.1', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.3.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.2.2', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.2.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.1.1', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.1.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '12.0.1', ct_os: 'ubuntu22.04' }
# - { cuda_version: '12.0.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '11.8.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '11.7.1', ct_os: 'ubuntu22.04' }
# - { cuda_version: '11.7.0', ct_os: 'ubuntu22.04' }
- { cuda_version: '11.6.2', ct_os: 'ubuntu20.04' }
# - { cuda_version: '11.6.1', ct_os: 'ubuntu20.04' }
# - { cuda_version: '11.6.0', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.5.2', ct_os: 'ubuntu20.04' }
# - { cuda_version: '11.5.1', ct_os: 'ubuntu20.04' }
# - { cuda_version: '11.5.0', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.4.3', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.3.1', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.2.2', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.1.1', ct_os: 'ubuntu20.04' }
- { cuda_version: '11.0.3', ct_os: 'ubuntu20.04' }
- { cuda_version: '10.2', ct_os: 'ubuntu18.04' }
- { cuda_version: '9.2', ct_os: 'ubuntu18.04' }
- { cuda_version: '8.0', ct_os: 'ubuntu16.04' }
env:
# We can't use GitHub direct container support on old Ubuntu versions, because actions will fail running from these due to old glibc version.
# As a workaround, Docker containers will be launched separately, running build related actions inside the container via 'docker exec', while generic actions will run on the
# host runner VM itself.
CONTAINER: "nvcr.io/nvidia/cuda:${{ matrix.sys.cuda_version }}-devel-${{ matrix.sys.ct_os }}"
steps:
- name: Start Docker Container
run: |
docker pull $CONTAINER
docker run --name build-container -d -v ${{ github.workspace }}:/workspace $CONTAINER tail -f /dev/null
- name: Fix GPG keys for NVidia repo on Ubuntu 16.04
if: matrix.sys.ct_os == 'ubuntu16.04'
env:
SCRIPT: apt-key add /workspace/3bf863cc.pub
run: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/3bf863cc.pub
docker exec build-container bash -c "$SCRIPT"
- name: Update & install required packages inside the container
id: packages
env:
SCRIPT: |
apt-get update
apt-get -y full-upgrade
apt-get install -y build-essential curl git make python3 sudo unzip wget zip
run: docker exec build-container bash -c "$SCRIPT"
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Prepare sources and gather info
id: prepare
env:
SCRIPT: |
cd /workspace
git config --global --add safe.directory /workspace
bash .github/workflows/scripts/build_helper.sh ${{ matrix.sys.cuda_version }}
run: |
docker exec build-container bash -c "$SCRIPT"
cat .github/workflows/scripts/build_helper.sh.out >> $GITHUB_OUTPUT
- name: Build from sources
env:
SCRIPT: cd /workspace/src && make -j$(nproc)
run: docker exec build-container bash -c "$SCRIPT"
- name: Prepare zip archive with the description
env:
SCRIPT: |
cd /workspace
zip -9 -j ${{ steps.prepare.outputs.BASE_NAME }}.zip *
echo "[${{ steps.prepare.outputs.BASE_NAME }}.zip](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ steps.prepare.outputs.BASE_NAME }}.zip) | \
${{ matrix.sys.cuda_version }} | ${{ steps.prepare.outputs.CC_MIN }}-${{ steps.prepare.outputs.CC_MAX }} | ${{ steps.prepare.outputs.OS_VER }} | \
${{ steps.prepare.outputs.COMPILER_VER }} | ${{ steps.prepare.outputs.NVCC_VER }}" > ${{ steps.prepare.outputs.BASE_NAME }}.txt
run: docker exec build-container bash -c "$SCRIPT"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.prepare.outputs.BASE_NAME }}
path: ${{ steps.prepare.outputs.BASE_NAME }}.*
# End job "build-linux"
# Begin job "build-win"
build-win:
runs-on: ${{ matrix.sys.os }}
strategy:
# When fail-fast set to true, if one job fails, all others within the same
# matrix (i.e. Linux or Windows builds) will be aborted at the same time.
fail-fast: false
matrix:
# Available version can be viewed at the Jimver/cuda-toolkit action sources:
# https://github.com/Jimver/cuda-toolkit/blob/v0.2.21/src/links/windows-links.ts
sys:
- { cuda_version: '12.8.0', os: 'windows-2022' }
- { cuda_version: '12.6.3', os: 'windows-2022' }
- { cuda_version: '12.5.1', os: 'windows-2022' }
- { cuda_version: '12.4.1', os: 'windows-2022' }
- { cuda_version: '12.3.2', os: 'windows-2022' }
- { cuda_version: '12.2.2', os: 'windows-2022' }
- { cuda_version: '12.1.1', os: 'windows-2022' }
- { cuda_version: '12.0.1', os: 'windows-2022' }
- { cuda_version: '11.8.0', os: 'windows-2022' }
- { cuda_version: '11.7.1', os: 'windows-2022' }
- { cuda_version: '11.6.2', os: 'windows-2022' }
- { cuda_version: '11.5.2', os: 'windows-2022' }
- { cuda_version: '11.4.4', os: 'windows-2022' }
- { cuda_version: '11.3.1', os: 'windows-2022' }
- { cuda_version: '11.2.2', os: 'windows-2019' }
- { cuda_version: '11.1.1', os: 'windows-2019' }
- { cuda_version: '11.0.1', os: 'windows-2019' }
- { cuda_version: '10.0.130', os: 'windows-2019' }
- { cuda_version: '9.2.148', os: 'windows-2019' }
- { cuda_version: '8.0.61', os: 'windows-2019' }
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Installing CUDA Toolkit
id: cuda-toolkit
uses: Jimver/[email protected]
with:
cuda: ${{ matrix.sys.cuda_version }}
sub-packages: ${{ startsWith(matrix.sys.cuda_version, '8.') && '[]' || '[ "nvcc", "cudart" ]' }}
use-local-cache: false
- name: Add CUDA bin dir to PATH
shell: powershell
run: |
[System.Environment]::SetEnvironmentVariable('PATH', "$env:CUDA_PATH\bin;$env:PATH", 'User')
- name: Prepare sources and gather info
id: prepare
shell: bash
run: |
bash .github/workflows/scripts/build_helper.sh ${{ matrix.sys.cuda_version }}
cat .github/workflows/scripts/build_helper.sh.out >> $GITHUB_OUTPUT
# MSVC 2022 installed on Windows 2022 Github Runner has PowerShell script for a Dev Shell.
- name: Build from sources (PowerShell with MSVC 2022)
if: ${{ matrix.sys.os == 'windows-2022' }}
shell: powershell
run: |
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' -Arch amd64 -HostArch amd64
cd "${{ github.workspace }}\src"
Copy-Item mfaktc.ini ..
make SHELL="powershell.exe" -f Makefile.win
# MSVC 2019 on Windows 2019 has similar script, but it doesn't allows setting arch & host_arch and defaults to x86 (32 bit) env.
# So we have to run bat file for the env, but Make uses PowerShell afterward because it's much better at handling long paths &
# quotes when invoked from Make.
# -vcvars_ver=14.0 switch enables MSVC 14.0 (2015) build environment. It's a component of MSVC 2019, not a complete MSVC instance.
- name: Build from sources (cmd.exe with MSVC 2019)
if: ${{ matrix.sys.os == 'windows-2019' }}
shell: cmd
run: |
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" x64 ${{ env.VCVARS_VER }} & cd src & copy mfaktc.ini .. & make SHELL="powershell.exe" -f Makefile.win
env:
VCVARS_VER: ${{ steps.prepare.outputs.CUDA_VER_MAJOR <= 10 && '-vcvars_ver=14.0' || '' }}
- name: Prepare build archive with description
shell: bash
run: |
choco install -y --no-progress zip
zip -9 -j "${{ steps.prepare.outputs.BASE_NAME }}.zip" *
echo "[${{ steps.prepare.outputs.BASE_NAME }}.zip](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ steps.prepare.outputs.BASE_NAME }}.zip) | \
${{ matrix.sys.cuda_version }} | ${{ steps.prepare.outputs.CC_MIN }}-${{ steps.prepare.outputs.CC_MAX }} | ${{ steps.prepare.outputs.OS_VER }} | \
${{ steps.prepare.outputs.COMPILER_VER }} | ${{ steps.prepare.outputs.NVCC_VER }}" > ${{ steps.prepare.outputs.BASE_NAME }}.txt
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.prepare.outputs.BASE_NAME }}
path: ${{ steps.prepare.outputs.BASE_NAME }}.*
# End job "build-win"
# Begin job "upload-release"
# This job expects git tag to start with the version specified by MFAKTC_VERSION in params.h
# If it's not the case, job will fail, because this means git/params.h version conflict that
# should be resolved.
upload-release:
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/')
needs: [ build-linux, build-win ]
runs-on: ubuntu-latest
permissions:
contents: write
env:
base_name: mfaktc-${{ github.ref_name }}*-cuda*/mfaktc-${{ github.ref_name }}*-cuda*
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Prepare list of release files & release notes
id: makeinfo
run: |
if ! ls ${{ env.base_name }}.txt > /dev/null 2>&1; then
echo "Error: can't find release notes with mask ${{ env.base_name }}"
echo "Make sure that git tag begins with the MFAKTC_VERSION from src/params.h"
exit 1
fi
{
echo "Binary releases (automated builds) below."
echo "Compute Capability (CC) in the table means minimum and maximum versions supported."
echo "CC versions are listed without the dot (i.e. 90 means 9.0 compute capability)."
echo
echo "File | CUDA version | Compute Capability | Build OS | Compiler version | NVCC version"
echo "--- | --- | --- | --- | --- | ---"
sort -Vr ${{ env.base_name }}.txt
} > RELEASE_NOTES.txt
{
echo 'RELEASE_FILES<<EOF'
printf '%s\n' ${{ env.base_name }}.zip | sort -Vr
echo 'EOF'
} > $GITHUB_OUTPUT
- name: Make and upload release
uses: softprops/[email protected]
with:
fail_on_unmatched_files: false
files: |
${{ steps.makeinfo.outputs.RELEASE_FILES }}
preserve_order: true
generate_release_notes: true
body_path: RELEASE_NOTES.txt
make_latest: true
# End job "upload-release"