-
Notifications
You must be signed in to change notification settings - Fork 11
204 lines (188 loc) · 7.11 KB
/
main.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: Main Workflow
on: [push, pull_request]
env:
LLVM_VERSION: 14
YAKUT_COMPILE_OUTPUT: "${{ github.workspace }}"
YAKUT_PATH: "${{ github.workspace }}"
jobs:
debug:
runs-on: ubuntu-22.04
strategy:
matrix:
toolchain: ['clang', 'gcc']
include:
- toolchain: gcc
c-compiler: gcc
cxx-compiler: g++
- toolchain: clang
c-compiler: clang
cxx-compiler: clang++
steps:
- uses: actions/checkout@v2
- run: |
sudo apt update
sudo apt install gcc-multilib g++-multilib clang-tidy-$LLVM_VERSION ncat
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-$LLVM_VERSION 50
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$LLVM_VERSION 50
sudo apt install "linux-*-extra-$(uname -r)"
python -m pip --disable-pip-version-check install yakut~=0.7
- run: >
cmake
-B ${{ github.workspace }}/build
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER=${{ matrix.c-compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cxx-compiler }}
tests
- working-directory: ${{github.workspace}}/build
run: |
yakut compile https://github.com/OpenCyphal/public_regulated_data_types/archive/refs/heads/master.zip
make VERBOSE=1 -j2
make test
- uses: actions/upload-artifact@v2
if: always()
with:
name: ${{github.job}}
path: |
${{github.workspace}}/**/*
optimizations:
runs-on: ubuntu-latest
strategy:
matrix:
toolchain: ['clang', 'gcc']
build_type: [Release, MinSizeRel]
include:
- toolchain: gcc
c-compiler: gcc
cxx-compiler: g++
- toolchain: clang
c-compiler: clang
cxx-compiler: clang++
steps:
- uses: actions/checkout@v2
- run: |
sudo apt update
sudo apt install gcc-multilib g++-multilib ncat
sudo apt install "linux-*-extra-$(uname -r)"
python -m pip --disable-pip-version-check install yakut~=0.7
- run: >
cmake
-B ${{ github.workspace }}/build
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_C_COMPILER=${{ matrix.c-compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cxx-compiler }}
-DNO_STATIC_ANALYSIS=1
tests
- working-directory: ${{github.workspace}}/build
run: |
make VERBOSE=1 -j2
yakut compile https://github.com/OpenCyphal/public_regulated_data_types/archive/refs/heads/master.zip
make test
- uses: actions/upload-artifact@v2
if: always()
with:
name: ${{github.job}}
path: |
${{github.workspace}}/**/*
tools:
runs-on: ubuntu-latest
env:
python-version: 3.9
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ env.python-version }}
architecture: x64
- run: ./tests/tools/test.sh
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
source: ./kocherga ./tests
exclude: ./tests/3rd_party
extensions: cpp,hpp
clangFormatVersion: ${{env.LLVM_VERSION}}
- run: |
pip install black
black --check ./tools/
sonarcloud:
runs-on: ubuntu-latest
env:
SONAR_SCANNER_VERSION: 5.0.1.3006
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: |
echo "GITHUB_REF: '$GITHUB_REF'"
echo "GITHUB_HEAD_REF: '$GITHUB_HEAD_REF'"
echo "GITHUB_BASE_REF: '$GITHUB_BASE_REF'"
- name: Install Dependencies
run: |
sudo apt update
sudo apt install gcc-multilib g++-multilib ncat
sudo apt install "linux-*-extra-$(uname -r)"
python -m pip --disable-pip-version-check install yakut~=0.7
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Download and set up sonar-scanner
env:
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
run: |
mkdir -p $HOME/.sonar
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
- name: Download and set up build-wrapper
env:
BUILD_WRAPPER_DOWNLOAD_URL: https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
run: |
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
- name: Build and test
run: |
cmake tests -DCMAKE_BUILD_TYPE=Debug -DNO_STATIC_ANALYSIS=1 -DCMAKE_CXX_FLAGS='-DNDEBUG=1'
build-wrapper-linux-x86-64 --out-dir . make all VERBOSE=1
yakut compile https://github.com/OpenCyphal/public_regulated_data_types/archive/refs/heads/master.zip
make test
gcov --preserve-paths --long-file-names $(find integration/CMakeFiles/bootloader.dir -name '*.gcno')
gcov --preserve-paths --long-file-names $(find unit/CMakeFiles/test_cov.dir -name '*.gcno')
# https://community.sonarsource.com/t/analyzing-a-header-only-c-library/51468
- name: Run sonar-scanner
if: env.SONAR_TOKEN != ''
run: >
sonar-scanner
--define sonar.host.url="https://sonarcloud.io"
--define sonar.projectName=kocherga
--define sonar.organization=zubax
--define sonar.projectKey=Zubax_kocherga
--define sonar.sources=kocherga,tests/unit,tests/integration
--define sonar.issue.ignore.allfile=a1,a2
--define sonar.issue.ignore.allfile.a1.fileRegexp='^#include.*catch\.hpp[>"]$'
--define sonar.issue.ignore.allfile.a2.fileRegexp='^auto main\([^)]*\) -> int$'
--define sonar.coverage.exclusions="tests/**/*"
--define sonar.cpd.exclusions="tests/**/*"
--define sonar.cfamily.gcov.reportsPath=.
--define sonar.cfamily.cache.enabled=false
--define sonar.cfamily.threads=2
--define sonar.cfamily.build-wrapper-output=.
$([ -z "$GITHUB_BASE_REF" ] && echo "--define sonar.branch.name=${GITHUB_REF##*/}" || true)
- uses: actions/upload-artifact@v2
if: always()
with:
name: ${{github.job}}
path: ${{github.workspace}}/**/*