-
Notifications
You must be signed in to change notification settings - Fork 120
245 lines (219 loc) · 8.81 KB
/
release.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
on:
push:
tags:
- 'v*'
name: Create Release
jobs:
windows-binary:
name: Binary Release (Windows)
runs-on: windows-2022
defaults:
run:
shell: pwsh
strategy:
matrix:
VER: [v143]
GEN: [Visual Studio 17 2022]
BIN: [x64, x86]
env:
UseMultiToolTask: true
EnforceProcessCountAcrossBuilds: true
MultiProcMaxCount: 3
steps:
- name: Checkout OpenCL-SDK
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Configure
run: |
$Bin = if('${{matrix.BIN}}' -eq 'x86') {'Win32'} else {'x64'}
& cmake `
-G '${{matrix.GEN}}' `
-A ${Bin} `
-T ${{matrix.VER}} `
-S "${env:GITHUB_WORKSPACE}" `
-B "${env:GITHUB_WORKSPACE}\build" `
-D CMAKE_INSTALL_PREFIX="${env:GITHUB_WORKSPACE}\install" `
-D BUILD_DOCS=OFF `
-D BUILD_TESTING=OFF `
-D BUILD_EXAMPLES=OFF `
-D OPENCL_SDK_BUILD_SAMPLES=OFF `
-D OPENCL_ICD_LOADER_BUILD_TESTING=OFF `
-D CMAKE_POLICY_DEFAULT_CMP0096=NEW
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-SDK failed." }
- name: Check version number
run: |
if ( -not (`
Get-Content ${env:GITHUB_WORKSPACE}\build\CMakeCache.txt | `
Select-String -Pattern ('CMAKE_PROJECT_VERSION:STATIC=' + '${{github.ref_name}}'.Replace('v','')) `
)) `
{ throw 'CMake project version mismatches Git tag name (without leading "v")'}
- name: Build
run: |
foreach ($Config in "Debug","Release") { `
& cmake `
--build "${env:GITHUB_WORKSPACE}\build" `
--config $Config `
-- `
/verbosity:minimal `
/noLogo
if ($LASTEXITCODE -ne 0) { throw "Building OpenCL-SDK in $Config failed." }
}
- name: Package
run: |
& cpack `
--config "${env:GITHUB_WORKSPACE}\build\CPackConfig.cmake" `
-G ZIP `
-C 'Debug;Release' `
-D CPACK_PACKAGE_FILE_NAME='OpenCL-SDK-${{github.ref_name}}-Win-${{matrix.BIN}}' `
-B "${env:GITHUB_WORKSPACE}\package"
if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK failed." }
- name: Upload
uses: softprops/action-gh-release@v2
with:
draft: true
token: ${{ secrets.ACTIONS_CREATE_RELEASE_TOKEN }}
files: |
package/OpenCL-SDK-${{github.ref_name}}-Win-${{matrix.BIN}}.zip
source:
name: Source Release (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: pwsh
strategy:
matrix:
OS: [ubuntu-20.04, windows-2022]
env:
DEB_INSTALLATION_PATH: /usr
steps:
- name: Checkout OpenCL-SDK
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Configure
run: |
& cmake `
-S "${env:GITHUB_WORKSPACE}" `
-B "${env:GITHUB_WORKSPACE}/build" `
-D BUILD_DOCS=OFF `
-D BUILD_TESTING=OFF `
-D BUILD_EXAMPLES=OFF `
-D OPENCL_SDK_BUILD_SAMPLES=OFF `
-D OPENCL_ICD_LOADER_BUILD_TESTING=OFF `
-D CMAKE_POLICY_DEFAULT_CMP0096=NEW `
-D CPACK_PACKAGING_INSTALL_PREFIX=$DEB_INSTALLATION_PATH
if ($LASTEXITCODE -ne 0) { throw "Configuring OpenCL-SDK failed." }
- name: Check version number
run: |
if ( -not (`
Get-Content ${env:GITHUB_WORKSPACE}/build/CMakeCache.txt | `
Select-String -Pattern ('CMAKE_PROJECT_VERSION:STATIC=' + '${{github.ref_name}}'.Replace('v','')) `
)) `
{ throw 'CMake project version mismatches Git tag name (without leading "v")'}
- name: Package (DEB)
if: ${{ contains(matrix.OS, 'ubuntu') }}
run: |
cpack `
--config "${env:GITHUB_WORKSPACE}/build/CPackSourceConfig.cmake" `
-G DEB `
-C Release `
-D CPACK_PACKAGE_FILE_NAME='OpenCL-SDK-${{github.ref_name}}-Source' `
-B "${env:GITHUB_WORKSPACE}/package-deb"
if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK deb failed." }
- name: Package (Archive)
run: |
$Generator = if('${{matrix.OS}}' -match 'windows') {'ZIP'} else {'TGZ'}
& cpack `
--config "${env:GITHUB_WORKSPACE}/build/CPackSourceConfig.cmake" `
-G $Generator `
-C Release `
-D CPACK_SOURCE_IGNORE_FILES="/\\.git/;/\\.gitignore;/\\.gitmodules;/\\.gitlab/;/\\.github/;/\\.reuse/;/\\.appveyor.yml;/build/;/install/;/package/" `
-D CPACK_PACKAGE_FILE_NAME='OpenCL-SDK-${{github.ref_name}}-Source' `
-B "${env:GITHUB_WORKSPACE}/package"
if ($LASTEXITCODE -ne 0) { throw "Packaging OpenCL-SDK source failed." }
- name: Upload
uses: softprops/action-gh-release@v2
with:
draft: true
token: ${{ secrets.ACTIONS_CREATE_RELEASE_TOKEN }}
files: |
package/OpenCL-SDK-${{github.ref_name}}-Source.*
package-deb/OpenCL-SDK-${{github.ref_name}}-Source.*
ppa:
if: false
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
OPENCL_HEADERS_REPOSITORY: mfep/OpenCL-Headers
OPENCL_ICD_LOADER_REPOSITORY: mfep/OpenCL-ICD-Loader
OPENCL_CLHPP_REPOSITORY: mfep/OpenCL-CLHPP
distroseries: jammy
steps:
- name: Add PPA
run: sudo add-apt-repository -y ppa:${{ vars.PPA }}
- name: Install prerequisites
run: sudo apt-get update -qq && sudo apt-get install -y
cmake
devscripts
debhelper-compat=13
opencl-c-headers
opencl-clhpp-headers
khronos-opencl-loader-libopencl1
khronos-opencl-loader-opencl-dev
clinfo
- name: Import GPG signing key
run: echo "${{ secrets.DEB_SIGNING_KEY }}" | gpg --import
- name: Download and extract source code (OpenCL-SDK)
run: |
wget -O $GITHUB_WORKSPACE/source.orig.tar.gz https://github.com/$GITHUB_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/source.orig.tar.gz -C $GITHUB_WORKSPACE
mv $GITHUB_WORKSPACE/OpenCL-SDK-* $GITHUB_WORKSPACE/OpenCL-SDK
- name: Download and extract source code (OpenCL-Headers)
run: |
wget -O $GITHUB_WORKSPACE/opencl-headers.tar.gz https://github.com/$OPENCL_HEADERS_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/opencl-headers.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers
mv $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers-* $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-Headers
- name: Download and extract source code (OpenCL-ICD-Loader)
run: |
wget -O $GITHUB_WORKSPACE/opencl-icd-loader.tar.gz https://github.com/$OPENCL_ICD_LOADER_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/opencl-icd-loader.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader
mv $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader-* $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-ICD-Loader
- name: Download and extract source code (OpenCL-CLHPP)
run: |
wget -O $GITHUB_WORKSPACE/opencl-clhpp.tar.gz https://github.com/$OPENCL_CLHPP_REPOSITORY/archive/refs/tags/$GITHUB_REF_NAME.tar.gz
tar -xvf $GITHUB_WORKSPACE/opencl-clhpp.tar.gz -C $GITHUB_WORKSPACE/OpenCL-SDK/external
rm -rf $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP
mv $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP-* $GITHUB_WORKSPACE/OpenCL-SDK/external/OpenCL-CLHPP
- name: Configure project out-of-tree
run: cmake
-S $GITHUB_WORKSPACE/OpenCL-SDK*
-B $GITHUB_WORKSPACE/../build
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_INSTALL_PREFIX=/usr
-D BUILD_TESTING=OFF
-D OPENCL_SDK_BUILD_SAMPLES=OFF
-D LATEST_RELEASE_VERSION=$GITHUB_REF_NAME
-D CPACK_DEBIAN_PACKAGE_MAINTAINER="${{ vars.DEB_MAINTAINER }}"
-D DEBIAN_VERSION_SUFFIX=${{ vars.DEB_VERSION_SUFFIX }}
- name: Generate packaging scripts
run: cmake
-D CMAKE_CACHE_PATH=$GITHUB_WORKSPACE/../build/CMakeCache.txt
-D ORIG_ARCHIVE=$GITHUB_WORKSPACE/source.orig.tar.gz
-D LATEST_RELEASE_VERSION=$GITHUB_REF_NAME
-D DEBIAN_DISTROSERIES=${{ env.distroseries }}
-D DEBIAN_PACKAGE_MAINTAINER="${{ vars.DEB_MAINTAINER }}"
-D DEBIAN_VERSION_SUFFIX=${{ vars.DEB_VERSION_SUFFIX }}
-P $GITHUB_WORKSPACE/OpenCL-SDK*/cmake/DebSourcePkg.cmake
- name: Build source package
run: |
cd $GITHUB_WORKSPACE/OpenCL-SDK*/
debuild -S -sa
- name: Push source package to the PPA
run: dput ppa:${{ vars.PPA }} $GITHUB_WORKSPACE/*source.changes