diff --git a/.github/workflows/debian-package.yml b/.github/workflows/debian-package.yml new file mode 100644 index 0000000..0ed4566 --- /dev/null +++ b/.github/workflows/debian-package.yml @@ -0,0 +1,23 @@ +name: Debian package + +on: + push: + branches: + - feature/* + - main + workflow_dispatch: + +jobs: + build-deb: + runs-on: ubuntu-latest + steps: + - name: Check out source + uses: actions/checkout@v3 + + - name: build debian package + uses: jtdor/build-deb-action@v1 + env: + DEB_BUILD_OPTIONS: noautodbgsym + with: + buildpackage-opts: --build=binary --no-sign + docker-image: ubuntu:focal diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d43d37..927b7db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ Notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.0.4] - 2023-12-29 + +### Changed + +- Ensure test suite is timezone-independent. + ## [3.0.3] - 2023-12-29 ### Changed diff --git a/Makefile b/Makefile index a70d152..691941c 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ PREFIX=/usr/local SHAREDIR=share/$(NAME) SYSTEMD_SERVICE_DIR=/lib/systemd/system USER=$(NAME) -VERSION=3.0.3 +VERSION=3.0.4 RELEASE=1 TESTS=\ @@ -54,15 +54,13 @@ install: src/jinja2_render.py src/ntpmon.env > $(DESTDIR)/$(CONFDIR)/$(NAME) release: + grep -qw "$(VERSION)" CHANGELOG.md dch --newversion $(VERSION)-$(RELEASE) dch --release --distribution focal - for i in CHANGELOG.md debian/changelog debian/*.rst; do \ - grep -qw "$(VERSION)" $$i || exit 1; \ - done + git commit -m'Prepare $(VERSION) release' -a tag: - git commit -m'Prepare $(VERSION) release' -a - git tag --sign v$(VERSION) + git tag --sign -m'$(VERSION) release' v$(VERSION) git push --tags dput: diff --git a/debian/changelog b/debian/changelog index 77caf7f..031a25f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +ntpmon (3.0.4-1) focal; urgency=medium + + * New upstream release to fix test suite. + + -- Paul Gear Fri, 29 Dec 2023 15:52:46 +1000 + ntpmon (3.0.3-1) focal; urgency=medium * Further fixes to focal build. diff --git a/debian/check_ntpmon-man.rst b/debian/check_ntpmon-man.rst index 9e20330..21d3ecd 100644 --- a/debian/check_ntpmon-man.rst +++ b/debian/check_ntpmon-man.rst @@ -1,4 +1,4 @@ -:Version: 3.0.3 +:Version: 3.0 :Date: 2023-12-28 :Copyright: 2015-2023 Paul Gear :Title: check_ntpmon @@ -25,11 +25,15 @@ Common Options options: -h, --help show this help message and exit + --check [{proc,offset,peers,reach,reachability,sync,vars} ...] Select checks to run; if omitted, run all checks. + --debug Include command output and internal state dump along with check results. + --run-time RUN_TIME Time in seconds (default: 512) for which to always return OK after NTP daemon startup. + --test Obtain peer stats on standard input instead of from running daemon. diff --git a/debian/ntpmon-man.rst b/debian/ntpmon-man.rst index 364292b..2240abe 100644 --- a/debian/ntpmon-man.rst +++ b/debian/ntpmon-man.rst @@ -1,4 +1,4 @@ -:Version: 3.0.3 +:Version: 3.0 :Date: 2023-12-28 :Copyright: 2015-2023 Paul Gear :Title: ntpmon diff --git a/src/peer_stats.py b/src/peer_stats.py index 21a014b..2a94fdf 100755 --- a/src/peer_stats.py +++ b/src/peer_stats.py @@ -190,7 +190,7 @@ def extract_chrony_tracking(f: List[str]) -> dict: def extract_ntp_peerstats(f: List[str]) -> dict: basefields = { # sorted by field position rather than name - "datetime": datetime.datetime.fromtimestamp(mjd_to_timestamp(float(f[0]), float(f[1]))), + "datetime": datetime.datetime.fromtimestamp(mjd_to_timestamp(float(f[0]), float(f[1])), tz=datetime.timezone.utc), "source": f[2], "offset": float(f[4]), "delay": float(f[5]), diff --git a/unit_tests/test_peer_stats.py b/unit_tests/test_peer_stats.py index d7065d2..99bef59 100644 --- a/unit_tests/test_peer_stats.py +++ b/unit_tests/test_peer_stats.py @@ -69,7 +69,7 @@ def test_parse_ntpd_peerstats() -> None: assert all([m is not None for m in measurements]) assert measurements[0]["reachable"] == True assert measurements[0]["type"] == "survivor" - assert measurements[1]["datetime"] == datetime.datetime(2023, 12, 25, 18, 41, 56, 612000) + assert measurements[1]["datetime"] == datetime.datetime(2023, 12, 25, 8, 41, 56, 612000, tzinfo=datetime.timezone.utc) assert measurements[2]["offset"] > 0 assert measurements[3]["type"] == "outlier" assert measurements[5]["type"] == "sync"