-
-
Notifications
You must be signed in to change notification settings - Fork 20
60 lines (49 loc) · 1.73 KB
/
Copy pathcmake.yml
File metadata and controls
60 lines (49 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: CI/CD Pipeline
on:
push:
branches: ["main", "develop"]
pull_request:
branches: ["main", "develop"]
env:
BUILD_TYPE: Release
jobs:
test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.7
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler build-essential
python3 -m pip install protobuf grpcio-tools
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}-${{ matrix.os || 'ubuntu-latest' }}-mbedtls-3.6.2
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=g++
-DCMAKE_C_COMPILER=gcc
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-S ${{ github.workspace }}
- name: Build Library
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config Release
- name: Run Tests
working-directory: ${{ steps.strings.outputs.build-output-dir }}
run: ctest --build-config Release --output-on-failure --verbose
- name: Build and run example
run: |
mkdir -p build-example && cd build-example
cmake ../examples/simple -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build . --config Release
./simple