Skip to content

Commit 67cc13b

Browse files
committed
.github/ci.yaml: Added initial CI workflow
Also removed duplicate lines in README.md
1 parent 08ac24c commit 67cc13b

File tree

7 files changed

+230
-4
lines changed

7 files changed

+230
-4
lines changed

.github/ci.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
## Continuous integration for chrony-dbus-service
2+
3+
name: chrony-dbus-service-ci
4+
on: workflow_dispatch
5+
jobs:
6+
setup:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
build-release-tests-gcc:
12+
needs: setup
13+
uses: ./.github/workflows/cmake-gcc.yaml
14+
with:
15+
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=Release -DAPS_CHRONY_DBUS_SERVICE_BUILD_TESTS=ON
16+
build-rpm:
17+
needs: release-tests
18+
uses: ./.github/workflows/rpm.yaml
19+
tests:
20+
needs: setup
21+
uses: ./.github/workflows/tests.yaml
22+
build-doxygen:
23+
needs: setup
24+
uses: ./.github/workflows/doxygen.yaml
25+
cppcheck:
26+
needs: release-tests
27+
uses: ./.github/workflows/cppcheck.yaml
28+
clang-tidy:
29+
needs: setup
30+
uses: ./.github/workflows/cmake-gcc.yaml
31+
with:
32+
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=Debug -DAPS_CHRONY_DBUS_SERVICE_BUILD_TESTS=ON -DAPS_CHRONY_DBUS_SERVICE_ENABLE_CLANG_TIDY=ON
33+
clang-format:
34+
needs: setup
35+
runs-on: ubuntu-latest
36+
container:
37+
image: fedora:40
38+
env:
39+
PROJECT_NAME: ${GITHUB_REPOSITORY}
40+
BUILD_WORKSPACE: build
41+
volumes:
42+
- ${GITHUB_WORKSPACE}:/workspaces/${GITHUB_REPOSITORY}
43+
steps:
44+
- name: clang-format-run
45+
run: |
46+
dnf install -y clang-tools-extra
47+
cd /workspaces/$PROJECT_NAME
48+
clang-format --version
49+
./scripts/check_clang_format.sh tests src

.github/workflows/cmake-gcc.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## Builds a cmake project in a fedora:40 docker image with installed gcc toolchain
2+
3+
name: build-gcc
4+
on:
5+
workflow_call:
6+
inputs:
7+
CMAKE_PARAMS:
8+
description: Parameters passed to cmake
9+
required: true
10+
type: string
11+
jobs:
12+
build-gcc:
13+
runs-on: ubuntu-latest
14+
container:
15+
image: fedora:40
16+
env:
17+
PROJECT_NAME: ${GITHUB_REPOSITORY}
18+
BUILD_WORKSPACE: build
19+
PARALLEL: 16
20+
volumes:
21+
- ${GITHUB_WORKSPACE}:/workspaces/${GITHUB_REPOSITORY}
22+
steps:
23+
- name: build cmake gcc
24+
run: |
25+
dnf install -y cmake clang clang-tools-extra gcc gcc-c++ pkgconf-pkg-config dbus-libs
26+
cd /workspaces/$PROJECT_NAME
27+
rm -rf $BUILD_WORKSPACE # Ensure we start clean
28+
cmake . -B $BUILD_WORKSPACE ${{ inputs.CMAKE_PARAMS }}
29+
cmake --build $BUILD_WORKSPACE --parallel $PARALLEL
30+
31+

.github/workflows/cppcheck.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
## Builds the cmake project with CPPCHECK_EXHAUSTIVE=ON and runs cppcheck-codequality
2+
3+
name: cppcheck
4+
on: workflow_call
5+
jobs:
6+
cppcheck-build:
7+
runs-on: ubuntu-latest
8+
uses: ./.github/workflows/cmake-gcc.yaml
9+
with:
10+
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=Debug -DAPS_CHRONY_DBUS_SERVICE_ENABLE_CPPCHECK=ON -DAPS_CHRONY_DBUS_SERVICE_ENABLE_CPPCHECK_EXHAUSTIVE=ON
11+
cppcheck-run:
12+
needs: cppcheck-build
13+
runs-on: ubuntu-latest
14+
container:
15+
image: fedora:40
16+
env:
17+
PROJECT_NAME: ${GITHUB_REPOSITORY}
18+
BUILD_WORKSPACE: build
19+
volumes:
20+
- ${GITHUB_WORKSPACE}:/workspaces/${GITHUB_REPOSITORY}
21+
steps:
22+
- name: run-cppcheck
23+
run: |
24+
dnf install -y cppcheck
25+
cd /workspace/$PROJECT_NAME
26+
cppcheck-codequality --input-file $BUILD_WORKSPACE/cppcheck.xml --output-file $BUILD_WORKSPACE/cppcheck_report.json
27+
# Fix the file path references so they are relative to the blob and not the buildspace. We use ; as the substitute so don't have to escape every forwardslash
28+
sed -i "s;${GITHUB_REPOSITORY}/src;src;g" $BUILD_WORKSPACE/cppcheck_report.json
29+
sed -i "s;${GITHUB_REPOSITORY}/test;test;g" $BUILD_WORKSPACE/cppcheck_report.json
30+
if [ $(grep -ic "<error " $BUILD_WORKSPACE/cppcheck.xml) -gt 0 ]; then exit 1; fi
31+
- name: cppcheck-artifacts
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: cppcheck
35+
path: $BUILD_WORKSPACE/cppcheck_report.json

.github/workflows/doxygen.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
## Builds the doxygen documentation, currently the doxygen_junit part is disabled
2+
3+
name: doxygen
4+
on: workflow_call
5+
jobs:
6+
build-doxygen:
7+
runs-on: ubuntu-latest
8+
container:
9+
image: fedora:40
10+
env:
11+
PROJECT_NAME: ${GITHUB_REPOSITORY}
12+
BUILD_WORKSPACE: build
13+
volumes:
14+
- ${GITHUB_WORKSPACE}:/workspaces/${GITHUB_REPOSITORY}
15+
steps:
16+
- name: doxygen-build
17+
run: |
18+
dnf install -y doxygen gzip
19+
chmod 777 scripts/*.sh
20+
scripts/doxygen.sh
21+
cd $BUILD_WORKSPACE/doxygen/
22+
tar -zcf doxygen.tar.gz html/
23+
- name: doxygen-artifacts
24+
uses: actions/upload-artifact@v4
25+
with:
26+
name: doxygen
27+
path: doxygen.tar.gz
28+
- name: doxygen-test
29+
if: false # what package provides doxygen_junit?
30+
run: |
31+
dnf install -y doxygen
32+
cd /workspaces/$PROJECT_NAME
33+
chmod 777 scripts/*.sh
34+
scripts/doxygen.sh || true
35+
# Fix the file path references so they are relative to the blob and not the buildspace. We use ; as the substitute so don't have to escape every forwardslash
36+
sed -i "s;${GITHUB_REPOSITORY}/src;src;g" $BUILD_WORKSPACE/doxygen/doxygen_warnings.log || exit 1
37+
sed -i "s;${GITHUB_REPOSITORY}/test;test;g" $BUILD_WORKSPACE/doxygen/doxygen_warnings.log || exit 1
38+
doxygen_junit --input $BUILD_WORKSPACE/doxygen/doxygen_warnings.log --output $BUILD_WORKSPACE/doxygen/doxygen_junit.xml || exit 1
39+
grep -iq "<error " "$BUILD_WORKSPACE/doxygen/doxygen_junit.xml" && exit 1 || exit 0
40+
41+

.github/workflows/rpm.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: build-rpm
2+
on: workflow_call
3+
jobs:
4+
build-rpm:
5+
runs-on: ubuntu-latest
6+
container:
7+
image: fedora:40
8+
env:
9+
PROJECT_NAME: ${GITHUB_REPOSITORY}
10+
BUILD_WORKSPACE: build
11+
volumes:
12+
- ${GITHUB_WORKSPACE}:/workspaces/${GITHUB_REPOSITORY}
13+
steps:
14+
- name: build-rpm
15+
run: |
16+
dnf install -y rpmdevtools cmake gcc gcc-c++ pkgconf-pkg-config dbus-libs
17+
cd /workspaces/$PROJECT_NAME
18+
rm -rf $BUILD_WORKSPACE # Ensure we start clean
19+
sed -i "s/set(CPACK_RPM_PACKAGE_RELEASE \"[0-9]\+\")/set(CPACK_RPM_PACKAGE_RELEASE \"${GITHUB_RUN_ID}\")/" packaging/rpm/cpack_config.cmake
20+
cmake . -B $BUILD_WORKSPACE -DAPS_CHRONY_DBUS_SERVICE_FETCH_CONTENT_USE_GITLAB_CI_TOKEN=ON -DCMAKE_BUILD_TYPE=Release -DAPS_CHRONY_DBUS_SERVICE_BUILD_TESTS=OFF -DAPS_CHRONY_DBUS_SERVICE_CPACK_RPM_TYPE=RPM
21+
cmake --build $BUILD_WORKSPACE --parallel $PARALLEL
22+
pushd $BUILD_WORKSPACE
23+
../scripts/build_rpm.sh
24+
popd
25+
cmake . -B $BUILD_WORKSPACE -DAPS_CHRONY_DBUS_SERVICE_FETCH_CONTENT_USE_GITLAB_CI_TOKEN=ON -DCMAKE_BUILD_TYPE=Release -DAPS_CHRONY_DBUS_SERVICE_BUILD_TESTS=OFF -DAPS_CHRONY_DBUS_SERVICE_CPACK_RPM_TYPE=SRPM
26+
cmake --build $BUILD_WORKSPACE --parallel $PARALLEL
27+
pushd $BUILD_WORKSPACE
28+
../scripts/build_rpm.sh
29+
popd
30+
mkdir -p $BUILD_WORKSPACE/RPM
31+
rm -rf $BUILD_WORKSPACE/RPM/*
32+
mv $BUILD_WORKSPACE/*.rpm $BUILD_WORKSPACE/RPM
33+
- name: rpm-artifacts
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: rpm
37+
path: ${GITHUB_WORKSPACE}/build/RPM/*.rpm
38+

.github/workflows/tests.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Builds the cmake project with BUILD_TESTS=ON and runs the tests with ctest
2+
3+
name: run-tests
4+
on:
5+
workflow_call:
6+
inputs:
7+
TEST_PARAMS:
8+
description: Parameters passed to ctest
9+
type: string
10+
default: --parallel 16 --schedule-random
11+
jobs:
12+
build-tests:
13+
uses: ./.github/workflows/cmake-gcc.yaml
14+
with:
15+
CMAKE_PARAMS: -DCMAKE_BUILD_TYPE=Release -DAPS_CHRONY_DBUS_SERVICE_BUILD_TESTS=ON
16+
ctest:
17+
needs: build-tests
18+
runs-on: ubuntu-latest
19+
container:
20+
image: fedora:40
21+
env:
22+
PROJECT_NAME: ${GITHUB_REPOSITORY}
23+
BUILD_WORKSPACE: build
24+
CTEST: ${{ inputs.TEST_PARAMS }}
25+
volumes:
26+
- ${GITHUB_WORKSPACE}:/workspaces/${GITHUB_REPOSITORY}
27+
steps:
28+
- name: run-ctest
29+
run: |
30+
dnf install -y freeradius gtest ctest chrony dbus-libs dbus-daemon
31+
cd /workspaces/$PROJECT_NAME/$BUILD_WORKSPACE
32+
. ../tests/setupenv.sh # start chrony, dbus and set the DBUS_SESSION_BUS_ADDRESS
33+
./src/chrony-dbus-service &
34+
ctest $CTEST
35+
36+

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
# This is the README for chrony-dbus-service.
22

33
## What is chrony?
4-
---
54
chrony is a versatile implementation of the Network Time Protocol (NTP).
65

76
see [gitlab.com/chrony](https://gitlab.com/chrony/chrony)
87

98

109
## What is chrony-dbus-service?
11-
---
1210
To configure chronyd with the chronyc command line tool, each command has to written in a parseable line of text.
1311
Executing chronyc from within another application doesn't provide a good usability and in case that the chronyc parser is changed it will cause maintainability issues.
1412
The chrony-dbus-service provides partial functionality of configuring chornyd like it would be possible with chronyc, but instead this functionality is provided as an accessible DBus interface API.
1513

1614

1715
## Features
18-
---
1916
- ** getSources: ** Lists chronyd sources like calling `chronyc sources`
2017
- ** addServers: ** Adds NTP servers to chronyd like calling `chronyc add server`
2118
- ** deleteServers: ** Removes NTP servers from chronyd like calling `chronyc delete`
@@ -26,6 +23,5 @@ The chrony-dbus-service provides partial functionality of configuring chornyd li
2623

2724

2825
## How to use chrony-dbus-service?
29-
3026
You can use any DBus compatible library like e.g. libdbus-c++ or simppl.
3127
For an example see [chronydbustest.cpp](src/tests/chronydbustest.cpp).

0 commit comments

Comments
 (0)