-
Notifications
You must be signed in to change notification settings - Fork 120
148 lines (131 loc) · 4.51 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
on:
push:
tags:
- 'v*'
name: Create Release
jobs:
windows-binary:
runs-on: windows-2022
strategy:
matrix:
VER: [v143]
GEN: [Visual Studio 17 2022]
BIN: [x64, x86]
steps:
- name: Checkout OpenCL-SDK
uses: actions/checkout@v2
- name: Initialize git submodules
shell: pwsh
run: |
& git submodule init
& git submodule update
- name: Create Build Environment
shell: pwsh
run: |
# Parallelize MSBuild across projects
[Environment]::SetEnvironmentVariable('UseMultiToolTask', 'true', [EnvironmentVariableTarget]::User)
[Environment]::SetEnvironmentVariable('EnforceProcessCountAcrossBuilds', 'true', [EnvironmentVariableTarget]::User)
[Environment]::SetEnvironmentVariable('MultiProcMaxCount', "$env:NUMBER_OF_PROCESSORS", [EnvironmentVariableTarget]::User)
- name: Configure
shell: pwsh
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 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
- name: Check version number
shell: pwsh
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
shell: pwsh
run: |
foreach ($Config in "Debug","Release") { `
& cmake `
--build "${env:GITHUB_WORKSPACE}\build" `
--config $Config `
-- `
/verbosity:minimal `
/noLogo `
}
- name: Package Binary
shell: pwsh
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"
- name: Upload Package
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: |
package/OpenCL-SDK-${{github.ref_name}}-Win-${{matrix.BIN}}.zip
source:
name: Source Release (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
OS: [ubuntu-20.04, windows-2022]
steps:
- name: Checkout OpenCL-SDK
uses: actions/checkout@v2
- name: Initialize git submodules
shell: pwsh
run: |
& git submodule init
& git submodule update
- name: Configure
shell: pwsh
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
- name: Check version number
shell: pwsh
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 Source
shell: pwsh
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"
- name: Release Source
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: |
package/OpenCL-SDK-${{github.ref_name}}-Source.*