forked from NielsMommen/vf-llvm-clang-build
-
Notifications
You must be signed in to change notification settings - Fork 0
244 lines (236 loc) · 11.5 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
name: LLVM/Clang build
on: push
env:
LLVM_VERSION: ${{ '16.0.1' }}
COMMON_CMAKE_VARS: ${{ '-DLLVM_ENABLE_PROJECTS=clang -DLLVM_BUILD_TOOLS=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DLLVM_BUILD_LLVM_DYLIB=OFF -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_ENABLE_FFI=OFF -DLLVM_ENABLE_ZLIB=OFF -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_ZSTD=OFF -DLLVM_TARGETS_TO_BUILD=X86' }}
AARCH64_CMAKE_VARS: ${{ '-DLLVM_ENABLE_PROJECTS=clang -DLLVM_BUILD_TOOLS=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DLLVM_BUILD_LLVM_DYLIB=OFF -DLLVM_ENABLE_BINDINGS=OFF -DLLVM_ENABLE_FFI=OFF -DLLVM_ENABLE_ZLIB=OFF -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_ZSTD=OFF -DLLVM_TARGETS_TO_BUILD=AArch64' }}
SHASUM_FILE: 'sha256.txt'
permissions:
id-token: write
contents: write
attestations: write
jobs:
MacOS:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
- name: Create package name
run: |
echo "PACKAGE_NAME=vf-llvm-clang-build-$(git describe --always)" >> $GITHUB_ENV
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Download llvm-project source
run: |
cd ${{ runner.temp }}
git clone --depth 1 --branch llvmorg-${{ env.LLVM_VERSION }} https://github.com/llvm/llvm-project
- name: Create build/installation directory
run: |
mkdir ${{ runner.temp }}/build
mkdir ${{ runner.temp }}/${{ env.PACKAGE_NAME }}
- name: Build
run: |
cd ${{ runner.temp }}/build
mkdir Release
cmake -G Ninja ${{ env.COMMON_CMAKE_VARS }} -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/${{ env.PACKAGE_NAME }} ${{ runner.temp }}/llvm-project/llvm
cmake --build . --target install --config Release
# Otherwise, execution permissions are lost for binaries when the 'upload Package' action is used
- name: Create build tarball
run: |
cd ${{ runner.temp }}
tar -cvzf ${{ env.PACKAGE_NAME }}-${{ runner.os }}.tar.gz ${{ env.PACKAGE_NAME }}
- name: Produce shasum 256
run: |
shasum -a 256 ${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}.tar.gz > ${{ runner.temp }}/${{ env.SHASUM_FILE }}
- uses: actions/[email protected]
with:
name: vf-llvm-clang-${{ runner.os }}
path: |
${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}.tar.gz
${{ runner.temp }}/${{ env.SHASUM_FILE }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: ${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}.tar.gz
MacOS_AArch64:
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- name: Create package name
run: |
echo "PACKAGE_NAME=vf-llvm-clang-build-$(git describe --always)" >> $GITHUB_ENV
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Download llvm-project source
run: |
cd ${{ runner.temp }}
git clone --depth 1 --branch llvmorg-${{ env.LLVM_VERSION }} https://github.com/llvm/llvm-project
- name: Create build/installation directory
run: |
mkdir ${{ runner.temp }}/build
mkdir ${{ runner.temp }}/${{ env.PACKAGE_NAME }}
- name: Build
run: |
cd ${{ runner.temp }}/build
mkdir Release
cmake -G Ninja ${{ env.AARCH64_CMAKE_VARS }} -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/${{ env.PACKAGE_NAME }} ${{ runner.temp }}/llvm-project/llvm
cmake --build . --target install --config Release
# Otherwise, execution permissions are lost for binaries when the 'upload Package' action is used
- name: Create build tarball
run: |
cd ${{ runner.temp }}
tar -cvzf ${{ env.PACKAGE_NAME }}-${{ runner.os }}-aarch64.tar.gz ${{ env.PACKAGE_NAME }}
- name: Produce shasum 256
run: |
shasum -a 256 ${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}-aarch64.tar.gz > ${{ runner.temp }}/${{ env.SHASUM_FILE }}
- uses: actions/[email protected]
with:
name: vf-llvm-clang-${{ runner.os }}
path: |
${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}-aarch64.tar.gz
${{ runner.temp }}/${{ env.SHASUM_FILE }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: ${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}-aarch64.tar.gz
Linux:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Create package name
run: |
echo "PACKAGE_NAME=vf-llvm-clang-build-$(git describe --always)" >> $GITHUB_ENV
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Download llvm-project source
run: |
cd ${{ runner.temp }}
git clone --depth 1 --branch llvmorg-${{ env.LLVM_VERSION }} https://github.com/llvm/llvm-project
- name: Create build/installation directory
run: |
mkdir ${{ runner.temp }}/build
mkdir ${{ runner.temp }}/${{ env.PACKAGE_NAME }}
- name: Build
run: |
cd ${{ runner.temp }}/build
mkdir Release
cmake -G Ninja ${{ env.COMMON_CMAKE_VARS }} -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/${{ env.PACKAGE_NAME }} ${{ runner.temp }}/llvm-project/llvm
cmake --build . --target install --config Release
# Otherwise, execution permissions are lost for binaries when the 'upload Package' action is used
- name: Create build tarball
run: |
cd ${{ runner.temp }}
tar -cvzf ${{ env.PACKAGE_NAME }}-${{ runner.os }}.tar.gz ${{ env.PACKAGE_NAME }}
- name: Produce shasum 256
run: |
shasum -a 256 ${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}.tar.gz > ${{ runner.temp }}/${{ env.SHASUM_FILE }}
- uses: actions/[email protected]
with:
name: vf-llvm-clang-${{ runner.os }}
path: |
${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}.tar.gz
${{ runner.temp }}/${{ env.SHASUM_FILE }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: ${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}.tar.gz
MinGW:
runs-on: windows-2019
strategy:
matrix:
cc_prefix:
- x86_64
- i686
steps:
- run: |
git config --global core.autocrlf input
- uses: actions/checkout@v3
- name: Create package name
run: |
echo "PACKAGE_NAME=vf-llvm-clang-build-$(git describe --always)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Download llvm-project source
run: |
cd ${{ runner.temp }}
git clone --depth 1 --branch llvmorg-${{ env.LLVM_VERSION }} https://github.com/llvm/llvm-project
- name: Create build/installation directory
run: |
New-Item -Path ${{ runner.temp }} -Name "build" -ItemType "directory"
New-Item -Path ${{ runner.temp }} -Name "${{ env.PACKAGE_NAME }}" -ItemType "directory"
- uses: cygwin/cygwin-install-action@master
with:
packages:
git
gcc-g++
python3
mingw64-${{ matrix.cc_prefix }}-gcc-g++
cmake
ninja
- name: Build
run: |
cd $(cygpath "${{ runner.temp }}/build")
mkdir Release
cmake -G Ninja ${{ env.COMMON_CMAKE_VARS }} -DCMAKE_INSTALL_PREFIX=$(cygpath "${{ runner.temp }}/${{ env.PACKAGE_NAME }}") -DCMAKE_SYSTEM_NAME=Windows -DCMAKE_C_COMPILER=${{ matrix.cc_prefix }}-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=${{ matrix.cc_prefix }}-w64-mingw32-g++ $(cygpath "${{ runner.temp }}/llvm-project/llvm")
cmake --build . --target install --config Release
shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
- name: Create build tarball
run: |
cd $(cygpath "${{ runner.temp }}")
tar -cvzf ${{ env.PACKAGE_NAME }}-${{ runner.os }}-MinGW-${{ matrix.cc_prefix }}.tar.gz ${{ env.PACKAGE_NAME }}
shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
- name: Produce shasum 256
run: |
Get-FileHash -PATH "${{ runner.temp }}\${{ env.PACKAGE_NAME }}-${{ runner.os }}-MinGW-${{ matrix.cc_prefix }}.tar.gz" -Algorithm SHA256 | Out-File -FilePath ${{ runner.temp }}/${{ env.SHASUM_FILE }} -Encoding utf8
- uses: actions/[email protected]
with:
name: vf-llvm-clang-${{ runner.os }}-MinGW-${{ matrix.cc_prefix }}
path: |
${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}-MinGW-${{ matrix.cc_prefix }}.tar.gz
${{ runner.temp }}/${{ env.SHASUM_FILE }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: ${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}-MinGW-${{ matrix.cc_prefix }}.tar.gz
MSVC:
runs-on: windows-2019
strategy:
matrix:
arch:
- 'Win32'
- 'x64'
steps:
- uses: actions/checkout@v3
- name: Create package name
run: |
echo "PACKAGE_NAME=vf-llvm-clang-build-$(git describe --always)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Download llvm-project source
run: |
cd ${{ runner.temp }}
git clone --depth 1 --branch llvmorg-${{ env.LLVM_VERSION }} https://github.com/llvm/llvm-project
- name: Create build/installation directory
run: |
New-Item -Path ${{ runner.temp }} -Name "build" -ItemType "directory"
New-Item -Path ${{ runner.temp }} -Name "${{ env.PACKAGE_NAME }}" -ItemType "directory"
- uses: ilammy/[email protected]
with:
arch: ${{ matrix.arch }}
- name: Build
run: |
cd ${{ runner.temp }}/build
cmake ${{ env.COMMON_CMAKE_VARS }} -DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/${{ env.PACKAGE_NAME }} -G "Visual Studio 16 2019" -A ${{ matrix.arch }} -Thost=x64 ${{ runner.temp }}/llvm-project/llvm
msbuild ${{ runner.temp }}/build/INSTALL.vcxproj -p:Configuration=Release -p:Platform=${{ matrix.arch }} -m
# Install cygwin so we can use GNU tar (instead of Windows' tar)
- uses: cygwin/cygwin-install-action@master
- name: Create build tarball
run: |
cd $(cygpath "${{ runner.temp }}")
tar -cvzf ${{ env.PACKAGE_NAME }}-${{ runner.os }}-MSVC-${{ matrix.arch }}.tar.gz ${{ env.PACKAGE_NAME }}
shell: C:\cygwin\bin\bash.exe --login --norc -eo pipefail -o igncr '{0}'
- name: Produce shasum 256
run: |
Get-FileHash -PATH "${{ runner.temp }}\${{ env.PACKAGE_NAME }}-${{ runner.os }}-MSVC-${{ matrix.arch }}.tar.gz" -Algorithm SHA256 | Out-File -FilePath ${{ runner.temp }}/${{ env.SHASUM_FILE }} -Encoding utf8
- uses: actions/[email protected]
with:
name: vf-llvm-clang-${{ runner.os }}-MSVC-${{ matrix.arch }}
path: |
${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}-MSVC-${{ matrix.arch }}.tar.gz
${{ runner.temp }}/${{ env.SHASUM_FILE }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: ${{ runner.temp }}/${{ env.PACKAGE_NAME }}-${{ runner.os }}-MSVC-${{ matrix.arch }}.tar.gz