Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Ren committed May 20, 2024
2 parents dea91ce + 22f0fb6 commit 0f417c4
Show file tree
Hide file tree
Showing 193 changed files with 8,861 additions and 6,154 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/citest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: citest

on:
push:
pull_request:
release:

jobs:
citest:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
#- name: Setup tmate session, see https://github.com/marketplace/actions/debugging-with-tmate
# uses: mxschmitt/action-tmate@v3
- name: prepare machine
run: |
sudo apt-get install \
autoconf \
build-essential \
gperf \
check \
help2man \
python3-pip
sudo pip3 install --upgrade 'pip<21.0'
sudo pip3 --disable-pip-version-check install behave flake8
- name: run build
run: |
./autogen.sh
make
- name: run tests
run: |
make check VERBOSE=1
make distcheck
flake8 features/
behave
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,16 @@ naemon.log
*.log
*.trs
.naemon.official
COPYING
INSTALL
naemon.logrotate.el6
naemon.logrotate.el7
debian/naemon-core.logrotate
debian/*.debhelper
debian/*.substvars
debian/naemon-core/
debian/naemon-dev/
debian/tmp/
debian/libnaemon/
debian/files
build
6 changes: 6 additions & 0 deletions .obs/workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
workflow:
steps:
- branch_package:
source_project: home:naemon:daily
source_package: naemon-core
target_project: home:naemon:test
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

85 changes: 85 additions & 0 deletions .vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Naemon development environment

Contributing to an open source project can be a challenging task,
even without figuring out how to launch the corresponding software
inside an IDE.
We are more than happy to see that you are interested in
contributing to the Naemon Core project.

To help you getting started, we provide predefined configurations
for [Visual Studio Code](https://code.visualstudio.com/) which will
attach a debugger and has predefined tasks to run the tests.

Basically this is everything you need to start coding.

Due to Naemon is program for Linux, a Linux system is required for development.
The shown configuration is tested on Ubuntu 22.04 and Fedora 37.
This documentation will most likely also work flowlesly on new or
older versions of Ubuntu and Fedora.

In addition it is possible to develop on a Windows system using WSL2 ([Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/install))


## Reqirements
- [Visual Studio Code](https://code.visualstudio.com/)
- [C/C++ Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)


## Install build dependencies
Naemon itself depends on several libraries. Everything needed can be easily
installed via the package manager of your distribution.

### Fedora
```
sudo dnf group install "Development Tools"
sudo dnf install git glib2-devel help2man gperf gcc gcc-c++ gdb cmake3 pkgconfig automake autoconf nagios-plugins-all libtool perl-Test-Simple
sudo ln -s /usr/lib64/nagios /usr/lib/nagios
```

### Ubuntu
```
sudo apt-get install git build-essential automake gperf gcc g++ gdb cmake help2man libtool libglib2.0-dev pkg-config libtest-simple-perl monitoring-plugins
```

## Setup VS Code
1. Clone this repository and open the folder with Visual Studio Code

2. Naemon requires a configuration file to launch.
Luckily there is a pre-configured task that will do all that for you.
From the menu select `Terminal > Run Task... > initial`
Normally you only need to run this task once.

3. You are ready to rock! Make your code changes, create breakpoints and so on.
To run Naemon with an debugger attached, select `Run and Debug > Start Debugging`
![VSCode with running Debugger](/.vscode/vscode_debugger.png)

4. Before you push your code changes, please make sure that all the tests are still green.
Again there is a predefined task you can execute via
`Terminal > Run Task... > Run Tests`
If all tests passed, feel free to push you code and to create a pull request.

## Naemon configuration files
Just in case you want to provide your own `naemon.cfg` or any other configuration file
just copy the files to `build/etc/naemon/`

## Known issues
If you get an error message like `Configured debug type 'cppdbg' is not supported` please make
sure you have the [C/C++ Extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) for
VS Code installed and enabled.

## Windows Subsystem for Linux
If you prefer to use Windows as platform, please make sure to install a Ubuntu or Fedora WSL2 instance.
The steps are the exactly the same as described above. We recommend to use the [Windows Terminal](https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701?hl=de-de&gl=de)
to get access to the Linux shell.

Make sure you have Visual Studio Code installed on your Windows System. To launch VS Code with the files
from the Naemon project, simply run the `code` command.

Run these commands on your WSL linux instance:
```
git clone https://github.com/naemon/naemon-core.git
cd naemon-core/
code .
```
![Using WSL2](/.vscode/vscode_wsl.png)
23 changes: 23 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
//"/usr/lib/gcc/x86_64-linux-gnu/11/include/**", // Debian / Ubuntu
//"/usr/include/x86_64-linux-gnu/**", // Debian / Ubuntu
//"/usr/lib/gcc/x86_64-redhat-linux/12/include/**", // Fedora
"/usr/local/include/**",
"/usr/include/**",
"/usr/lib64/**",
"/usr/lib/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
38 changes: 38 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Launch in dgb",
"type": "cppdbg",
"request": "launch",

// This will trigger the "make all" task from tasks.json
"preLaunchTask": "make all",
// We are not using the binary from the build folder because we do not want to run the "make install" task.
// The "make install" task is only to generate the default naemon configurtion files
"program": "${workspaceFolder}/src/naemon/.libs/naemon",
"args": [
//"--help",
"${workspaceFolder}/build/etc/naemon/naemon.cfg"
],
"cwd": "${workspaceFolder}",
"environment": [
{
"name": "LD_LIBRARY_PATH",
"value": "${workspaceFolder}/.libs"
}
],

// Optional parameter. If true, the debugger should stop at the entrypoint of the target.
"stopAtEntry": true,


"launchCompleteCommand": "exec-run",
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
}
]
}
83 changes: 83 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "autogen",
"type": "shell",
"command": "${cwd}/autogen.sh --prefix=${cwd}/build --with-naemon-user=$(whoami) --with-naemon-group=users --with-pluginsdir=/usr/lib/nagios/plugins",
"problemMatcher": [],
"group": {
"kind":"build",
"isDefault": false
}
},
{
"label": "make all",
"type": "shell",
"command": "make -j all",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": false
}
},
{
// Will create all required directories
"label": "mkdir",
"type": "shell",
"command": "mkdir -p ${cwd}/build/var/cache/naemon ${cwd}/build/var/spool/checkresults ${cwd}/build/etc/naemon/module-conf.d",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": false
}
},
{
// This will install the required default configuration files
"label": "make install",
"type": "shell",
"command": "make install",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": false
}
},
{
// Initial - Run this task, if you cloed the naemon source code from GitHub and want to start developing
// You only need to execute this task once
"label": "initial",
"type": "shell",
"command": "make install",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": false
},
"dependsOrder": "sequence",
"dependsOn":[
"autogen",
"make all",
"make install",
"mkdir"
]
},
{
// Run the Naemon test cases
"label": "Run Tests",
"type": "shell",
"command": "make test",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": false
},
"dependsOrder": "sequence",
"dependsOn":[
"autogen"
]
}
]
}
Binary file added .vscode/vscode_debugger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .vscode/vscode_wsl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 0f417c4

Please sign in to comment.