Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ jobs:
- run: ./dependencies.sh
- run: make
- run: make test
- run: make deb
- run: dpkg -i build/*.deb
- run: wgwatch --help
- uses: actions/upload-artifact@v4
with:
name: wgwatch-deb
path: build/*.deb

fedora:
runs-on: ubuntu-latest
Expand All @@ -22,6 +29,13 @@ jobs:
- run: ./dependencies.sh
- run: make
- run: make test
- run: make rpm
- run: dnf install -y ./build/*.rpm
- run: wgwatch --help
- uses: actions/upload-artifact@v4
with:
name: wgwatch-rpm
path: build/*.rpm

nix-shell:
runs-on: ubuntu-latest
Expand All @@ -39,3 +53,22 @@ jobs:
- uses: DeterminateSystems/magic-nix-cache-action@main
- run: nix build .#default
- run: ./result/bin/wgwatch --help

release:
needs: [debian, fedora]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
name: wgwatch-deb
- uses: actions/download-artifact@v4
with:
name: wgwatch-rpm
- uses: softprops/action-gh-release@v2
with:
files: |
*.deb
*.rpm
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
.envrc
*~
*.log
*.deb
*.rpm
state-*
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,14 @@ install(TARGETS wgwatch DESTINATION bin)

enable_testing()
add_subdirectory(tests)

# Binary packages via `make deb` / `make rpm` (cpack -G DEB/RPM).
# Runtime deps: DEB via dpkg-shlibdeps, RPM via rpmbuild auto-Requires.
set(CPACK_PACKAGE_NAME "wgwatch")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_CONTACT "bartman")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Top-like WireGuard monitor")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
include(CPack)
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ else
$(error TYPE must be release or debug (got '$(TYPE)'))
endif

.PHONY: all clean distclean test install help config
.PHONY: all clean distclean test install deb rpm help config

all: config
cmake --build $(BUILD)
Expand All @@ -57,13 +57,21 @@ test: all
install: all
cmake --install $(BUILD) --prefix $(HOME)/.local

deb: all
cmake -E chdir $(BUILD) cpack -G DEB

rpm: all
cmake -E chdir $(BUILD) cpack -G RPM

help:
@echo "targets:"
@echo " all build the project (default)"
@echo " clean clean the binaries"
@echo " distclean remove BUILD directory"
@echo " test run unit tests"
@echo " install install binary in ~/.local/bin"
@echo " deb build .deb package (Debian)"
@echo " rpm build .rpm package (Fedora)"
@echo ""
@echo "variables:"
@echo " BUILD=build use a different build directory"
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,23 @@ Use wgwatch from your own flake / NixOS config:
Without flakes: `nix-build` puts the binary at `./result/bin/wgwatch`
(see `default.nix`).

## Packages

Automated .deb and .rpm builds are available for download and manual install.
These have not been thoroughly tested.

https://github.com/bartman/wgwatch/releases/latest

On Debian based systems (from the download directory):
```sh
sudo apt install ./wgwatch_0.1.0_amd64.deb
```

On Fedora based systems (from the download directory):
```sh
sudo dnf install ./wgwatch-0.1.0-1.x86_64.rpm
```

## Options

```sh
Expand Down
4 changes: 2 additions & 2 deletions dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ fi

if command -v apt-get >/dev/null 2>&1; then
$SUDO apt-get update && $SUDO apt-get install -y \
clang g++ cmake ninja-build pkg-config git ca-certificates \
clang g++ cmake ninja-build pkg-config git ca-certificates dpkg-dev file \
libev-dev libfmt-dev libspdlog-dev libgtest-dev
elif command -v dnf >/dev/null 2>&1; then
$SUDO dnf install -y \
clang gcc-c++ cmake ninja-build pkg-config git ca-certificates \
clang gcc-c++ cmake ninja-build pkg-config git ca-certificates rpm-build \
libev-devel fmt-devel spdlog-devel gtest-devel
else
msg "no apt-get/dnf found; skipping (use nix develop for deps)"
Expand Down
Loading