Fix in Qt build command #6
This file contains 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: "CI tests" | |
on: [ push ] | |
jobs: | |
build-matrix: | |
name: Tests and application run on ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows Latest MinGW", artifact: "Windows-Ninja.tar.xz", | |
os: windows-latest, | |
build_type: "Release", cc: "gcc", cxx: "g++", | |
} | |
- { | |
name: "Ubuntu Latest GCC", artifact: "Linux.tar.xz", | |
os: ubuntu-latest, | |
build_type: "Release", cc: "gcc", cxx: "g++" | |
} | |
- { | |
name: "macOS Latest Clang", artifact: "macOS.tar.xz", | |
os: macos-latest, | |
build_type: "Release", cc: "clang", cxx: "clang++" | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Ninja and CMake | |
id: cmake_and_ninja | |
shell: cmake -P {0} | |
run: | | |
set(ninja_version "1.12.0") | |
set(cmake_version "3.27.0") | |
message(STATUS "Using host CMake version: ${CMAKE_VERSION}") | |
if ("${{ runner.os }}" STREQUAL "Windows") | |
set(ninja_suffix "win.zip") | |
set(cmake_suffix "win64-x64.zip") | |
set(cmake_dir "cmake-${cmake_version}-win64-x64/bin") | |
elseif ("${{ runner.os }}" STREQUAL "Linux") | |
set(ninja_suffix "linux.zip") | |
set(cmake_suffix "Linux-x86_64.tar.gz") | |
set(cmake_dir "cmake-${cmake_version}-Linux-x86_64/bin") | |
elseif ("${{ runner.os }}" STREQUAL "macOS") | |
set(ninja_suffix "mac.zip") | |
set(cmake_suffix "Darwin-x86_64.tar.gz") | |
set(cmake_dir "cmake-${cmake_version}-Darwin-x86_64/CMake.app/Contents/bin") | |
endif() | |
set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}") | |
file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip) | |
set(cmake_url "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-${cmake_suffix}") | |
file(DOWNLOAD "${cmake_url}" ./cmake.zip SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./cmake.zip) | |
# Save the path for other steps | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${cmake_dir}" cmake_dir) | |
message("::set-output name=cmake_dir::${cmake_dir}") | |
if (NOT "${{ runner.os }}" STREQUAL "Windows") | |
execute_process( | |
COMMAND chmod +x ninja | |
COMMAND chmod +x ${cmake_dir}/cmake | |
) | |
endif() | |
- name: Create CMake cache | |
shell: bash | |
run: | | |
cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -G "Ninja" -DCMAKE_MAKE_PROGRAM="${GITHUB_WORKSPACE}/ninja" | |
- name: Build main target | |
shell: bash | |
run: | | |
cmake --build cmake-build-release --target QtCMake || echo "Built with errors" | |
- name: Run program | |
shell: bash | |
working-directory: ./cmake-build-release/bin | |
run: | | |
if [ "$RUNNER_OS" == "Windows" ]; then | |
./QtCMake.exe --help | |
else | |
./QtCMake --help | |
fi |