Skip to content

Commit 39bf8c4

Browse files
committed
Add and update GH Actions workflows for LLVM Clang builds
Signed-off-by: Dennis Ameling <[email protected]>
1 parent f2bd10f commit 39bf8c4

File tree

2 files changed

+172
-27
lines changed

2 files changed

+172
-27
lines changed

.github/workflows/git-artifacts.yml

Lines changed: 72 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ env:
2323
BUILD_ONLY: "${{github.event.inputs.build_only}}"
2424
REPOSITORY: "${{github.event.inputs.repository}}"
2525
REF: "${{github.event.inputs.ref}}"
26+
LLVM_VERSION: 20211002
27+
LLVM_TYPE: msvcrt
28+
VCPKG_VERSION_FOR_CACHE: 1
2629

2730
jobs:
2831
bundle-artifacts:
@@ -200,9 +203,9 @@ jobs:
200203
printf '#!/bin/sh\n\nexec /mingw64/bin/git.exe "$@"\n' >/usr/bin/git &&
201204
202205
# Restrict `PATH` to MSYS2 and to Visual Studio (to let `cv2pdb` find the relevant DLLs)
203-
PATH="/mingw64/bin:/usr/bin:/C/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin${{matrix.arch.bin}}:/C/Windows/system32"
206+
PATH="/mingw64/bin:/usr/bin:/C/Windows/system32"
204207
205-
type -p mspdb140.dll || exit 1
208+
# type -p mspdb140.dll || exit 1
206209
sh -x /usr/src/build-extra/please.sh build-mingw-w64-git --only-${{matrix.arch.bitness}}-bit --build-src-pkg -o artifacts HEAD &&
207210
cp bundle-artifacts/ver artifacts/ &&
208211
if test -n "$GPGKEY"
@@ -268,43 +271,85 @@ jobs:
268271
git remote add -f origin https://github.com/git-for-windows/git &&
269272
git fetch --tags bundle-artifacts/git.bundle $(cat bundle-artifacts/next_version) &&
270273
git reset --hard $(cat bundle-artifacts/next_version)
271-
- name: initialize vcpkg
274+
- name: Set LLVM path
272275
if: env.SKIP != 'true'
273-
uses: actions/checkout@v2
276+
shell: bash
277+
run: echo "LLVM_PATH=`pwd`/llvm-build/llvm-mingw-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}-x86_64" >> $GITHUB_ENV
278+
- name: Cache LLVM
279+
if: env.SKIP != 'true'
280+
id: cache-llvm
281+
uses: actions/cache@v2
274282
with:
275-
repository: 'microsoft/vcpkg'
276-
path: 'compat/vcbuild/vcpkg'
277-
- name: download vcpkg artifacts
283+
path: llvm-build
284+
key: llvm-build-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}
285+
- shell: pwsh
286+
if: steps.cache-llvm.outputs.cache-hit != 'true' && env.SKIP != 'true'
287+
run: |
288+
Invoke-WebRequest -Uri "https://github.com/mstorsjo/llvm-mingw/releases/download/${{ env.LLVM_VERSION }}/llvm-mingw-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}-x86_64.zip" -OutFile "./llvm.zip"
289+
Expand-Archive -LiteralPath './llvm.zip' -DestinationPath ./llvm-build
290+
- name: Setup MSYS2
278291
if: env.SKIP != 'true'
279-
uses: git-for-windows/get-azure-pipelines-artifact@v0
292+
uses: msys2/setup-msys2@v2
280293
with:
281-
repository: git/git
282-
definitionId: 9
283-
- name: add msbuild to PATH
294+
msystem: MSYS
295+
- name: Add clangarm64 server
284296
if: env.SKIP != 'true'
285-
uses: microsoft/setup-msbuild@v1
286-
- name: copy dlls to root
297+
shell: msys2 {0}
298+
run: |
299+
cat <<EOF >> /etc/pacman.conf
300+
[clangarm64]
301+
Server = https://mirror.msys2.org/mingw/clangarm64/
302+
EOF
303+
- name: Update package database with arm64 entries
287304
if: env.SKIP != 'true'
288-
shell: powershell
305+
shell: msys2 {0}
306+
run: pacman -Sy
307+
- name: Install packages
308+
if: env.SKIP != 'true'
309+
shell: msys2 {0}
289310
run: |
290-
& compat\vcbuild\vcpkg_copy_dlls.bat release arm64-windows
291-
if (!$?) { exit(1) }
292-
- name: generate Visual Studio solution
311+
pacman -S --noconfirm mingw-w64-clang-aarch64-openssl mingw-w64-clang-aarch64-zlib \
312+
mingw-w64-clang-aarch64-curl mingw-w64-clang-aarch64-expat \
313+
mingw-w64-clang-aarch64-libiconv mingw-w64-clang-aarch64-toolchain
314+
- name: Set MSYS2 root as env variable
293315
if: env.SKIP != 'true'
294-
shell: bash
316+
shell: msys2 {0}
317+
run: echo "MSYS_ROOT=$(cygpath -m /)" >> $GITHUB_ENV
318+
- shell: bash
319+
if: env.SKIP != 'true'
320+
# We need to remove mingw32-make.exe (which is arm64-native) as it clashes with cmake
295321
run: |
296-
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/arm64-windows \
297-
-DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON -DCMAKE_GENERATOR_PLATFORM=arm64 -DVCPKG_ARCH=arm64-windows \
298-
-DCMAKE_INSTALL_PREFIX="`pwd`/git-arm64" -DSKIP_DASHED_BUILT_INS=ON -DHOST_CPU=arm64
299-
- name: MSBuild
322+
rm ${{ env.MSYS_ROOT }}clangarm64/bin/mingw32-make.exe
323+
mkdir `pwd`/git-arm64
324+
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=${{ env.MSYS_ROOT }}clangarm64 -DNO_GETTEXT=YesPlease \
325+
-DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON \
326+
-DCMAKE_C_COMPILER=${{ env.LLVM_PATH }}/bin/aarch64-w64-mingw32-clang.exe \
327+
-DCMAKE_CXX_COMPILER=${{ env.LLVM_PATH }}/bin/aarch64-w64-mingw32-clang++.exe \
328+
-DCMAKE_RC_COMPILER=${{ env.LLVM_PATH }}/bin/aarch64-w64-mingw32-windres.exe \
329+
-DCMAKE_INSTALL_PREFIX=`pwd`/git-arm64 -DSKIP_DASHED_BUILT_INS=ON -DHOST_CPU=arm64 -DUSE_VCPKG=OFF -G "MinGW Makefiles"
330+
- shell: pwsh
300331
if: env.SKIP != 'true'
301-
run: msbuild git.sln -property:Configuration=Release
302-
- name: Link the Git executables
332+
run: make -j2
333+
- shell: pwsh
303334
if: env.SKIP != 'true'
304-
run: msbuild INSTALL.vcxproj -property:Configuration=Release
335+
run: make install
336+
# Workaround to get the DLLs into the installation directory
337+
- name: Copy DLLs
338+
if: env.SKIP != 'true'
339+
shell: msys2 {0}
340+
run: |
341+
DLLS="libbrotlicommon.dll libbrotlidec.dll libcrypto-1_1.dll libcurl-4.dll libexpat-1.dll \
342+
libiconv-2.dll libidn2-0.dll libintl-8.dll libnghttp2-14.dll libpsl-5.dll libssh2-1.dll \
343+
libssl-1_1.dll libunistring-2.dll libwinpthread-1.dll libzstd.dll zlib1.dll"
344+
345+
for ITEM in ${DLLS}
346+
do
347+
cp /clangarm64/bin/${ITEM} `pwd`/git-arm64/bin
348+
cp /clangarm64/bin/${ITEM} `pwd`/git-arm64/libexec/git-core
349+
done
305350
- name: upload build artifacts
306351
if: env.SKIP != 'true'
307-
uses: actions/upload-artifact@v1
352+
uses: actions/upload-artifact@v2
308353
with:
309354
name: arm64-artifacts
310355
path: ./git-arm64
@@ -433,7 +478,7 @@ jobs:
433478
fi &&
434479
openssl dgst -sha256 artifacts/${{matrix.artifact.fileprefix}}-*.${{matrix.artifact.fileextension}} | sed "s/.* //" >artifacts/sha-256.txt
435480
- name: Copy package-versions and pdbs
436-
if: env.SKIP != 'true' && matrix.artifact.name == 'installer'
481+
if: env.SKIP != 'true' && matrix.artifact.name == 'installer' && 'skipThisForNow' == 'dummy'
437482
shell: bash
438483
run: |
439484
cp /usr/src/build-extra/installer/package-versions.txt artifacts/ &&

.github/workflows/llvm-build.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: LLVM build
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
LLVM_VERSION: 20211002
8+
LLVM_TYPE: msvcrt
9+
DEVELOPER: 1
10+
11+
jobs:
12+
llvm-build:
13+
runs-on: windows-latest
14+
env:
15+
NO_PERL: 1
16+
GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'"
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- arch: x64
22+
compilerArch: x86_64
23+
msysArch: clang64
24+
- arch: arm64
25+
compilerArch: aarch64
26+
msysArch: clangarm64
27+
steps:
28+
- uses: actions/checkout@v2
29+
- name: Set LLVM path
30+
shell: bash
31+
run: echo "LLVM_PATH=`pwd`/llvm-build/llvm-mingw-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}-x86_64" >> $GITHUB_ENV
32+
- name: Cache LLVM
33+
id: cache-llvm
34+
uses: actions/cache@v2
35+
with:
36+
path: llvm-build
37+
key: llvm-build-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}
38+
- shell: pwsh
39+
if: steps.cache-llvm.outputs.cache-hit != 'true'
40+
run: |
41+
Invoke-WebRequest -Uri "https://github.com/mstorsjo/llvm-mingw/releases/download/${{ env.LLVM_VERSION }}/llvm-mingw-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}-x86_64.zip" -OutFile "./llvm.zip"
42+
Expand-Archive -LiteralPath './llvm.zip' -DestinationPath ./llvm-build
43+
- name: Setup MSYS2
44+
uses: msys2/setup-msys2@v2
45+
with:
46+
msystem: MSYS
47+
- name: Add clangarm64 server
48+
if: matrix.msysArch == 'clangarm64'
49+
shell: msys2 {0}
50+
run: |
51+
cat <<EOF >> /etc/pacman.conf
52+
[clangarm64]
53+
Server = https://mirror.msys2.org/mingw/clangarm64/
54+
EOF
55+
- name: Update package database with arm64 entries
56+
if: matrix.msysArch == 'clangarm64'
57+
shell: msys2 {0}
58+
run: pacman -Sy
59+
- name: Install packages
60+
shell: msys2 {0}
61+
run: |
62+
pacman -S --noconfirm mingw-w64-clang-${{ matrix.compilerArch }}-openssl mingw-w64-clang-${{ matrix.compilerArch }}-zlib \
63+
mingw-w64-clang-${{ matrix.compilerArch }}-curl mingw-w64-clang-${{ matrix.compilerArch }}-expat \
64+
mingw-w64-clang-${{ matrix.compilerArch }}-libiconv mingw-w64-clang-${{ matrix.compilerArch }}-toolchain
65+
- name: Set MSYS2 root as env variable
66+
shell: msys2 {0}
67+
run: echo "MSYS_ROOT=$(cygpath -m /)" >> $GITHUB_ENV
68+
- shell: bash
69+
# We need to remove mingw32-make.exe (which is arm64-native) as it clashes with cmake
70+
run: |
71+
rm ${{ env.MSYS_ROOT }}${{ matrix.msysArch }}/bin/mingw32-make.exe
72+
mkdir `pwd`/artifacts
73+
cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=${{ env.MSYS_ROOT }}${{ matrix.msysArch }} -DNO_GETTEXT=YesPlease \
74+
-DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON \
75+
-DCMAKE_C_COMPILER=${{ env.LLVM_PATH }}/bin/${{ matrix.compilerArch }}-w64-mingw32-clang.exe \
76+
-DCMAKE_CXX_COMPILER=${{ env.LLVM_PATH }}/bin/${{ matrix.compilerArch }}-w64-mingw32-clang++.exe \
77+
-DCMAKE_RC_COMPILER=${{ env.LLVM_PATH }}/bin/${{ matrix.compilerArch }}-w64-mingw32-windres.exe \
78+
-DCMAKE_INSTALL_PREFIX=`pwd`/artifacts -DSKIP_DASHED_BUILT_INS=ON -DHOST_CPU=${{ matrix.arch }} -DUSE_VCPKG=OFF -G "MinGW Makefiles"
79+
- shell: pwsh
80+
run: make -j2
81+
- shell: pwsh
82+
run: make install
83+
# Workaround to get the DLLs into the installation directory
84+
- name: Copy DLLs
85+
shell: msys2 {0}
86+
run: |
87+
DLLS="libbrotlicommon.dll libbrotlidec.dll libcrypto-1_1.dll libcurl-4.dll libexpat-1.dll \
88+
libiconv-2.dll libidn2-0.dll libintl-8.dll libnghttp2-14.dll libpsl-5.dll libssh2-1.dll \
89+
libssl-1_1.dll libunistring-2.dll libwinpthread-1.dll libzstd.dll zlib1.dll"
90+
91+
for ITEM in ${DLLS}
92+
do
93+
cp /${{ matrix.msysArch }}/bin/${ITEM} `pwd`/artifacts/bin
94+
cp /${{ matrix.msysArch }}/bin/${ITEM} `pwd`/artifacts/libexec/git-core
95+
done
96+
- name: upload build artifacts
97+
uses: actions/upload-artifact@v2
98+
with:
99+
name: llvm-artifacts-${{ matrix.arch }}
100+
path: artifacts

0 commit comments

Comments
 (0)