Skip to content

Commit b1381b4

Browse files
committed
workflow: update sonarcloud integration
1 parent ecbd1cc commit b1381b4

File tree

3 files changed

+59
-35
lines changed

3 files changed

+59
-35
lines changed
Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#!/bin/bash
2-
# @file build.sh
3-
# @brief Build library and examples
1+
# @file build.yml
2+
# @brief Used to build library and example
43
#
54
# MIT License
65
#
@@ -24,5 +23,35 @@
2423
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2524
# SOFTWARE.
2625

27-
cmake -B build -DENABLE_COTE_EXAMPLES=ON .
28-
cmake --build build -j$(nproc)
26+
name: build
27+
28+
on:
29+
push:
30+
branches:
31+
- '**'
32+
pull_request:
33+
types: [opened, synchronize, reopened]
34+
35+
jobs:
36+
build:
37+
name: Build
38+
runs-on: ubuntu-24.04
39+
steps:
40+
# Checkout c-cote
41+
- name: Checkout c-cote
42+
uses: actions/checkout@v5
43+
with:
44+
path: c-cote
45+
46+
# Checkout submodules
47+
- name: Checkout submodules
48+
working-directory: c-cote
49+
run: git submodule update --init --recursive
50+
51+
# Check code format
52+
- name: Check headers
53+
if: ${{ always() }}
54+
working-directory: c-cote
55+
run: |
56+
cmake -B build -DENABLE_COTE_EXAMPLES=ON .
57+
cmake --build build -j$(nproc)
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# @file ci.yml
2-
# @brief Used to perform code format checking and Sonarcloud analysis
1+
# @file check-code-format.yml
2+
# @brief Used to perform code format checking
33
#
44
# MIT License
55
#
@@ -23,55 +23,49 @@
2323
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2424
# SOFTWARE.
2525

26-
name: ci
26+
name: check-code-format
27+
2728
on:
2829
push:
2930
branches:
3031
- '**'
3132
pull_request:
3233
types: [opened, synchronize, reopened]
33-
schedule:
34-
- cron: '0 0 1 * *'
34+
3535
jobs:
36-
check:
36+
check-code-format:
3737
name: Check code format
3838
runs-on: ubuntu-24.04
3939
steps:
40-
- uses: actions/checkout@v3
41-
with:
42-
fetch-depth: 0
40+
# Install tools
4341
- name: Install tools
4442
run: |
4543
sudo apt-get install clang-format pcregrep
44+
45+
# Checkout c-cote
46+
- name: Checkout c-cote
47+
uses: actions/checkout@v5
48+
with:
49+
path: c-cote
50+
51+
# Check code format
4652
- name: Check headers
53+
if: ${{ always() }}
54+
working-directory: c-cote
4755
run: |
4856
./.github/workflows/check_headers.sh
4957
- name: Check include guards
58+
if: ${{ always() }}
59+
working-directory: c-cote
5060
run: |
5161
./.github/workflows/check_include_guards.sh
5262
- name: Check equivalence tests
63+
if: ${{ always() }}
64+
working-directory: c-cote
5365
run: |
5466
./.github/workflows/check_equivalence_tests.sh
5567
- name: Check code format
68+
if: ${{ always() }}
69+
working-directory: c-cote
5670
run: |
5771
./.github/workflows/check_code_format.sh
58-
build:
59-
name: SonarCloud analysis
60-
runs-on: ubuntu-24.04
61-
steps:
62-
- uses: actions/checkout@v3
63-
with:
64-
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
65-
- name: Checkout submodules
66-
run: git submodule update --init --recursive
67-
- name: Install sonar-scanner and build-wrapper
68-
uses: SonarSource/sonarcloud-github-c-cpp@v2
69-
- name: Run build-wrapper
70-
run: |
71-
build-wrapper-linux-x86-64 --out-dir bw_output ./.github/workflows/build.sh
72-
- name: Run sonar-scanner
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
76-
run: |
77-
sonar-scanner -Dsonar.organization=joelguittet -Dsonar.projectKey=joelguittet_c-cote -Dsonar.inclusions=include/**/*,src/**/* -Dsonar.projectVersion=$(cat VERSION) -Dsonar.cfamily.build-wrapper-output=bw_output

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# c-cote
22

3-
[![CI Badge](https://github.com/joelguittet/c-cote/workflows/ci/badge.svg)](https://github.com/joelguittet/c-cote/actions)
3+
[![Workflow check-code-format Badge](https://github.com/joelguittet/c-cote/workflows/check-code-format/badge.svg)](https://github.com/joelguittet/c-cote/actions)
4+
[![Workflow build Badge](https://github.com/joelguittet/c-cote/workflows/build/badge.svg)](https://github.com/joelguittet/c-cote/actions)
45
[![Issues Badge](https://img.shields.io/github/issues/joelguittet/c-cote)](https://github.com/joelguittet/c-cote/issues)
56
[![License Badge](https://img.shields.io/github/license/joelguittet/c-cote)](https://github.com/joelguittet/c-cote/blob/master/LICENSE)
67

0 commit comments

Comments
 (0)