name: Package on: push: branches: [main] paths: &paths - Makefile - Dockerfile - go.mod - go.sum - config/** - doc/lw.1 - deploy/package/** - .github/workflows/package.yml pull_request: paths: *paths workflow_dispatch: permissions: contents: read jobs: # make arch builds the AUR package from this checkout; the package installs # over an edited configuration make install left, reinstalls keeping it, and # goes. makepkg refuses root, so a user that owns the checkout runs it. arch: runs-on: ubuntu-latest timeout-minutes: 20 container: archlinux:base-devel steps: - run: pacman -Syu --noconfirm --needed git go - uses: actions/checkout@v5 - run: | useradd -m build chown -R build . su build -c 'make arch' - run: | for f in bin/arch/logwisp-*.pkg.tar.zst; do case $f in *-debug-*) ;; *) pkg=$f ;; esac; done install -D -m 0644 config/logwisp.toml /etc/logwisp/logwisp.toml echo '# edited' >> /etc/logwisp/logwisp.toml pacman -U --noconfirm "$pkg" test -f /etc/logwisp/logwisp.toml.pacnew lw --version test -f /usr/share/bash-completion/completions/lw test -f /usr/share/zsh/site-functions/_lw test -f /usr/share/fish/vendor_completions.d/lw.fish pacman -U --noconfirm "$pkg" grep -q '^# edited' /etc/logwisp/logwisp.toml lw --check -c /etc/logwisp/logwisp.toml pacman -R --noconfirm logwisp test ! -e /usr/bin/lw test -f /etc/logwisp/logwisp.toml.pacsave # make release install as a user without root installs into the home, # twice, without the service; lw config init then places the configuration # lw reads without -c, and never replaces it. An explicit PREFIX the user # cannot write fails before writing. user: runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: go-version-file: go.mod - run: | make release install make install export PATH="$HOME/.local/bin:$PATH" test ! -e /usr/bin/lw test ! -e "$HOME/.local/lib/systemd/system/logwisp.service" test ! -e "$HOME/.config/logwisp/logwisp.toml" if make install PREFIX=/usr SERVICE=no; then exit 1; fi test ! -e /usr/bin/lw lw config init lw --check lw --dump | grep -q '^status_reporter = true' if lw config init; then exit 1; fi make uninstall test ! -e "$HOME/.local/bin/lw" test -f "$HOME/.config/logwisp/logwisp.toml" # make deb on a host with systemd: the service runs once the package's # configuration, which ships no pipeline, gets one, and survives a reinstall # that keeps it; remove stops and disables it and leaves the conffile, purge # removes that too deb: runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v5 - uses: actions/setup-go@v6 with: go-version-file: go.mod - run: make deb - run: | sudo apt-get install -y ./bin/logwisp_*.deb lw --version test -f /usr/share/zsh/vendor-completions/_lw printf '[[pipelines]]\nname = "ci"\n[[pipelines.plugin_sources]]\nid = "in"\ntype = "null"\n[[pipelines.plugin_sinks]]\nid = "out"\ntype = "null"\n' | sudo tee -a /etc/logwisp/logwisp.toml sudo systemctl enable --now logwisp sleep 3 systemctl is-active logwisp || { sudo journalctl -u logwisp --no-pager; exit 1; } echo '# edited' | sudo tee -a /etc/logwisp/logwisp.toml sudo apt-get install --reinstall -y ./bin/logwisp_*.deb grep -q '^# edited' /etc/logwisp/logwisp.toml sleep 3 systemctl is-active logwisp || { sudo journalctl -u logwisp --no-pager; exit 1; } sudo apt-get remove -y logwisp test ! -e /usr/bin/lw test ! -e /usr/lib/systemd/system/logwisp.service test ! -e /etc/systemd/system/multi-user.target.wants/logwisp.service if systemctl is-active --quiet logwisp; then exit 1; fi test -f /etc/logwisp/logwisp.toml sudo apt-get purge -y logwisp test ! -e /etc/logwisp/logwisp.toml # BSD make on FreeBSD: build, install twice keeping an edited configuration, # run the rc.d service once the configuration has a pipeline, uninstall freebsd: runs-on: ubuntu-latest timeout-minutes: 20 steps: - uses: actions/checkout@v5 - uses: vmactions/freebsd-vm@c46abacb49f09938ca4e1702d15d836285d694cc # v1.5.9 with: release: "15.1" copyback: false prepare: pkg install -y go127 run: | set -e make release make install echo '# edited' >> /usr/local/etc/logwisp/logwisp.toml make install grep -q '^# edited' /usr/local/etc/logwisp/logwisp.toml lw --version pw groupadd logwisp pw useradd logwisp -g logwisp -d /nonexistent -s /usr/sbin/nologin printf '[[pipelines]]\nname = "ci"\n[[pipelines.plugin_sources]]\nid = "in"\ntype = "null"\n[[pipelines.plugin_sinks]]\nid = "out"\ntype = "null"\n' >> /usr/local/etc/logwisp/logwisp.toml service logwisp onestart sleep 3 service logwisp onestatus service logwisp onestop make uninstall test ! -e /usr/local/bin/lw image: runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@v5 - run: make image image-check