|
| 1 | +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow |
| 2 | + |
| 3 | +name: Build |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_call: |
| 7 | + inputs: |
| 8 | + branch: |
| 9 | + type: string |
| 10 | + required: true |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read # to fetch code (actions/checkout) |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + include: |
| 21 | + - name: Ubuntu 24.04 |
| 22 | + os: ubuntu-24.04 |
| 23 | + cmake_args: >- |
| 24 | + -DQT6=ON |
| 25 | + -DQML=ON |
| 26 | + -DBULK=ON |
| 27 | + -DFFMPEG=ON |
| 28 | + -DLOCALECOMPARE=ON |
| 29 | + -DMAD=ON |
| 30 | + -DMODPLUG=ON |
| 31 | + -DWAVPACK=ON |
| 32 | + -DINSTALL_USER_UDEV_RULES=OFF |
| 33 | + compiler_cache: ccache |
| 34 | + compiler_cache_path: /home/runner/.cache/ccache |
| 35 | + compiler_cache_id: qt6 |
| 36 | + buildenv_basepath: /home/runner/buildenv |
| 37 | + buildenv_script: tools/debian_buildenv.sh |
| 38 | + - name: macOS 15 x64 |
| 39 | + os: macos-15-intel |
| 40 | + cmake_args: >- |
| 41 | + -DBULK=ON |
| 42 | + -DCOREAUDIO=ON |
| 43 | + -DHSS1394=ON |
| 44 | + -DMACOS_BUNDLE=ON |
| 45 | + -DMODPLUG=ON |
| 46 | + -DQT6=ON |
| 47 | + -DQML=OFF |
| 48 | + -DWAVPACK=ON |
| 49 | + -DVCPKG_TARGET_TRIPLET=x64-osx-min1100-release |
| 50 | + # TODO: Fix this broken test on macOS |
| 51 | + compiler_cache: ccache |
| 52 | + compiler_cache_path: /Users/runner/Library/Caches/ccache |
| 53 | + compiler_cache_id: x64 |
| 54 | + buildenv_basepath: /Users/runner/buildenv |
| 55 | + buildenv_script: tools/macos_release_buildenv.sh |
| 56 | + # FIXME: The benchmark are currently broken on Windows and not really used anyway, so we are disabling them |
| 57 | + # - name: Windows 2022 x64 |
| 58 | + # os: windows-2022 |
| 59 | + # # Attention: If you change the cmake_args for the Windows CI build, |
| 60 | + # # also adjust the for the local Windows build setup in |
| 61 | + # # ./tools/windows_buildenv.bat |
| 62 | + # cmake_args: >- |
| 63 | + # -DBULK=ON |
| 64 | + # -DHSS1394=ON |
| 65 | + # -DLOCALECOMPARE=ON |
| 66 | + # -DMAD=ON |
| 67 | + # -DMEDIAFOUNDATION=ON |
| 68 | + # -DMODPLUG=ON |
| 69 | + # -DQT6=ON |
| 70 | + # -DQML=ON |
| 71 | + # -DWAVPACK=ON |
| 72 | + # -DVCPKG_TARGET_TRIPLET=x64-windows-release |
| 73 | + # cc: cl |
| 74 | + # cxx: cl |
| 75 | + # buildenv_basepath: C:\buildenv |
| 76 | + # buildenv_script: tools/windows_buildenv.bat |
| 77 | + # arch: x64 |
| 78 | + # - name: Windows 11 ARM64 |
| 79 | + # os: windows-11-arm |
| 80 | + # # Attention: If you change the cmake_args for the Windows CI build, |
| 81 | + # # also adjust the for the local Windows build setup in |
| 82 | + # # ./tools/windows_buildenv.bat |
| 83 | + # cmake_args: >- |
| 84 | + # -DBULK=ON |
| 85 | + # -DHSS1394=ON |
| 86 | + # -DLOCALECOMPARE=ON |
| 87 | + # -DMAD=ON |
| 88 | + # -DMEDIAFOUNDATION=ON |
| 89 | + # -DMODPLUG=ON |
| 90 | + # -DQT6=ON |
| 91 | + # -DQML=ON |
| 92 | + # -DWAVPACK=ON |
| 93 | + # -DVCPKG_TARGET_TRIPLET=arm64-windows-release |
| 94 | + # -DVCPKG_DEFAULT_HOST_TRIPLET=arm64-windows-release |
| 95 | + # cc: cl |
| 96 | + # cxx: cl |
| 97 | + # buildenv_basepath: C:\buildenv |
| 98 | + # buildenv_script: tools/windows_buildenv.bat |
| 99 | + # arch: arm64 |
| 100 | + |
| 101 | + runs-on: ${{ matrix.os }} |
| 102 | + name: ${{ matrix.name }} |
| 103 | + container: ${{ matrix.container }} |
| 104 | + steps: |
| 105 | + - name: "Check out repository" |
| 106 | + uses: actions/checkout@v5 |
| 107 | + with: |
| 108 | + # This is necessary for making `git describe` work. |
| 109 | + fetch-depth: 0 |
| 110 | + |
| 111 | + - name: "[Arch Linux] Workaround for the 'unsafe repository' issue caused by CVE-2022-24765" |
| 112 | + if: matrix.container != null |
| 113 | + # See https://github.com/actions/checkout/issues/760 for details |
| 114 | + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 115 | + |
| 116 | + - name: "Ensure that all tags are fetched" |
| 117 | + # Works around an issue where not the latest tag is not fetched when the |
| 118 | + # workflow is triggered by a tag push event. |
| 119 | + # Possibly related: actions/checkout#290 |
| 120 | + run: git fetch origin --force --tags |
| 121 | + |
| 122 | + - name: "[macOS] Set up cmake" |
| 123 | + uses: jwlawson/actions-setup-cmake@v2.0 |
| 124 | + # Ubuntu 24.04 should use the CMake version from the repos. |
| 125 | + if: runner.os == 'macOS' |
| 126 | + with: |
| 127 | + # This should always match the minimum required version in |
| 128 | + # our CMakeLists.txt |
| 129 | + cmake-version: "3.21.x" |
| 130 | + |
| 131 | + - name: "[Windows] Set up cmake" |
| 132 | + uses: jwlawson/actions-setup-cmake@v2.0 |
| 133 | + # Ubuntu 24.04 should use the CMake version from the repos. |
| 134 | + # On windows-11-arm this action installs the x64 version which has unwanted side effects |
| 135 | + if: matrix.os == 'windows-2022' |
| 136 | + with: |
| 137 | + # This is a workaround for a SSL false positive in cmake 3.26.4 |
| 138 | + # When downloading the manual. 3.21 is required for installing the |
| 139 | + # ANGLE Dlls via IMPORTED_RUNTIME_ARTIFACTS |
| 140 | + cmake-version: "3.21.x" |
| 141 | + |
| 142 | + - name: "[Windows] Set up MSVC Developer Command Prompt" |
| 143 | + if: runner.os == 'Windows' |
| 144 | + uses: ilammy/msvc-dev-cmd@v1 |
| 145 | + with: |
| 146 | + arch: ${{ matrix.arch }} |
| 147 | + |
| 148 | + - name: "[Windows 11 ARM64] Install ARM64 CMake" |
| 149 | + if: matrix.os == 'windows-11-arm' |
| 150 | + run: | |
| 151 | + Invoke-WebRequest -Uri https://github.com/Kitware/CMake/releases/download/v3.30.1/cmake-3.30.1-windows-arm64.zip -OutFile cmake-arm64.zip |
| 152 | + Expand-Archive cmake-arm64.zip -DestinationPath $env:USERPROFILE\cmake |
| 153 | + $cmakePath = "$env:USERPROFILE\cmake\cmake-3.30.1-windows-arm64\bin" |
| 154 | + $cmakePath | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 155 | + $env:Path += ";$cmakePath" |
| 156 | + cmake --version |
| 157 | +
|
| 158 | + - name: "[macOS] install ccache and make" |
| 159 | + if: runner.os == 'macOS' |
| 160 | + run: | |
| 161 | + brew install ccache |
| 162 | +
|
| 163 | + - name: "[macOS/Windows] Get build environment name" |
| 164 | + if: runner.os != 'Linux' |
| 165 | + run: ${{ matrix.buildenv_script }} name |
| 166 | + |
| 167 | + - name: "[macOS/Windows] Set up build environment cache" |
| 168 | + if: runner.os != 'Linux' |
| 169 | + uses: actions/cache@v4 |
| 170 | + with: |
| 171 | + path: ${{ matrix.buildenv_basepath }} |
| 172 | + key: ${{ runner.os }}-buildenv-${{ env.BUILDENV_NAME }} |
| 173 | + |
| 174 | + - name: "[macOS/Linux] Set up build environment" |
| 175 | + if: matrix.buildenv_script != null && runner.os != 'Windows' |
| 176 | + run: ${{ matrix.buildenv_script }} setup |
| 177 | + env: |
| 178 | + BUILDENV_BASEPATH: ${{ matrix.buildenv_basepath }} |
| 179 | + |
| 180 | + - name: "[Windows] Set up build environment" |
| 181 | + if: matrix.buildenv_script != null && runner.os == 'Windows' |
| 182 | + # With the cmd shell the ERRORLEVEL is checked |
| 183 | + shell: cmd |
| 184 | + run: ${{ matrix.buildenv_script }} setup |
| 185 | + env: |
| 186 | + BUILDENV_BASEPATH: ${{ matrix.buildenv_basepath }} |
| 187 | + BUILDENV_RELEASE: TRUE |
| 188 | + |
| 189 | + - name: "[Ubuntu/macOS] Set up GitHub cache for ccache" |
| 190 | + if: runner.os != 'windows' |
| 191 | + uses: actions/cache@v4 |
| 192 | + with: |
| 193 | + path: ${{ matrix.compiler_cache_path }} |
| 194 | + key: ${{ matrix.os }}-${{ matrix.compiler_cache_id }}-${{ inputs.branch }}-${{ github.run_number }} |
| 195 | + restore-keys: | |
| 196 | + ${{ matrix.os }}-${{ matrix.compiler_cache_id }}-${{ inputs.branch }} |
| 197 | + ${{ matrix.os }}-${{ matrix.compiler_cache_id }} |
| 198 | +
|
| 199 | + - name: "[Ubuntu/macOS] Set up ccache" |
| 200 | + # GitHub Actions gives us 10 GB of cache. |
| 201 | + # 4 runs * 2 GB = 8 GB |
| 202 | + run: | |
| 203 | + ${{ matrix.compiler_cache }} --zero-stats |
| 204 | + ${{ matrix.compiler_cache }} --max-size=2G |
| 205 | + if: runner.os != 'windows' |
| 206 | + |
| 207 | + - name: "Create build directory" |
| 208 | + run: mkdir build |
| 209 | + |
| 210 | + - name: "Configure" |
| 211 | + run: >- |
| 212 | + cmake ${{ matrix.cmake_args }} ${{ env.CMAKE_ARGS_EXTRA }} |
| 213 | + -DCMAKE_BUILD_TYPE=RelWithDebInfo |
| 214 | + -DCMAKE_PREFIX_PATH="${{ env.CMAKE_PREFIX_PATH }}" |
| 215 | + -DWARNINGS_FATAL=ON |
| 216 | + -DDEBUG_ASSERTIONS_FATAL=OFF |
| 217 | + -DBATTERY=ON |
| 218 | + -DBROADCAST=ON |
| 219 | + -DDOWNLOAD_MANUAL=ON |
| 220 | + -DHID=ON |
| 221 | + -DKEYFINDER=ON |
| 222 | + -DLILV=ON |
| 223 | + -DOPUS=ON |
| 224 | + -DQTKEYCHAIN=ON |
| 225 | + -DVINYLCONTROL=ON |
| 226 | + -DCMAKE_VERBOSE_MAKEFILE=OFF |
| 227 | + -L |
| 228 | + .. |
| 229 | + working-directory: build |
| 230 | + env: |
| 231 | + CC: ${{ matrix.cc }} |
| 232 | + CXX: ${{ matrix.cxx }} |
| 233 | + |
| 234 | + - name: "[Ubuntu/macOS] Set up gcc/clang problem matcher" |
| 235 | + if: runner.os != 'Windows' |
| 236 | + uses: ammaraskar/gcc-problem-matcher@0.3.0 |
| 237 | + |
| 238 | + - name: "[Windows] Set up MSVC problem matcher" |
| 239 | + if: runner.os == 'Windows' |
| 240 | + uses: ammaraskar/msvc-problem-matcher@0.3.0 |
| 241 | + |
| 242 | + - name: Benchmark |
| 243 | + run: cmake --build . --target mixxx-benchmark --config RelWithDebInfo |
| 244 | + working-directory: build |
0 commit comments