|
| 1 | +name: LLVM build |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +env: |
| 7 | + LLVM_VERSION: 20210423 |
| 8 | + LLVM_TYPE: msvcrt |
| 9 | + VCPKG_VERSION_FOR_CACHE: 1 |
| 10 | + DEVELOPER: 1 |
| 11 | + |
| 12 | +jobs: |
| 13 | + vcpkg: |
| 14 | + runs-on: windows-latest |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + arch: [arm64, x64] |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v2 |
| 21 | + - shell: cmd |
| 22 | + run: where windres |
| 23 | + - name: Set LLVM path |
| 24 | + shell: bash |
| 25 | + run: echo "LLVM_PATH=`pwd`/llvm-build/llvm-mingw-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}-x86_64" >> $GITHUB_ENV |
| 26 | + - name: Cache LLVM |
| 27 | + id: cache-llvm |
| 28 | + uses: actions/cache@v2 |
| 29 | + with: |
| 30 | + path: llvm-build |
| 31 | + key: llvm-build-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }} |
| 32 | + - shell: pwsh |
| 33 | + if: steps.cache-llvm.outputs.cache-hit != 'true' |
| 34 | + run: | |
| 35 | + 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" |
| 36 | + Expand-Archive -LiteralPath './llvm.zip' -DestinationPath ./llvm-build |
| 37 | + - name: initialize vcpkg |
| 38 | + uses: actions/checkout@v2 |
| 39 | + with: |
| 40 | + repository: 'dennisameling/vcpkg' |
| 41 | + ref: 'llvm-mingw-clang' |
| 42 | + path: 'compat/vcbuild/vcpkg' |
| 43 | + - name: Cache vcpkg artifacts |
| 44 | + id: cache-vcpkg |
| 45 | + uses: actions/cache@v2 |
| 46 | + with: |
| 47 | + path: compat/vcbuild/vcpkg/installed |
| 48 | + key: vcpkg-cache-${{ env.VCPKG_VERSION_FOR_CACHE }}-${{ matrix.arch }}-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }} |
| 49 | + - name: build packages |
| 50 | + if: steps.cache-vcpkg.outputs.cache-hit != 'true' |
| 51 | + shell: pwsh |
| 52 | + run: .\compat\vcbuild\vcpkg_install.bat ${{ matrix.arch }}-windows-llvm-mingw |
| 53 | + env: |
| 54 | + # Temp workaround to get the paths to work |
| 55 | + LLVM_PATH: D:/a/git/git/llvm-build/llvm-mingw-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}-x86_64 |
| 56 | + VCPKG_ROOT: D:/a/git/git/compat/vcbuild/vcpkg |
| 57 | + VCPKG_KEEP_ENV_VARS: "LLVM_PATH;VCPKG_ROOT" |
| 58 | + - name: upload vcpkg artifacts |
| 59 | + uses: actions/upload-artifact@v2 |
| 60 | + with: |
| 61 | + name: vcpkg-artifacts-${{ matrix.arch }} |
| 62 | + path: compat/vcbuild/vcpkg/installed |
| 63 | + |
| 64 | + llvm-build: |
| 65 | + needs: vcpkg |
| 66 | + runs-on: windows-latest |
| 67 | + env: |
| 68 | + NO_PERL: 1 |
| 69 | + GIT_CONFIG_PARAMETERS: "'user.name=CI' 'user.email=ci@git'" |
| 70 | + strategy: |
| 71 | + fail-fast: false |
| 72 | + matrix: |
| 73 | + include: |
| 74 | + - arch: x64 |
| 75 | + compilerArch: x86_64 |
| 76 | + - arch: arm64 |
| 77 | + compilerArch: aarch64 |
| 78 | + steps: |
| 79 | + - uses: actions/checkout@v2 |
| 80 | + - name: Set LLVM path |
| 81 | + shell: bash |
| 82 | + run: echo "LLVM_PATH=`pwd`/llvm-build/llvm-mingw-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }}-x86_64" >> $GITHUB_ENV |
| 83 | + - name: Cache LLVM |
| 84 | + id: cache-llvm |
| 85 | + uses: actions/cache@v2 |
| 86 | + with: |
| 87 | + path: llvm-build |
| 88 | + key: llvm-build-${{ env.LLVM_VERSION }}-${{ env.LLVM_TYPE }} |
| 89 | + - shell: pwsh |
| 90 | + if: steps.cache-llvm.outputs.cache-hit != 'true' |
| 91 | + run: | |
| 92 | + 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" |
| 93 | + Expand-Archive -LiteralPath './llvm.zip' -DestinationPath ./llvm-build |
| 94 | + - name: initialize vcpkg |
| 95 | + uses: actions/checkout@v2 |
| 96 | + with: |
| 97 | + repository: 'microsoft/vcpkg' |
| 98 | + path: 'compat/vcbuild/vcpkg' |
| 99 | + - name: download vcpkg artifacts |
| 100 | + uses: actions/download-artifact@v2 |
| 101 | + with: |
| 102 | + name: vcpkg-artifacts-${{ matrix.arch }} |
| 103 | + path: compat/vcbuild/vcpkg/installed |
| 104 | + - name: copy dlls to root |
| 105 | + shell: cmd |
| 106 | + run: compat\vcbuild\vcpkg_copy_dlls.bat release ${{ matrix.arch }}-windows-llvm-mingw |
| 107 | + - shell: bash |
| 108 | + run: | |
| 109 | + mkdir `pwd`/artifacts |
| 110 | + cmake `pwd`/contrib/buildsystems/ -DCMAKE_PREFIX_PATH=`pwd`/compat/vcbuild/vcpkg/installed/${{ matrix.arch }}-windows-llvm-mingw -DVCPKG_ARCH=${{ matrix.arch }}-windows-llvm-mingw \ |
| 111 | + -DNO_GETTEXT=YesPlease -DPERL_TESTS=OFF -DPYTHON_TESTS=OFF -DCURL_NO_CURL_CMAKE=ON -DCMAKE_C_COMPILER=${{ env.LLVM_PATH }}/bin/${{ matrix.compilerArch }}-w64-mingw32-clang.exe \ |
| 112 | + -DCMAKE_CXX_COMPILER=${{ env.LLVM_PATH }}/bin/${{ matrix.compilerArch }}-w64-mingw32-clang++.exe -DCMAKE_INSTALL_PREFIX=`pwd`/artifacts -G "MinGW Makefiles" |
| 113 | + - shell: pwsh |
| 114 | + run: make -j2 |
| 115 | + - shell: pwsh |
| 116 | + run: make install |
| 117 | + - name: Copy DLLs |
| 118 | + shell: bash |
| 119 | + # Workaround to get the DLLs into the installation directory |
| 120 | + run: | |
| 121 | + cp `pwd`/compat/vcbuild/vcpkg/installed/${{ matrix.arch }}-windows-llvm-mingw/bin/*.dll `pwd`/artifacts/bin |
| 122 | + cp `pwd`/compat/vcbuild/vcpkg/installed/${{ matrix.arch }}-windows-llvm-mingw/bin/*.dll `pwd`/artifacts/libexec/git-core |
| 123 | + - name: upload build artifacts |
| 124 | + uses: actions/upload-artifact@v2 |
| 125 | + with: |
| 126 | + name: llvm-artifacts-${{ matrix.arch }} |
| 127 | + path: artifacts |
0 commit comments