|
| 1 | +name: Build |
| 2 | +on: |
| 3 | + push: |
| 4 | + paths-ignore: |
| 5 | + - "**/README.md" |
| 6 | + |
| 7 | +env: |
| 8 | + USERNAME: kwsp |
| 9 | + VCPKG_ROOT: ${{ github.workspace }}/vcpkg |
| 10 | + VCPKG_EXE: ${{ github.workspace }}/vcpkg/vcpkg |
| 11 | + FEED_URL: https://nuget.pkg.github.com/kwsp/index.json |
| 12 | + VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite;nuget,https://nuget.pkg.github.com/kwsp/index.json,readwrite" |
| 13 | + |
| 14 | +jobs: |
| 15 | + Build-Win64: |
| 16 | + runs-on: windows-2022 |
| 17 | + steps: |
| 18 | + - name: Export GitHub Actions cache environment variables |
| 19 | + uses: actions/github-script@v7 |
| 20 | + with: |
| 21 | + script: | |
| 22 | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); |
| 23 | + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); |
| 24 | +
|
| 25 | + - uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + submodules: true |
| 28 | + |
| 29 | + - name: Setup VCPKG |
| 30 | + shell: pwsh |
| 31 | + run: | |
| 32 | + cd ${{ github.workspace }} |
| 33 | + git clone https://github.com/microsoft/vcpkg |
| 34 | + ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat |
| 35 | +
|
| 36 | + - name: Add NuGet sources |
| 37 | + shell: pwsh |
| 38 | + run: | |
| 39 | + .$(${{ env.VCPKG_EXE }} fetch nuget) ` |
| 40 | + sources add ` |
| 41 | + -Source "${{ env.FEED_URL }}" ` |
| 42 | + -StorePasswordInClearText ` |
| 43 | + -Name GitHubPackages ` |
| 44 | + -UserName "${{ env.USERNAME }}" ` |
| 45 | + -Password "${{ secrets.GH_PACKAGES_TOKEN }}" |
| 46 | + .$(${{ env.VCPKG_EXE }} fetch nuget) ` |
| 47 | + setapikey "${{ secrets.GH_PACKAGES_TOKEN }}" ` |
| 48 | + -Source "${{ env.FEED_URL }}" |
| 49 | +
|
| 50 | + - name: CMake configure |
| 51 | + run: cmake --preset win64 |
| 52 | + |
| 53 | + - name: CMake build |
| 54 | + run: cmake --build --preset win64-release |
| 55 | + |
| 56 | + - name: CTest |
| 57 | + shell: bash |
| 58 | + run: ctest --output-on-failure --test-dir build/win64/test/ |
| 59 | + |
| 60 | + Build-mac: |
| 61 | + runs-on: macos-latest |
| 62 | + steps: |
| 63 | + - name: Export GitHub Actions cache environment variables |
| 64 | + uses: actions/github-script@v7 |
| 65 | + with: |
| 66 | + script: | |
| 67 | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); |
| 68 | + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); |
| 69 | +
|
| 70 | + - uses: actions/checkout@v4 |
| 71 | + with: |
| 72 | + submodules: true |
| 73 | + |
| 74 | + - name: Install system-wide build tools |
| 75 | + shell: bash |
| 76 | + # Install |
| 77 | + # mono: NuGet requires a dotnet runtime |
| 78 | + # ninja: Build system |
| 79 | + # llvm: Just for clang-tidy. Need to add to path. |
| 80 | + # Just add clang-tidy to path, not all of LLVM clang. |
| 81 | + run: | |
| 82 | + brew install mono ninja llvm |
| 83 | + ln -s $(brew --prefix llvm)/bin/clang-tidy /usr/local/bin/clang-tidy |
| 84 | + brew install autoconf autoconf-archive automake libtool |
| 85 | +
|
| 86 | + - name: Setup VCPKG |
| 87 | + shell: bash |
| 88 | + run: | |
| 89 | + cd ${{ github.workspace }} |
| 90 | + git clone https://github.com/microsoft/vcpkg |
| 91 | + ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.sh |
| 92 | +
|
| 93 | + - name: Add NuGet sources |
| 94 | + shell: bash |
| 95 | + env: |
| 96 | + gh_packages_secret: ${{ secrets.GH_PACKAGES_TOKEN }} |
| 97 | + if: ${{ env.gh_packages_secret != '' }} |
| 98 | + run: | |
| 99 | + mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \ |
| 100 | + sources add \ |
| 101 | + -Source "${{ env.FEED_URL }}" \ |
| 102 | + -StorePasswordInClearText \ |
| 103 | + -Name GitHubPackages \ |
| 104 | + -UserName "${{ env.USERNAME }}" \ |
| 105 | + -Password "${{ secrets.GH_PACKAGES_TOKEN }}" |
| 106 | + mono `${{ env.VCPKG_EXE }} fetch nuget | tail -n 1` \ |
| 107 | + setapikey "${{ secrets.GH_PACKAGES_TOKEN }}" \ |
| 108 | + -Source "${{ env.FEED_URL }}" |
| 109 | +
|
| 110 | + - name: CMake configure |
| 111 | + shell: bash |
| 112 | + run: cmake --preset clang |
| 113 | + |
| 114 | + - name: CMake build |
| 115 | + shell: bash |
| 116 | + run: cmake --build --preset clang-release |
| 117 | + |
| 118 | + - name: CTest |
| 119 | + shell: bash |
| 120 | + run: ctest --output-on-failure --test-dir build/clang/test/ |
0 commit comments