-
Notifications
You must be signed in to change notification settings - Fork 27
63 lines (52 loc) · 2.67 KB
/
c_checks.yml
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
61
62
63
# This is a basic workflow to help you get started with Actions
name: C Checks
# Controls when the workflow will run
on:
# Triggers the workflow on push events for the "main" branch
push:
branches: [ "main" ]
# Triggers the workflow on PR events
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update && sudo apt-get install ninja-build libmosquitto-dev uuid-dev libjson-c-dev libprotobuf-c-dev protobuf-c-compiler libprotobuf-dev -y
sudo apt install -y clang-format-9 libcmocka-dev libcmocka0
cmake --version
# Runs a set of commands using the runners shell
- name: Style check
run: |
clang-format-9 --version
clang-format-9 -style=file --verbose -i $(find . -name "*.[ch]" -not -path "./*/build/*" -not -name "*.pb-c.*")
git status --untracked-files=no --porcelain
if [[ `git status --untracked-files=no --porcelain` ]]; then
echo Some files were not formatted correctly according to the .clang-format file.
echo Please run clang-format to fix the issue by using this bash command at the root of the repo:
echo "clang-format -style=file -i $(find . -name "*.[ch]" -not -path "./*/build/*" -not -name "*.pb-c.*")"
exit 1
fi
echo Success, all files are formatted correctly according to the .clang-format file.
exit 0
- name: Build getting_started Samples
run: cmake --preset=getting_started;cmake --build --preset=getting_started
- name: Build telemetry Samples
run: cmake --preset=telemetry;cmake --build --preset=telemetry
- name: Build command Samples
run: protoc-c --c_out=./scenarios/command/c/protobuf --proto_path=./scenarios/command/c/protobuf unlock_command.proto google/protobuf/timestamp.proto; cmake --preset=command;cmake --build --preset=command
- name: Build & Run Unit Tests
run: |
cmake --preset=mqtt_client_extension_tests
cmake --build mqttclients/c/tests/build
ctest --preset mqtt_client_extension_tests