name: CMake Build for Doxygen on: [push, pull_request] jobs: build: name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.os }} strategy: fail-fast: false matrix: config: - { name: "Ubuntu Latest GCC Release", os: ubuntu-latest, build_type: "Release", cc: "gcc", cxx: "g++", build_gen: "Unix Makefiles" } - { name: "Ubuntu Latest GCC Debug", os: ubuntu-latest, build_type: "Debug", cc: "gcc", cxx: "g++", build_gen: "Unix Makefiles" } - { name: "Ubuntu Latest Clang Release", os: ubuntu-latest, build_type: "Release", cc: "clang", cxx: "clang++", build_gen: "Unix Makefiles" } - { name: "Ubuntu Latest Clang Debug", os: ubuntu-latest, build_type: "Debug", cc: "clang", cxx: "clang++", build_gen: "Unix Makefiles" } - { name: "macOS Latest Release", os: macos-latest, build_type: "Release", cc: "clang", cxx: "clang++", build_gen: "Unix Makefiles" } - { name: "macOS Latest Debug", os: macos-latest, build_type: "Debug", cc: "clang", cxx: "clang++", build_gen: "Unix Makefiles" } - { name: "Windows Latest MSVC Debug", os: windows-latest, build_type: "Debug", cc: "cl", cxx: "cl", build_gen: "NMake Makefiles" } - { name: "Windows Latest MSVC Release", os: windows-latest, build_type: "Release", cc: "cl", cxx: "cl", build_gen: "NMake Makefiles" } steps: - uses: actions/checkout@v1 # - uses: suisei-cn/actions-download-file@v1 # with: # url: "https://miktex.org/download/win/miktexsetup-x64.zip" # target: . # if: matrix.config.os == 'windows-latest' - name: Download MikTex (Windows) run: $wc = New-Object System.Net.WebClient; $maxAttempts=5; $attemptCount=0; Do { $attemptCount++; Try { $wc.DownloadFile("https://miktex.org/download/win/miktexsetup-x64.zip","miktexsetup-x64.zip") } Catch [Exception] { Write-Host $_.Exception | format-list -force } } while (((Test-Path "miktexsetup-x64.zip") -eq $false) -and ($attemptCount -le $maxAttempts)) shell: pwsh if: matrix.config.os == 'windows-latest' - uses: suisei-cn/actions-download-file@v1 with: url: "https://github.com/pffang/libiconv-for-Windows/releases/download/v1.16/libiconv-for-Windows_1.16.7z" target: . if: matrix.config.os == 'windows-latest' - name: Install LaTeX (Linux) run: sudo apt-get install texlive texlive-generic-recommended texlive-extra-utils texlive-latex-extra texlive-font-utils if: matrix.config.os == 'ubuntu-latest' - name: Install LaTeX (MacOS) run: brew install --cask mactex; echo "/Library/TeX/texbin/" >> $GITHUB_PATH if: matrix.config.os == 'macos-latest' - name: Extract MikTex zip (Windows) run: 7z e miktexsetup-x64.zip if: matrix.config.os == 'windows-latest' - name: Download MikTex packages (Windows) run: .\miktexsetup.exe --local-package-repository=C:\miktex-repository --package-set=essential download if: matrix.config.os == 'windows-latest' - name: Install MikTex packages (Windows) run: .\miktexsetup.exe --local-package-repository=C:\miktex-repository --package-set=essential --shared install if: matrix.config.os == 'windows-latest' - name: Install Ghostscript (Linux) run: sudo apt-get install ghostscript if: matrix.config.os == 'ubuntu-latest' - name: Install xmllint (Linux) run: sudo apt-get install libxml2-utils if: matrix.config.os == 'ubuntu-latest' - name: Install xmllint (MacOS) run: brew install libxml2 if: matrix.config.os == 'macos-latest' - name: Install bison (MacOS) run: brew install bison; echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH if: matrix.config.os == 'macos-latest' - name: Install bison/flex (Windows) run: choco install winflexbison if: matrix.config.os == 'windows-latest' - name: Install Perl (Windows) run: choco install activeperl if: matrix.config.os == 'windows-latest' - name: Setup VS Environment (Windows) uses: seanmiddleditch/gha-setup-vsdevenv@master if: matrix.config.os == 'windows-latest' - name: Refresh Env (Windows) run: refreshenv if: matrix.config.os == 'windows-latest' - name: Check tools shell: pwsh run: | echo "=== perl ==="; perl --version; echo "=== python ==="; python --version; echo "=== bison ==="; bison --version; echo "=== flex ==="; flex --version; echo "=== cmake ==="; cmake --version; echo "=== latex ==="; latex --version; echo "=== bibtex ==="; bibtex --version if: matrix.config.os == 'windows-latest' - name: Configure shell: cmake -P {0} run: | set(ENV{CC} ${{ matrix.config.cc }}) set(ENV{CXX} ${{ matrix.config.cxx }}) execute_process( COMMAND cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -G "${{ matrix.config.build_gen }}" -Dbuild_doc=YES -Dbuild_app=YES -Dbuild_parse=YES -Dbuild_xmlparser=YES RESULT_VARIABLE result ) if (NOT result EQUAL 0) message(FATAL_ERROR "Bad exit status") endif() - name: Build shell: cmake -P {0} run: | include(ProcessorCount) ProcessorCount(N) execute_process( COMMAND cmake --build build --parallel ${N} RESULT_VARIABLE result OUTPUT_VARIABLE output ERROR_VARIABLE output ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE ) if (NOT result EQUAL 0) string(REGEX MATCH "FAILED:.*$" error_message "${output}") string(REPLACE "\n" "%0A" error_message "${error_message}") message("::error::${error_message}") message(FATAL_ERROR "Build failed") endif() - name: Run tests shell: cmake -P {0} run: | include(ProcessorCount) ProcessorCount(N) set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON") execute_process( COMMAND cmake --build build --target tests RESULT_VARIABLE result ) if (NOT result EQUAL 0) message(FATAL_ERROR "Running tests failed!") endif() - name: Generate documentation shell: cmake -P {0} run: | execute_process( COMMAND cmake --build build --target docs RESULT_VARIABLE result ) if (NOT result EQUAL 0) message(FATAL_ERROR "Bad exit status") endif()