|
1 | 1 | name: Host Tests |
2 | 2 |
|
3 | | -on: [pull_request, push] |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: [main] |
4 | 7 |
|
5 | 8 | jobs: |
6 | 9 | tests: |
7 | 10 | runs-on: ubuntu-latest |
| 11 | + timeout-minutes: 25 |
| 12 | + |
8 | 13 | steps: |
9 | 14 | - uses: actions/checkout@v4 |
10 | | - - name: CMake toolchain |
11 | | - uses: aminya/setup-cpp@v1 |
12 | | - with: { compiler: llvm, cmake: true } |
13 | | - - name: Build & Run |
| 15 | + |
| 16 | + # Install build tools and GTest |
| 17 | + - name: Install deps |
| 18 | + run: | |
| 19 | + sudo apt-get update |
| 20 | + sudo apt-get install -y ninja-build cmake ccache libgtest-dev |
| 21 | + # Build GTest libs (headers are already present) |
| 22 | + sudo cmake -S /usr/src/googletest -B /usr/src/googletest/build |
| 23 | + sudo cmake --build /usr/src/googletest/build -j |
| 24 | + sudo cp -a /usr/src/googletest/build/lib/* /usr/local/lib/ |
| 25 | +
|
| 26 | + - name: Cache ccache |
| 27 | + uses: actions/cache@v4 |
| 28 | + with: |
| 29 | + path: ~/.cache/ccache |
| 30 | + key: ccache-host-${{ runner.os }}-${{ hashFiles('**/CMakeLists.txt', 'custom/**', 'tests/**') }} |
| 31 | + restore-keys: | |
| 32 | + ccache-host-${{ runner.os }}- |
| 33 | +
|
| 34 | + - name: Configure (Ninja + ccache + unity) |
| 35 | + env: |
| 36 | + CCACHE_DIR: ~/.cache/ccache |
14 | 37 | run: | |
15 | | - make test |
16 | | - ./tools/check_secrets.sh |
| 38 | + cmake -S tests -B tests/build \ |
| 39 | + -G Ninja \ |
| 40 | + -DCMAKE_UNITY_BUILD=ON \ |
| 41 | + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ |
| 42 | + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ |
| 43 | + -DROMS_ONLY=ON |
| 44 | +
|
| 45 | + - name: Build rooms_page_test |
| 46 | + run: cmake --build tests/build --target rooms_page_test -j |
| 47 | + |
| 48 | + - name: Run tests |
| 49 | + run: ctest --test-dir tests/build --output-on-failure --timeout 60 |
| 50 | + |
| 51 | + - name: Secret scan |
| 52 | + run: ./tools/check_secrets.sh |
0 commit comments