dev #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Windows | |
| on: | |
| pull_request: | |
| branches: [develop] | |
| paths-ignore: | |
| - .github/workflows/Linux.yml | |
| - .github/workflows/macOS.yml | |
| - .github/workflows/iOS.yml | |
| - .github/workflows/Android.yml | |
| - .github/workflows/AutoMerger.yml | |
| - .gitignore | |
| - LICENSE | |
| - README.md | |
| push: | |
| branches: [main, develop] | |
| paths-ignore: | |
| - .github/workflows/Linux.yml | |
| - .github/workflows/macOS.yml | |
| - .github/workflows/iOS.yml | |
| - .github/workflows/Android.yml | |
| - .github/workflows/AutoMerger.yml | |
| - .gitignore | |
| - LICENSE | |
| - README.md | |
| jobs: | |
| build: | |
| name: ${{ matrix.compiler }} ${{ matrix.arch }} (${{ matrix.kind }}/${{ matrix.mode }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [windows-2025] | |
| compiler: [LLVM-libc++] | |
| arch: [x64] | |
| kind: [static, shared] | |
| mode: [release, debug] | |
| runs-on: ${{ matrix.os }} | |
| if: ${{ !contains(github.event.head_commit.message, 'ci skip') }} | |
| concurrency: | |
| group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.arch }}-${{ matrix.kind }}-${{ matrix.mode }} | |
| steps: | |
| - name: Configure Pagefile | |
| uses: al-cheb/configure-pagefile-action@v1.3 | |
| with: | |
| minimum-size: 8GB | |
| maximum-size: 32GB | |
| disk-root: "D:" | |
| - name: Enable git long paths | |
| run: git config --system core.longpaths true | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set XMake env | |
| run: | | |
| echo "XMAKE_ROOTDIR=${{ github.workspace }}/.xmake-cache" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| echo "${{ github.workspace }}/.xmake-cache" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| echo "XMAKE_PKG_INSTALLDIR=${{ github.workspace }}/.xmake-packages" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Generate XMake cachekey | |
| id: xmake_cachekey | |
| run: echo "key=$(date +'%W')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Restore cached XMake | |
| id: restore-xmakecache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ${{ env.XMAKE_ROOTDIR }} | |
| key: ${{ matrix.os }}-${{ matrix.arch }}-W${{ steps.xmake_cachekey.outputs.key }} | |
| - name: Setup XMake | |
| if: ${{ !steps.restore-xmakecache.outputs.cache-hit }} | |
| uses: xmake-io/github-action-setup-xmake@v1 | |
| with: | |
| xmake-version: Arthapz/xmake#branch@fix-cmake-clang-windows | |
| actions-cache-folder: '.xmake-cache' | |
| - name: Cache XMake | |
| if: ${{ !steps.restore-xmakecache.outputs.cache-hit }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ${{ env.XMAKE_ROOTDIR }} | |
| key: ${{ steps.restore-xmakecache.outputs.cache-primary-key }} | |
| - name: Update xmake repository | |
| run: xmake repo --update | |
| - name: Generate packages cachekey | |
| id: packages_cachekey | |
| run: echo "hash=$(xmake l utils.ci.packageskey)" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Restore cached packages | |
| id: restore-packagescache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ${{ env.XMAKE_PKG_INSTALLDIR }} | |
| key: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.arch }}-${{ matrix.mode }}-${{ steps.packages_cachekey.outputs.hash }} | |
| - name: Restore cached LLVM | |
| id: restore-llvmcache | |
| if: ${{ startsWith(matrix.compiler, 'LLVM') }} | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ${{ github.workspace }}/llvm.7z | |
| key: ${{ matrix.os }}-LLVM-21-${{ matrix.arch }} | |
| - name: Download LLVM | |
| if: ${{ startsWith(matrix.compiler, 'LLVM') && !steps.restore-llvmcache.outputs.cache-hit }} | |
| run: | | |
| curl.exe -o "${{ github.workspace }}/llvm.7z" -LO https://github.com/Arthapz/llvm-prebuilt/releases/download/llvm-21/llvm.7z | |
| - name: Extract LLVM | |
| if: ${{ startsWith(matrix.compiler, 'LLVM') }} | |
| run: | | |
| 7z x "${{ github.workspace }}/llvm.7z" -o"${{ github.workspace }}/llvm" | |
| - name: Cache LLVM | |
| if: ${{ startsWith(matrix.compiler, 'LLVM') && !steps.restore-llvmcache.outputs.cache-hit }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ${{ github.workspace }}/llvm | |
| key: ${{ steps.restore-llvmcache.outputs.cache-primary-key }} | |
| - name: Configure & Install dependencies | |
| id: configure_llvm_libcpp | |
| if: ${{ matrix.compiler == 'LLVM-libc++' }} | |
| run: | | |
| xmake f -vD ` | |
| --yes ` | |
| -m ${{ (matrix.mode == 'release' || matrix.mode == 'debug') && matrix.mode || 'releasedbg' }} ` | |
| -k ${{ matrix.kind }} ` | |
| --on_ci=y ` | |
| --toolchain=llvm ` | |
| --sanitizers=yes ` | |
| --sdk="${{ github.workspace }}/llvm/" ` | |
| --runtimes="c++_shared" ` | |
| --policies="platform.longpaths" | |
| - name: Configure & Install dependencies | |
| id: configure_llvm_msstl | |
| if: ${{ matrix.compiler == 'LLVM-msstl' }} | |
| run: | | |
| xmake f -vD ` | |
| --yes ` | |
| -m ${{ (matrix.mode == 'release' || matrix.mode == 'debug') && matrix.mode || 'releasedbg' }} ` | |
| -k ${{ matrix.kind }} ` | |
| --on_ci=y ` | |
| --toolchain=llvm ` | |
| --sanitizers=yes ` | |
| --sdk="${{ github.workspace }}/llvm/" ` | |
| --policies="platform.longpaths" | |
| - name: Configure & Install dependencies | |
| id: configure_msvc | |
| if: ${{ matrix.compiler == 'MSVC' }} | |
| run: | | |
| xmake f -vD ` | |
| --yes ` | |
| -a ${{ matrix.arch }} ` | |
| -m ${{ (matrix.mode == 'release' || matrix.mode == 'debug') && matrix.mode || 'releasedbg' }} ` | |
| -k ${{ matrix.kind }} ` | |
| --sanitizers=yes ` | |
| --on_ci=y ` | |
| --policies="platform.longpaths" | |
| - name: Cache packages | |
| if: ${{ !steps.restore-packagescache.outputs.cache-hit }} | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ${{ env.XMAKE_PKG_INSTALLDIR }} | |
| key: ${{ steps.restore-packagescache.outputs.cache-primary-key }} | |
| - name: Build | |
| id: build | |
| run: | | |
| xmake b -vD | |
| - name: Run unit tests | |
| if: ${{ matrix.compiler == 'LLVM-libc++' }} | |
| run: | | |
| cp "${{ github.workspace }}/llvm/bin/c++.dll" "${{ github.workspace }}/build/windows/${{ matrix.arch }}/${{ (matrix.mode == 'release' || matrix.mode == 'debug') && matrix.mode || 'releasedbg' }}/" | |
| cp "${{ github.workspace }}/llvm/lib/clang/21/lib/windows/clang_rt.asan_dynamic-x86_64.dll" "${{ github.workspace }}/build/windows/${{ matrix.arch }}/${{ (matrix.mode == 'release' || matrix.mode == 'debug') && matrix.mode || 'releasedbg' }}/" | |
| xmake test -vD | |
| - name: Run unit tests | |
| if: ${{ matrix.compiler != 'LLVM-libc++' }} | |
| run: | | |
| xmake test -vD | |
| - name: Installation | |
| run: xmake install -vD --installdir="${{ github.workspace }}/output" | |
| - name: Add libc++ dll | |
| if: ${{ matrix.compiler == 'LLVM-libc++' }} | |
| run: | | |
| cp "${{ github.workspace }}/llvm/bin/c++.dll" "${{ github.workspace }}/output/bin/" | |
| cp "${{ github.workspace }}/llvm/lib/clang/21/lib/windows/clang_rt.asan_dynamic-x86_64.dll" "${{ github.workspace }}/output/bin/" | |
| - name: Upload artifacts | |
| id: upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.os }}-${{ matrix.compiler }}-${{ matrix.arch }}-LLVM-${{ matrix.kind }}-${{ matrix.mode }} | |
| path: ${{ github.workspace }}/output |