|
8 | 8 | branches: |
9 | 9 | - '**' |
10 | 10 |
|
11 | | -permissions: |
12 | | - checks: write |
13 | | - contents: read |
14 | | - |
15 | | -env: |
16 | | - CMAKE_VERSION: '3.31.7' |
17 | | - CMAKE_INSTALL_DIR: '${{ github.workspace }}/.cmake' |
18 | | - CMAKE_BIN: '${{ github.workspace }}/.cmake/bin/cmake' |
19 | | - TEST_RESULTS_DIR: '${{ github.workspace }}/test-results' |
20 | | - |
21 | 11 | jobs: |
22 | | - build-and-test: |
23 | | - strategy: |
24 | | - matrix: |
25 | | - include: |
26 | | - - name: Ubuntu-22.04-GCC |
27 | | - os: ubuntu-22.04 |
28 | | - cc: gcc |
29 | | - cxx: g++ |
30 | | - - name: Ubuntu-22.04-Clang |
31 | | - os: ubuntu-22.04 |
32 | | - cc: clang |
33 | | - cxx: clang++ |
34 | | - - name: Ubuntu-24.04-GCC |
35 | | - os: ubuntu-24.04 |
36 | | - cc: gcc |
37 | | - cxx: g++ |
38 | | - - name: Ubuntu-24.04-Clang |
39 | | - os: ubuntu-24.04 |
40 | | - cc: clang |
41 | | - cxx: clang++ |
42 | | - |
43 | | - runs-on: ${{ matrix.os }} |
44 | | - name: ${{ matrix.name }} |
| 12 | + ubuntu-22-gcc: |
| 13 | + runs-on: ubuntu-22.04 |
| 14 | + name: Ubuntu-22.04-GCC |
| 15 | + steps: |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Install dependencies |
| 20 | + run: sudo apt update && sudo apt install -y ninja-build gcc g++ cmake |
| 21 | + |
| 22 | + - name: Run CMake configuration and build |
| 23 | + run: | |
| 24 | + cmake examples -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo |
| 25 | + cmake --build build --parallel |
| 26 | +
|
| 27 | + - name: Run Unit Tests |
| 28 | + run: ./build/tests |
45 | 29 |
|
| 30 | + ubuntu-22-clang: |
| 31 | + runs-on: ubuntu-22.04 |
| 32 | + name: Ubuntu-22.04-Clang |
46 | 33 | steps: |
47 | 34 | - name: Checkout repository |
48 | 35 | uses: actions/checkout@v4 |
49 | 36 |
|
50 | 37 | - name: Install dependencies |
| 38 | + run: sudo apt update && sudo apt install -y ninja-build clang cmake |
| 39 | + |
| 40 | + - name: Run CMake configuration and build |
51 | 41 | run: | |
52 | | - sudo apt update |
53 | | - sudo apt install -y ninja-build gcc g++ clang ${{ matrix.extra_packages }} |
| 42 | + cmake examples -B build -G Ninja \ |
| 43 | + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
| 44 | + -DCMAKE_C_COMPILER=clang \ |
| 45 | + -DCMAKE_CXX_COMPILER=clang++ |
| 46 | + cmake --build build --parallel |
54 | 47 |
|
55 | | - - name: Cache CMake |
56 | | - uses: actions/cache@v4 |
57 | | - with: |
58 | | - path: ${{ env.CMAKE_INSTALL_DIR }} |
59 | | - key: cmake-${{ env.CMAKE_VERSION }}-${{ matrix.os }}-${{ matrix.cc }}-try2 |
| 48 | + - name: Run Unit Tests |
| 49 | + run: ./build/tests |
60 | 50 |
|
61 | | - - name: Download and Install CMake if not cached |
| 51 | + ubuntu-24-gcc: |
| 52 | + runs-on: ubuntu-24.04 |
| 53 | + name: Ubuntu-24.04-GCC |
| 54 | + steps: |
| 55 | + - name: Checkout repository |
| 56 | + uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Install dependencies |
| 59 | + run: sudo apt update && sudo apt install -y ninja-build gcc g++ cmake |
| 60 | + |
| 61 | + - name: Run CMake configuration and build |
62 | 62 | run: | |
63 | | - if [ ! -f "${{ env.CMAKE_BIN }}" ]; then |
64 | | - echo "CMake not found in cache. Downloading..." |
65 | | - mkdir -p "${{ env.CMAKE_INSTALL_DIR }}" |
66 | | - wget -q https://github.com/Kitware/CMake/releases/download/v${{ env.CMAKE_VERSION }}/cmake-${{ env.CMAKE_VERSION }}-linux-x86_64.tar.gz |
67 | | - tar -xzf cmake-${{ env.CMAKE_VERSION }}-linux-x86_64.tar.gz --strip-components=1 -C "${{ env.CMAKE_INSTALL_DIR }}" |
68 | | - else |
69 | | - echo "Using cached CMake" |
70 | | - fi |
71 | | - "${{ env.CMAKE_BIN }}" --version |
| 63 | + cmake examples -B build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo |
| 64 | + cmake --build build --parallel |
| 65 | +
|
| 66 | + - name: Run Unit Tests |
| 67 | + run: ./build/tests |
| 68 | + |
| 69 | + ubuntu-24-clang: |
| 70 | + runs-on: ubuntu-24.04 |
| 71 | + name: Ubuntu-24.04-Clang |
| 72 | + steps: |
| 73 | + - name: Checkout repository |
| 74 | + uses: actions/checkout@v4 |
| 75 | + |
| 76 | + - name: Install dependencies |
| 77 | + run: sudo apt update && sudo apt install -y ninja-build clang cmake |
72 | 78 |
|
73 | 79 | - name: Run CMake configuration and build |
74 | 80 | run: | |
75 | | - "${{ env.CMAKE_BIN }}" examples -B build -G Ninja \ |
| 81 | + cmake examples -B build -G Ninja \ |
76 | 82 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
77 | | - -DCMAKE_C_COMPILER=${{ matrix.cc }} \ |
78 | | - -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} |
79 | | - "${{ env.CMAKE_BIN }}" --build build --parallel |
| 83 | + -DCMAKE_C_COMPILER=clang \ |
| 84 | + -DCMAKE_CXX_COMPILER=clang++ |
| 85 | + cmake --build build --parallel |
80 | 86 |
|
81 | 87 | - name: Run Unit Tests |
82 | | - run: | |
83 | | - mkdir -p "${{ env.TEST_RESULTS_DIR }}" |
84 | | - ./build/tests --reporters=junit --out="${{ env.TEST_RESULTS_DIR }}/results.xml" |
85 | | -
|
86 | | - - name: Render JUnit results in GitHub UI |
87 | | - if: always() |
88 | | - |
89 | | - with: |
90 | | - name: ${{ matrix.name }} Tests |
91 | | - path: ${{ env.TEST_RESULTS_DIR }}/results.xml |
92 | | - reporter: java-junit |
93 | | - |
94 | | - - name: Upload Test Results Artifact |
95 | | - if: always() |
96 | | - uses: actions/upload-artifact@v4 |
97 | | - with: |
98 | | - name: ${{ matrix.name }}-test-results |
99 | | - path: ${{ env.TEST_RESULTS_DIR }}/results.xml |
| 88 | + run: ./build/tests |
0 commit comments