diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9bbed6bc1..988aa2f58 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,52 +36,45 @@ permissions: read-all jobs: linux: runs-on: ${{matrix.os}} - strategy: matrix: - cc: [ gcc, clang ] - cxx: [ g++, clang++ ] + compiler: [ {cc: gcc, cxx: g++}, {cc: clang, cxx: clang++} ] config: [ Debug, Release ] os: [ ubuntu-20.04, ubuntu-22.04 ] - exclude: - - cc: gcc - cxx: clang++ - - cc: clang - cxx: g++ - steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.7' - - uses: lukka/get-cmake@latest + - name: Test CMake min + # NOTE: The main users who benefit from an older CMake version + # are linux users stuck on older LTS releases. It's idiomatic best + # practice to try and support them so they don't have to install + # the CMake tarball. Ideally the minimum we use matches what the default + # package provided by Ubuntu via APT. + if: ${{ matrix.os == 'ubuntu-20.04' }} + uses: lukka/get-cmake@latest with: cmakeVersion: 3.17.2 - run: sudo apt update - - name: Install Dependencies - run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev - - - name: Generate build files - run: cmake -S. -B build -D CMAKE_BUILD_TYPE=${{matrix.config}} -D BUILD_TESTS=ON -D UPDATE_DEPS=ON -D LOADER_ENABLE_ADDRESS_SANITIZER=ON -D ENABLE_WERROR=ON - env: - CC: ${{matrix.cc}} - CXX: ${{matrix.cxx}} - - - name: Build the loader - run: cmake --build build - - - name: Install the loader - run: cmake --install build --prefix build/install - - - name: cat vulkan.pc - run: cat ./build/install/lib/pkgconfig/vulkan.pc - - - name: Validate pkg-config - run: pkg-config --validate ./build/install/lib/pkgconfig/vulkan.pc - - - name: Run regression tests - working-directory: ./build - run: ctest --output-on-failure + - run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev + - run: | + cmake -S. -B build \ + -D CMAKE_BUILD_TYPE=${{ matrix.config }} \ + -D BUILD_TESTS=ON \ + -D UPDATE_DEPS=ON \ + -D LOADER_ENABLE_ADDRESS_SANITIZER=ON \ + -D ENABLE_WERROR=ON \ + -D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \ + -D CMAKE_C_COMPILER=${{ matrix.compiler.cc }} + - run: cmake --build build + - run: ctest --output-on-failure --test-dir build/ + - run: cmake --install build --prefix /tmp + # NOTE: This check is NOT sufficient to ensure vulkan.pc is actually valid + - name: Check vulkan.pc exists and validate it + run: | + cat /tmp/lib/pkgconfig/vulkan.pc + pkg-config --validate /tmp/lib/pkgconfig/vulkan.pc codegen: runs-on: ubuntu-latest @@ -92,47 +85,28 @@ jobs: linux-no-asm: runs-on: ubuntu-22.04 - steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.7' - - uses: lukka/get-cmake@latest - with: - cmakeVersion: 3.17.2 - run: sudo apt update - - name: Install Dependencies - run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev - - - name: Generate build files - run: cmake -S. -B build -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTS=ON -D UPDATE_DEPS=ON -D ENABLE_WERROR=ON -D USE_GAS=OFF - env: - CC: clang - CXX: clang++ - - - name: Build the loader - run: cmake --build build - - - name: Run regression tests - working-directory: ./build - run: ctest --output-on-failure -E UnknownFunction + - run: sudo apt install --yes --no-install-recommends libwayland-dev libxrandr-dev + - run: | + cmake -S. -B build \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_TESTS=ON \ + -D UPDATE_DEPS=ON \ + -D ENABLE_WERROR=ON \ + -D USE_GAS=OFF \ + -D CMAKE_C_COMPILER=clang \ + -D CMAKE_CXX_COMPILER=clang++ + - run: cmake --build build + - run: cmake --install build --prefix /tmp + - run: ctest --output-on-failure -E UnknownFunction --test-dir build/ linux-32: - runs-on: ${{matrix.os}} - + runs-on: ubuntu-22.04 strategy: matrix: - cc: [ gcc, clang ] - cxx: [ g++, clang++ ] config: [ Debug, Release ] - os: [ ubuntu-20.04, ubuntu-22.04 ] - exclude: - - cc: gcc - cxx: clang++ - - cc: clang - cxx: g++ - steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -141,40 +115,33 @@ jobs: - uses: lukka/get-cmake@latest with: cmakeVersion: 3.17.2 - - name: Enable 32 bit - run: |- - sudo dpkg --add-architecture i386 - - name: Update packages - run: |- - sudo apt-get update - - name: Install Dependencies - run: |- - sudo apt install --yes --no-install-recommends gcc-multilib g++-multilib libc6:i386 libc6-dev-i386 libgcc-s1:i386 libwayland-dev:i386 libxrandr-dev:i386 - - - name: Generate build files - run: cmake -S. -B build -D CMAKE_BUILD_TYPE=${{matrix.config}} -D BUILD_TESTS=ON -D UPDATE_DEPS=ON -D ENABLE_WERROR=ON -D SYSCONFDIR=/etc/not_vulkan + run: sudo dpkg --add-architecture i386 + - run: sudo apt-get update + - run: | + sudo apt install --yes --no-install-recommends \ + gcc-multilib g++-multilib libc6:i386 libc6-dev-i386 libgcc-s1:i386 \ + libwayland-dev:i386 libxrandr-dev:i386 + - run: | + cmake -S. -B build \ + -D CMAKE_BUILD_TYPE=${{matrix.config}} \ + -D BUILD_TESTS=ON \ + -D UPDATE_DEPS=ON \ + -D ENABLE_WERROR=ON \ + -D SYSCONFDIR=/etc/not_vulkan \ + -G Ninja env: CFLAGS: -m32 CXXFLAGS: -m32 LDFLAGS: -m32 ASFLAGS: --32 - - - name: Build the loader - run: cmake --build build - - - name: Install the loader - run: cmake --install build --prefix build/install - - - name: Validate pkg-config - run: pkg-config --validate ./build/install/lib/pkgconfig/vulkan.pc - - - name: Run regression tests - working-directory: ./build - run: ctest --output-on-failure + - run: cmake --build build + - run: cmake --install build --prefix /tmp + - run: ctest --output-on-failure + working-directory: build/ linux-32-no-asm: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 @@ -183,31 +150,29 @@ jobs: - uses: lukka/get-cmake@latest with: cmakeVersion: 3.17.2 - - name: Enable 32 bit - run: |- - sudo dpkg --add-architecture i386 - - name: Update packages - run: |- - sudo apt-get update - - name: Install Dependencies - run: |- - sudo apt install --yes --no-install-recommends gcc-multilib g++-multilib libc6:i386 libc6-dev-i386 libgcc-s1:i386 libwayland-dev:i386 libxrandr-dev:i386 - - - name: Generate build files - run: cmake -S. -B build -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTS=ON -D UPDATE_DEPS=ON -D ENABLE_WERROR=ON -D USE_GAS=OFF + run: sudo dpkg --add-architecture i386 + - run: sudo apt-get update + - run: | + sudo apt install --yes --no-install-recommends \ + gcc-multilib g++-multilib libc6:i386 libc6-dev-i386 libgcc-s1:i386 \ + libwayland-dev:i386 libxrandr-dev:i386 + - run: | + cmake -S. -B build \ + -D CMAKE_BUILD_TYPE=Release \ + -D BUILD_TESTS=ON \ + -D UPDATE_DEPS=ON \ + -D ENABLE_WERROR=ON \ + -D USE_GAS=OFF \ + -G Ninja env: CFLAGS: -m32 CXXFLAGS: -m32 LDFLAGS: -m32 ASFLAGS: --32 - - - name: Build the loader - run: cmake --build build - - - name: Run regression tests - working-directory: ./build - run: ctest --output-on-failure -E UnknownFunction + - run: cmake --build build + - run: ctest --output-on-failure -E UnknownFunction + working-directory: build/ windows_vs: runs-on: windows-latest @@ -215,50 +180,38 @@ jobs: matrix: arch: [ Win32, x64 ] config: [ Debug, Release ] - steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.7' - - - name: Generate build files - run: cmake -S. -B build -DBUILD_TESTS=ON -DUPDATE_DEPS=ON -D CMAKE_BUILD_TYPE=${{matrix.config}} -A ${{ matrix.arch }} -D ENABLE_WERROR=ON - - - name: Build the loader - run: cmake --build ./build --config ${{matrix.config}} - - - name: Install the loader - run: cmake --install build --prefix build/install --config ${{matrix.config}} - - - name: Run regression tests - working-directory: ./build - run: ctest --output-on-failure -C ${{matrix.config}} + - run: | + cmake -S. -B build ` + -D BUILD_TESTS=ON ` + -D UPDATE_DEPS=ON ` + -D CMAKE_BUILD_TYPE=${{matrix.config}} ` + -A ${{ matrix.arch }} ` + -D ENABLE_WERROR=ON + - run: cmake --build build/ --config ${{matrix.config}} + - run: cmake --install build --prefix build/install --config ${{matrix.config}} + - run: ctest --output-on-failure -C ${{matrix.config}} --test-dir build/ windows_vs-no-asm: runs-on: windows-latest strategy: matrix: arch: [ Win32, x64 ] - steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.7' - - - name: Generate build files - run: cmake -S. -B build -DBUILD_TESTS=ON -DUPDATE_DEPS=ON -D USE_MASM=OFF -D CMAKE_BUILD_TYPE=Release -A ${{ matrix.arch }} -D ENABLE_WERROR=ON - - - name: Build the loader - run: cmake --build ./build --config Release - - - name: Run regression tests - working-directory: ./build - run: ctest --output-on-failure -C Release -E UnknownFunction - - # Test both clang and clang-cl - # Make sure clang-cl builds still succeed - used by the chromium project + - run: | + cmake -S. -B build ` + -D BUILD_TESTS=ON ` + -D UPDATE_DEPS=ON ` + -D USE_MASM=OFF ` + -D CMAKE_BUILD_TYPE=Release ` + -A ${{ matrix.arch }} ` + -D ENABLE_WERROR=ON + - run: cmake --build build/ --config Release + - run: ctest --output-on-failure -C Release -E UnknownFunction --test-dir build/ + + # Test both clang and clang-cl (Chromium project uses clang-cl) windows_clang: runs-on: windows-2022 strategy: @@ -270,43 +223,44 @@ jobs: - uses: ilammy/msvc-dev-cmd@v1 - run: | cmake -S. -B build ` - -D CMAKE_C_COMPILER=${{matrix.compiler}} -D CMAKE_CXX_COMPILER=${{matrix.compiler}} ` + -D CMAKE_C_COMPILER=${{matrix.compiler}} ` + -D CMAKE_CXX_COMPILER=${{matrix.compiler}} ` -D UPDATE_DEPS=ON ` -D CMAKE_BUILD_TYPE=${{matrix.config}} ` -D ENABLE_WERROR=ON ` -D BUILD_TESTS=ON ` -G Ninja - - run: cmake --build ./build + - run: cmake --build build/ - run: ctest --output-on-failure --test-dir build/ - run: cmake --install build --prefix build/install mac: - runs-on: macos-12 - + runs-on: macos-11 strategy: matrix: config: [ Debug, Release ] static_build: [ APPLE_STATIC_LOADER=ON, APPLE_STATIC_LOADER=OFF ] - steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.7' - uses: lukka/get-cmake@latest - - name: Generate build files - run: cmake -S. -B build -D CMAKE_BUILD_TYPE=${{matrix.config}} -D ${{matrix.static_build}} -D BUILD_TESTS=ON -D UPDATE_DEPS=ON -D ENABLE_WERROR=ON -D LOADER_ENABLE_ADDRESS_SANITIZER=ON -G "Ninja" + - run: | + cmake -S. -B build \ + -D CMAKE_BUILD_TYPE=${{matrix.config}} \ + -D ${{matrix.static_build}} \ + -D BUILD_TESTS=ON \ + -D UPDATE_DEPS=ON \ + -D ENABLE_WERROR=ON \ + -D LOADER_ENABLE_ADDRESS_SANITIZER=ON \ + -G Ninja env: # Prevents regression of KhronosGroup/Vulkan-Loader/issues/1332 LDFLAGS: -Wl,-fatal_warnings - - run: cmake --build build - - - run: cmake --install build --prefix build/install - - - name: Run regression tests - working-directory: ./build - run: ctest --output-on-failure + - run: cmake --install build --prefix /tmp + - run: ctest --output-on-failure --test-dir build/ apple-cross-compile: name: ${{ matrix.CMAKE_SYSTEM_NAME }} @@ -320,17 +274,16 @@ jobs: with: python-version: '3.7' - uses: lukka/get-cmake@latest - - name: Generate build files - run: | + - run: | cmake -S . -B build \ -D CMAKE_SYSTEM_NAME=${{ matrix.CMAKE_SYSTEM_NAME }} \ "-D CMAKE_OSX_ARCHITECTURES=arm64;x86_64" \ -D CMAKE_BUILD_TYPE=Debug \ -D UPDATE_DEPS=ON \ - -D ENABLE_WERROR=ON + -D ENABLE_WERROR=ON \ + -G Ninja env: LDFLAGS: -Wl,-fatal_warnings - CMAKE_GENERATOR: Ninja - run: cmake --build build - run: cmake --install build --prefix /tmp - name: Verify Universal Binary @@ -353,8 +306,7 @@ jobs: with: python-version: '3.7' - uses: lukka/get-cmake@latest - - name: Generate build files - run: | + - run: | cmake -S. -B build \ -D CMAKE_BUILD_TYPE=Release \ -D APPLE_STATIC_LOADER=${{matrix.static}} \ @@ -374,7 +326,6 @@ jobs: vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture x86_64' vtool -show-build /tmp/lib/libvulkan.dylib | grep 'architecture arm64' - chromium: runs-on: ubuntu-latest steps: @@ -388,35 +339,23 @@ jobs: shell: bash steps: - uses: actions/checkout@v4 - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: mingw-ccache - uses: actions/setup-python@v5 with: python-version: '3.8' - uses: lukka/get-cmake@latest - - name: GCC Version - run: gcc --version # If this fails MINGW is not setup correctly - name: Setup uasm run: | C:/msys64/usr/bin/pacman -Sy --noconfirm --needed mingw-w64-x86_64-uasm printf '%s\n' 'C:/msys64/mingw64/bin' >> $GITHUB_PATH - name: UASM Check run: uasm -? - - name: Configure - run: cmake -S. -B build -D UPDATE_DEPS=ON -D CMAKE_BUILD_TYPE=Release - env: - LDFLAGS: -fuse-ld=lld # MINGW linking is very slow. Use llvm linker instead. - CMAKE_C_COMPILER_LAUNCHER: ccache - CMAKE_CXX_COMPILER_LAUNCHER: ccache - CMAKE_GENERATOR: Ninja - - name: Build - run: cmake --build build -- --quiet - - name: Install - run: cmake --install build --prefix build/install - - name: MinGW ccache stats # The Post Setup ccache doesn't work right on MinGW - run: ccache --show-stats + - run: | + cmake -S. -B build \ + -D UPDATE_DEPS=ON \ + -D CMAKE_BUILD_TYPE=Release \ + -G Ninja + - run: cmake --build build + - run: cmake --install build --prefix /tmp mingw-no-asm: runs-on: windows-2022 @@ -425,30 +364,18 @@ jobs: shell: bash steps: - uses: actions/checkout@v4 - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: mingw-ccache - uses: actions/setup-python@v5 with: python-version: '3.8' - uses: lukka/get-cmake@latest - - name: GCC Version - run: gcc --version # If this fails MINGW is not setup correctly - - name: Configure - # Make sure this doesn't fail even without -D USE_MASM=OFF and without uasm - run: cmake -S. -B build -D UPDATE_DEPS=ON -D CMAKE_BUILD_TYPE=Release - env: - LDFLAGS: -fuse-ld=lld # MINGW linking is very slow. Use llvm linker instead. - CMAKE_C_COMPILER_LAUNCHER: ccache - CMAKE_CXX_COMPILER_LAUNCHER: ccache - CMAKE_GENERATOR: Ninja - - name: Build - run: cmake --build build -- --quiet - - name: Install - run: cmake --install build --prefix build/install - - name: MinGW ccache stats # The Post Setup ccache doesn't work right on MinGW - run: ccache --show-stats + # Make sure this doesn't fail even without explicitly setting '-D USE_MASM=OFF' and without uasm + - run: | + cmake -S. -B build \ + -D UPDATE_DEPS=ON \ + -D CMAKE_BUILD_TYPE=Release \ + -G Ninja + - run: cmake --build build + - run: cmake --install build --prefix /tmp mingw-no-asm-explicit: runs-on: windows-2022 @@ -457,26 +384,13 @@ jobs: shell: bash steps: - uses: actions/checkout@v4 - - name: Setup ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: mingw-ccache - - uses: actions/setup-python@v5 - with: - python-version: '3.8' - uses: lukka/get-cmake@latest - - name: GCC Version - run: gcc --version # If this fails MINGW is not setup correctly - - name: Configure - run: cmake -S. -B build -D UPDATE_DEPS=ON -D CMAKE_BUILD_TYPE=Release -D ENABLE_WERROR=ON -D USE_MASM=OFF - env: - LDFLAGS: -fuse-ld=lld # MINGW linking is very slow. Use llvm linker instead. - CMAKE_C_COMPILER_LAUNCHER: ccache - CMAKE_CXX_COMPILER_LAUNCHER: ccache - CMAKE_GENERATOR: Ninja - - name: Build - run: cmake --build build -- --quiet - - name: Install - run: cmake --install build --prefix build/install - - name: MinGW ccache stats # The Post Setup ccache doesn't work right on MinGW - run: ccache --show-stats + - run: | + cmake -S. -B build \ + -D UPDATE_DEPS=ON \ + -D CMAKE_BUILD_TYPE=Release \ + -D ENABLE_WERROR=ON \ + -D USE_MASM=OFF \ + -G Ninja + - run: cmake --build build + - run: cmake --install build --prefix /tmp