|
| 1 | +name: CMake Build for Doxygen |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +jobs: |
| 6 | + build: |
| 7 | + permissions: |
| 8 | + contents: read # to push pages branch (peaceiris/actions-gh-pages) |
| 9 | + |
| 10 | + name: ${{ matrix.config.name }} |
| 11 | + runs-on: ${{ matrix.config.os }} |
| 12 | + strategy: |
| 13 | + fail-fast: true |
| 14 | + matrix: |
| 15 | + config: |
| 16 | + - { |
| 17 | + name: "Ubuntu Latest GCC Release", |
| 18 | + os: ubuntu-latest, |
| 19 | + build_type: "Release", cc: "gcc", cxx: "g++", |
| 20 | + build_gen: "Ninja", |
| 21 | + llvm_version: "19", |
| 22 | + cmake_extra_opts: "" |
| 23 | + } |
| 24 | + steps: |
| 25 | + - name: Checkout doxygen |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + fetch-depth: 0 |
| 29 | + |
| 30 | + - name: Download llvm nightly installation script |
| 31 | + uses: suisei-cn/actions-download-file@v1 |
| 32 | + with: |
| 33 | + url: "https://apt.llvm.org/llvm.sh" |
| 34 | + target: . |
| 35 | + |
| 36 | + - name: Install llvm nightly |
| 37 | + shell: bash |
| 38 | + run: | |
| 39 | + LLVM_VERSION=${{ matrix.config.llvm_version }} |
| 40 | + sudo bash ./llvm.sh $LLVM_VERSION |
| 41 | + sudo apt install libmlir-${LLVM_VERSION}-dev \ |
| 42 | + mlir-${LLVM_VERSION}-tools |
| 43 | +
|
| 44 | + - uses: seanmiddleditch/gha-setup-ninja@master |
| 45 | + - name: Install dependencies |
| 46 | + run: | |
| 47 | + sudo apt update |
| 48 | + sudo apt install libffi-dev libbz2-dev bzip2 autoconf |
| 49 | +
|
| 50 | + - name: Setup cmake |
| 51 | + uses: jwlawson/actions-setup-cmake@v2 |
| 52 | + - name: install python 3.9 |
| 53 | + uses: actions/setup-python@v5 |
| 54 | + with: |
| 55 | + python-version: '3.9' |
| 56 | + cache: 'pip' # caching pip dependencies |
| 57 | + cache-dependency-path: scripts/notchpeak.requirements.txt |
| 58 | + - run: pip install -r scripts/notchpeak.requirements.txt |
| 59 | + - name: Check tool versions (Linux / MacOS) |
| 60 | + shell: bash |
| 61 | + run: | |
| 62 | + echo "=== cmake ==="; |
| 63 | + cmake --version; |
| 64 | + echo "=== python ==="; |
| 65 | + python --version; |
| 66 | +
|
| 67 | + - name: Configure |
| 68 | + shell: cmake -P {0} |
| 69 | + run: | |
| 70 | + set(ENV{CC} ${{ matrix.config.cc }}) |
| 71 | + set(ENV{CXX} ${{ matrix.config.cxx }}) |
| 72 | +
|
| 73 | + execute_process( |
| 74 | + COMMAND cmake |
| 75 | + -S . |
| 76 | + -B build |
| 77 | + -D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }} |
| 78 | + -D MLIR_ENABLE_BINDINGS_PYTHON=ON |
| 79 | + -D CMAKE_PREFIX_PATH=/usr/lib/llvm-${{ matrix.config.llvm_version }}/lib/cmake/mlir |
| 80 | + -G "${{ matrix.config.build_gen }}" |
| 81 | + ${{ matrix.config.cmake_extra_opts }} |
| 82 | + RESULT_VARIABLE result |
| 83 | + ) |
| 84 | + if (NOT result EQUAL 0) |
| 85 | + message(FATAL_ERROR "Bad exit status") |
| 86 | + endif() |
| 87 | +
|
| 88 | + - name: Build |
| 89 | + shell: cmake -P {0} |
| 90 | + run: | |
| 91 | + include(ProcessorCount) |
| 92 | + ProcessorCount(N) |
| 93 | + execute_process( |
| 94 | + COMMAND cmake --build build --parallel ${N} |
| 95 | + RESULT_VARIABLE result |
| 96 | + OUTPUT_VARIABLE output |
| 97 | + ERROR_VARIABLE output |
| 98 | + ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE |
| 99 | + ) |
| 100 | + if (NOT result EQUAL 0) |
| 101 | + string(REGEX MATCH "FAILED:.*$" error_message "${output}") |
| 102 | + string(REPLACE "\n" "%0A" error_message "${error_message}") |
| 103 | + message("::error::${error_message}") |
| 104 | + message(FATAL_ERROR "Build failed") |
| 105 | + endif() |
| 106 | +
|
| 107 | + - name: Archive build artifacts |
| 108 | + uses: actions/upload-artifact@v4 |
| 109 | + with: |
| 110 | + name: "${{ matrix.config.name }} build artifacts" |
| 111 | + path: build/bin/ |
| 112 | + |
0 commit comments