|
1 | | -name: Compile, run tests and check code style |
| 1 | +name: Ubuntu |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: |
6 | | - - '**' |
| 5 | + branches: [ main ] |
7 | 6 | pull_request: |
8 | | - branches: |
9 | | - - '**' |
| 7 | + branches: [ main ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + build_dir: "build" |
| 12 | + artifact: "cubool-ubuntu-build.tar.xz" |
10 | 13 |
|
11 | 14 | jobs: |
12 | 15 | build: |
| 16 | + name: Build ${{ matrix.os }} |
13 | 17 | runs-on: ${{ matrix.os }} |
14 | | - |
15 | 18 | strategy: |
16 | 19 | fail-fast: false |
| 20 | + matrix: |
| 21 | + include: |
| 22 | + - os: ubuntu-24.04 |
| 23 | + gcc: 14 |
| 24 | + |
| 25 | + env: |
| 26 | + config: "Release" |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + submodules: recursive |
| 32 | + |
| 33 | + - name: Configure CMake build |
| 34 | + run: | |
| 35 | + cmake -B ${{ env.build_dir }} -S . \ |
| 36 | + -DCMAKE_CXX_COMPILER=g++-${{ matrix.gcc }} \ |
| 37 | + -DCMAKE_C_COMPILER=gcc-${{ matrix.gcc }} \ |
| 38 | + -DCMAKE_BUILD_TYPE=${{ env.config }} \ |
| 39 | + -DCUBOOL_BUILD_TESTS=ON \ |
| 40 | + -DCUBOOL_WITH_CUDA=OFF \ |
| 41 | + -DCUBOOL_WITH_SEQUENTIAL=ON \ |
| 42 | + -DCUBOOL_GRAPH_ENABLE_TESTING=ON |
| 43 | +
|
| 44 | + - name: Build library sources |
| 45 | + run: | |
| 46 | + cmake --build ${{ env.build_dir }} \ |
| 47 | + --verbose \ |
| 48 | + -j10 |
| 49 | +
|
| 50 | + - name: Prepare upload binary |
| 51 | + run: | |
| 52 | + tar cfz ${{ env.artifact }} ${{ env.build_dir }} |
17 | 53 |
|
| 54 | + - name: Upload binary |
| 55 | + uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + name: ${{ env.artifact }} |
| 58 | + path: ${{ env.artifact }} |
| 59 | + |
| 60 | + test: |
| 61 | + name: Test CPU ${{ matrix.cpu }} |
| 62 | + needs: build |
| 63 | + runs-on: ${{ matrix.os }} |
| 64 | + strategy: |
| 65 | + fail-fast: false |
18 | 66 | matrix: |
19 | | - os: [ubuntu-24.04] |
20 | | - c_compiler: [gcc-14] |
21 | | - cpp_compiler: [g++-14] |
22 | | - build_type: [Release, Debug] |
| 67 | + include: |
| 68 | + - os: ubuntu-22.04 |
| 69 | + cpu: AMD-EPYC-7763 |
| 70 | + env: |
| 71 | + test-file: cpu_test.log |
23 | 72 |
|
24 | 73 | steps: |
25 | | - - uses: actions/checkout@v2 |
26 | | - with: |
27 | | - submodules: recursive |
28 | | - |
29 | | - - name: Setup enviroment |
30 | | - run: | |
31 | | - sudo apt update |
32 | | - sudo apt install gcc-14 |
33 | | - sudo apt install g++-14 |
34 | | - sudo apt install cmake |
35 | | - sudo apt install clang-format |
36 | | -
|
37 | | - - name: Configure CMake |
38 | | - run: | |
39 | | - cd ${{ github.workspace }} |
40 | | - cmake -B build -S . \ |
41 | | - -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \ |
42 | | - -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \ |
43 | | - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ |
44 | | - -DCUBOOL_GRAPH_ENABLE_TESTING=ON \ |
45 | | - -DCUBOOL_WITH_CUDA=OFF \ |
46 | | - -DCUBOOL_WITH_SEQUENTIAL=ON |
47 | | -
|
48 | | - - name: Build |
49 | | - run: | |
50 | | - cmake --build build -j10 |
51 | | -
|
52 | | - - name: Run tests |
53 | | - run: | |
54 | | - ./build/tests/cuboolgraph_tests |
| 74 | + - uses: actions/download-artifact@v4 |
| 75 | + with: |
| 76 | + name: ${{ env.artifact }} |
| 77 | + |
| 78 | + - name: Unarchive artifact |
| 79 | + run: | |
| 80 | + tar xzf ${{ env.artifact }} |
| 81 | + rm ${{ env.artifact }} |
| 82 | +
|
| 83 | + - name: Run tests |
| 84 | + working-directory: ${{ env.build_dir }}/tests |
| 85 | + run: | |
| 86 | + bash cuboolgraph_tests | tee ${{ env.test-file }} |
| 87 | +
|
| 88 | + - name: Upload tests resutls |
| 89 | + uses: actions/upload-artifact@v4 |
| 90 | + with: |
| 91 | + name: ${{ env.test-file }} |
| 92 | + path: ${{ env.build_dir }}/tests/${{ env.test-file }} |
| 93 | + |
| 94 | + - name: Check for unit tests results |
| 95 | + working-directory: ${{ env.build_dir }}/tests |
| 96 | + run: | |
| 97 | + ! grep -q "FAILED" ${{ env.test-file }} |
0 commit comments