Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
87d0ece
.github/workflows/codeql.yml: fix typo for ccache key name
jimklimov Nov 6, 2025
ae6fc29
Makefile.am: dist-hook: report if DISTing VERSION_FORCED* files
jimklimov Nov 6, 2025
c5fc7e0
Makefile.am, NEWS.adoc, docs/maintainer-guide.txt: introduce `make di…
jimklimov Nov 6, 2025
a27e826
.github/workflows: re-number the jobs to hopefully impact processing …
jimklimov Nov 6, 2025
f64ec1a
.github/workflows/01-make-dist.yml, NEWS.adoc: introduce a CI job to …
jimklimov Nov 6, 2025
30425ed
.github/workflows/01-make-dist.yml: do not `make dist-sig` (via `dist…
jimklimov Nov 6, 2025
d78fa4b
.github/workflows/01-make-dist.yml: more debugging of git workspace […
jimklimov Nov 6, 2025
e9806d3
.github/workflows/01-make-dist.yml: fix GHA scripting syntax; update …
jimklimov Nov 6, 2025
30d5eaa
.github/workflows/01-make-dist.yml: try to post a link to tarballs on…
jimklimov Nov 6, 2025
4461767
.github/workflows/01-make-dist.yml: pull whole repo if `git describe`…
jimklimov Nov 6, 2025
11b1153
.github/workflows/01-make-dist.yml: act on tags too [#1400]
jimklimov Nov 6, 2025
50e824a
.github/workflows/01-make-dist.yml: there is no env.GITHUB_HEAD_REF […
jimklimov Nov 6, 2025
9217baa
.github/workflows/01-make-dist.yml: try to post a link to tarballs on…
jimklimov Nov 6, 2025
16f8ce4
.github/workflows/01-make-dist.yml: debug subst-github-ref-name [#1400]
jimklimov Nov 6, 2025
e040f48
.github/workflows/01-make-dist.yml: more trickery to make git-describ…
jimklimov Nov 6, 2025
000c49d
.github/workflows/01-make-dist.yml: different var for built SHA [#1400]
jimklimov Nov 6, 2025
9390b3a
.github/workflows/01-make-dist.yml: flip TEST_REF for branches and co…
jimklimov Nov 6, 2025
1637b71
.github/workflows/01-make-dist.yml: typo fix (renamed subst-github-re…
jimklimov Nov 6, 2025
c7f92c6
.github/workflows/01-make-dist.yml: "Try to get more Git metadata" ea…
jimklimov Nov 6, 2025
31ec3a3
.github/workflows/01-make-dist.yml: tell actions/checkout to fetch mo…
jimklimov Nov 6, 2025
420242e
.github/workflows/01-make-dist.yml: "Try to get more Git metadata" on…
jimklimov Nov 6, 2025
358d93d
.github/workflows/01-make-dist.yml: fix step IDs [#1400]
jimklimov Nov 6, 2025
a638faf
.github/workflows/01-make-dist.yml: try to fix permissions for PR com…
jimklimov Nov 6, 2025
e75ff50
.github/workflows/01-make-dist.yml: allow to fire on more branches [#…
jimklimov Nov 6, 2025
c242351
.github/workflows/01-make-dist.yml: after all use pull_request not pu…
jimklimov Nov 6, 2025
140b5c1
.github/workflows/01-make-dist.yml: do not immediately fail the CI jo…
jimklimov Nov 6, 2025
10ef85f
.github/workflows/01-make-dist.yml: try to use GITHUB_TOKEN when post…
jimklimov Nov 6, 2025
32a3798
.github/workflows/01-make-dist.yml: no fatal problem if we can not de…
jimklimov Nov 6, 2025
ddd2af6
.github/workflows/01-make-dist.yml: define permissions for auto-gener…
jimklimov Nov 6, 2025
8805e50
.github/workflows/01-make-dist.yml: try to use GITHUB_TOKEN when post…
jimklimov Nov 6, 2025
f20dac7
.github/workflows/01-make-dist.yml: try more ways to post a PR commen…
jimklimov Nov 7, 2025
374dd0c
.github/workflows/01-make-dist.yml: try "issues: write" into permissi…
jimklimov Nov 7, 2025
b6a8b96
.github/workflows/01-make-dist.yml: comment about substitute-string-a…
jimklimov Nov 7, 2025
5f190c6
scripts/obs/nut.spec: turn package availability/requirement for NUTPK…
jimklimov Nov 7, 2025
48b0cab
scripts/obs/nut.spec: define NUTPKG_WITH_<DEPNAME> when we requre the…
jimklimov Nov 7, 2025
e1ce3f3
scripts/obs/_config: CentOS 10 depends on "either of" util-linux(-cor…
jimklimov Nov 7, 2025
cb8c7f1
scripts/obs/_config: no ccache in RHEL_7 it seems [#1209]
jimklimov Nov 7, 2025
e80b6fa
scripts/obs/nut.spec: fix "distro_version" numbers (some have extra d…
jimklimov Nov 7, 2025
b828fcb
scripts/obs/nut.spec: libltdl-devel (nut-scanner and consumers) and l…
jimklimov Nov 7, 2025
51f8b97
scripts/obs/nut.spec: more constraints about what is available in wha…
jimklimov Nov 7, 2025
21e5d7a
scripts/obs/debian.control: dumb down the libmodbus requirement [#1209]
jimklimov Nov 7, 2025
313e13e
scripts/obs/debian.control: dumb down the libi2c requirement [#1209]
jimklimov Nov 7, 2025
2b1a596
scripts/obs/nut.spec: try to constrain udev to non-RHEL [#1209]
jimklimov Nov 7, 2025
1ce8f8e
Revert "scripts/obs/nut.spec: try to constrain udev to non-RHEL [#1209]"
jimklimov Nov 7, 2025
67e3fd6
Revert "scripts/obs/debian.control: dumb down the libi2c requirement …
jimklimov Nov 7, 2025
e489864
Revert "scripts/obs/debian.control: dumb down the libmodbus requireme…
jimklimov Nov 7, 2025
621e0e7
.github/workflows/01-make-dist.yml: add permissions for delete artifa…
jimklimov Nov 7, 2025
6c5a25a
.github/workflows/01-make-dist.yml: try using a custom MAKE_DIST_TOKE…
jimklimov Nov 7, 2025
267230d
Revert ".github/workflows/01-make-dist.yml: add permissions for delet…
jimklimov Nov 7, 2025
3707ddf
.github/workflows/01-make-dist.yml: try pull_request_target again, to…
jimklimov Nov 7, 2025
8c5f6c7
.github/workflows/01-make-dist.yml: refer to links from GH checks ent…
jimklimov Nov 7, 2025
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
286 changes: 286 additions & 0 deletions .github/workflows/01-make-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
# Adapted from NUT codeql.yml with inspiration taken from
# https://javahelps.com/manage-github-artifact-storage-quota
# regarding uploads of artifacts and clearing the way for them.
# See also:
# https://github.com/actions/upload-artifact
# https://docs.github.com/en/actions/reference/workflows-and-actions/variables
name: "GHA-01: Make dist and docs tarballs, see workflow page for links"

on:
push:
branches: [ "master", "FTY", "fightwarn", "FTY-obs" ]
tags:
- v*
pull_request_target:
# The branches below must be a subset of the branches above
branches: [ "master", "FTY", "fightwarn", "FTY-obs" ]
schedule:
- cron: '15 12 * * 0'
workflow_dispatch:
# Allow manually running the action, e.g. if disabled after some quietness in the source

permissions:
contents: read
issues: write
pull-requests: write

jobs:
make-dist-tarballs:
name: Make Dist and Docs Tarballs
# FIXME: Prepare/maintain a container image with pre-installed
# NUT build/tooling prereqs (save about 3 minutes per run!)
runs-on: ubuntu-latest
permissions:
#actions: read
actions: write
#contents: read
contents: write
repository-projects: write
security-events: write
pull-requests: write
issues: write

strategy:
fail-fast: false

steps:
# Post early so this would be about the top comment in the PR trail
# (easy to see, contents replaced later)
- name: "GHA-01: Make dist and docs tarballs - report download URL - t1"
uses: thollander/actions-comment-pull-request@v3
# if: startsWith(github.ref, 'refs/pull/')
continue-on-error: true
with:
comment-tag: latest-tarball
message: Dist and Docs will be linked here after the "make dist" job completes.
#github-token: ${{ secrets.MAKE_DIST_TOKEN }}

- name: "GHA-01: Make dist and docs tarballs - report download URL - s1"
uses: marocchino/sticky-pull-request-comment@v2
# if: startsWith(github.ref, 'refs/pull/')
continue-on-error: true
with:
header: latest-tarball-sticky
only_create: true
message: Dist and Docs will be linked here after the "make dist" job completes.
#github-token: ${{ secrets.MAKE_DIST_TOKEN }}
#GITHUB_TOKEN: ${{ secrets.MAKE_DIST_TOKEN }}

- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
fetch-tags: true

# https://github.com/marketplace/actions/substitute-string
# Note it warns about "unexpected input(s)" with replacement tokens below,
# as they are by design not predefined, as far as actions API is concened.
# They still work for substitutions though.
- uses: bluwy/substitute-string-action@v3
id: subst-github-ref-name
with:
_input-text: "${{ github.ref_name }}"
" ": _
"/": _
- run: echo "${{ steps.subst-github-ref-name.outputs.result }}"

# Make build identification more useful (so we use no fallbacks in script)
- name: Try to get more Git metadata
run: |
git describe || {
git remote -v || true
git branch -a || true
for R in `git remote` ; do git fetch $R master ; done || true
git fetch --tags
pwd ; ls -la
echo "=== Known commits in history:"
git log --oneline | wc -l
echo "=== Recent commits in history:"
git log -2 || true
echo "=== Known tags:"
git tag || true
echo "=== Try to ensure 'git describe' works:"
git describe || {
git fetch --all && for R in `git remote` ; do for T in `git tag` ; do git fetch $R $T ; done ; done
git describe || {
TEST_REF="`git symbolic-ref --short HEAD 2>/dev/null || cat .git/HEAD`" && [ -n "${TEST_REF}" ] && git checkout master && git pull --all && git checkout "${TEST_REF}"
git describe || true
}
}
}

# Using hints from https://askubuntu.com/questions/272248/processing-triggers-for-man-db
# and our own docs/config-prereqs.txt
# NOTE: Currently installing the MAX prerequisite footprint,
# which for building just the docs may be a bit of an overkill.
- name: NUT CI Prerequisite packages (Ubuntu, GCC)
run: |
echo "set man-db/auto-update false" | sudo debconf-communicate
sudo dpkg-reconfigure man-db
sudo apt update
sudo apt install \
gcc g++ clang \
ccache time \
git perl curl \
make autoconf automake libltdl-dev libtool binutils \
valgrind \
cppcheck \
pkg-config \
libtool-bin \
python3 gettext python3-pyqt6 pyqt6-dev-tools \
aspell aspell-en \
asciidoc source-highlight python3-pygments dblatex \
libgd-dev \
systemd-dev \
libsystemd-dev \
libcppunit-dev \
libssl-dev libnss3-dev \
augeas-tools libaugeas-dev augeas-lenses \
libusb-dev libusb-1.0-0-dev \
libi2c-dev \
libmodbus-dev \
libsnmp-dev \
libpowerman0-dev \
libfreeipmi-dev libipmimonitoring-dev \
libavahi-common-dev libavahi-core-dev libavahi-client-dev \
libgpiod-dev \
bash dash ksh busybox \
libneon27-gnutls-dev \
build-essential git-core libi2c-dev i2c-tools lm-sensors \
|| exit
date > .timestamp-init

- name: Prepare ccache
# Based on https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#example-using-the-cache-action example
id: cache-ccache
uses: actions/cache@v4
env:
compiler: 'CC=gcc CXX=g++'
cache-name: cache-ccache-${{ env.compiler }}
with:
path: |
~/.ccache
~/.cache/ccache
~/.config/ccache/ccache.conf
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/.timestamp-init') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-

- name: CCache stats before build
run: |
ccache -sv || ccache -s || echo "FAILED to read ccache info, oh well"
rm -f .timestamp-init

- name: Debug gitlog2version processing
run: bash -x ./tools/gitlog2version.sh || true

- name: NUT CI Build Configuration
env:
compiler: 'CC=gcc CXX=g++'
run: |
PATH="/usr/lib/ccache:$PATH" ; export PATH
CCACHE_COMPRESS=true; export CCACHE_COMPRESS
ccache --version || true
( ${{env.compiler}} ; echo "=== CC: $CC => `command -v $CC` =>" ; $CC --version ; echo "=== CXX: $CXX => `command -v $CXX` =>" ; $CXX --version ) || true
./autogen.sh && \
./configure --enable-warnings --enable-Werror --enable-Wcolor --with-all --with-dev --with-docs --enable-docs-changelog ${{env.compiler}}

# NOTE: In this scenario we do not build actually NUT in the main
# checkout directory, at least not explicitly (recipe may generate
# some files like man pages to fulfill the "dist" requirements;
# for now this may generate some libs to figure out their IDs).
# We do `make docs` to provide them as a separate tarball just
# in case, later.
# DO NOT `make dist-files` here as it includes `dist-sig` and
# needs a GPG keychain with maintainers' secrets deployed locally.
- name: NUT CI Build to create "dist" tarball and related files
env:
compiler: 'CC=gcc CXX=g++'
run: |
PATH="/usr/lib/ccache:$PATH" ; export PATH
CCACHE_COMPRESS=true; export CCACHE_COMPRESS
ccache --version || true
( ${{env.compiler}} ; echo "=== CC: $CC => `command -v $CC` =>" ; $CC --version ; echo "=== CXX: $CXX => `command -v $CXX` =>" ; $CXX --version ) || true
make -s -j 8 dist dist-hash

- name: NUT CI Build to verify "dist" tarball build
env:
compiler: 'CC=gcc CXX=g++'
run: |
PATH="/usr/lib/ccache:$PATH" ; export PATH
CCACHE_COMPRESS=true; export CCACHE_COMPRESS
ccache --version || true
( ${{env.compiler}} ; echo "=== CC: $CC => `command -v $CC` =>" ; $CC --version ; echo "=== CXX: $CXX => `command -v $CXX` =>" ; $CXX --version ) || true
make -s -j 8 distcheck

- name: CCache stats after distcheck
run: ccache -sv || ccache -s || echo "FAILED to read ccache info, oh well"

- name: NUT CI Build to package complex docs (not part of dist tarball)
run: |
make -s -j 8 dist-docs

# Inspired by https://javahelps.com/manage-github-artifact-storage-quota
# Note that the code below wipes everything matched by the filter!
# We may want another script block (after this cleanup of obsolete data)
# to iterate clearing the way build by build until there's X MB available
# (at least 12MB as of Nov 2025).
- if: env.GITHUB_REF_TYPE != 'tag' && steps.subst-github-ref-name.outputs.result != 'master'
name: Delete Old Artifacts for this feature branch/PR
uses: actions/github-script@v6
id: delete_old_artifact_for_pr
continue-on-error: true
with:
script: |
const res = await github.rest.actions.listArtifactsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
})

res.data.artifacts
.filter(({ name }) => name === 'NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}')
.forEach(({ id }) => {
github.rest.actions.deleteArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: id,
})
})
#github-token: ${{ secrets.MAKE_DIST_TOKEN }}

- name: Upload tarball and its checksum artifacts
uses: actions/upload-artifact@v4
id: upload_artifact
with:
name: NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}
path: |
nut-*.tar*
compression-level: 0
overwrite: true

# https://github.com/thollander/actions-comment-pull-request
# FIXME: Something that adds/updates Github Checks would be better
# as it would be seen in the list attached to a status icon of any
# build (e.g. history of master branch)
- name: "GHA-01: Make dist and docs tarballs - report download URL - t2"
uses: thollander/actions-comment-pull-request@v3
# if: startsWith(github.ref, 'refs/pull/')
continue-on-error: true
with:
comment-tag: latest-tarball
message: Dist and Docs [NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }}
#github-token: ${{ secrets.MAKE_DIST_TOKEN }}

# https://github.com/marocchino/sticky-pull-request-comment
- name: "GHA-01: Make dist and docs tarballs - report download URL - s2"
uses: marocchino/sticky-pull-request-comment@v2
# if: startsWith(github.ref, 'refs/pull/')
continue-on-error: true
with:
header: latest-tarball-sticky
only_create: true
message: Dist and Docs [NUT-tarballs-${{ steps.subst-github-ref-name.outputs.result }}.zip}](${{ steps.upload_artifact.outputs.artifact-url }}) are available for commit ${{ github.sha }}
#github-token: ${{ secrets.MAKE_DIST_TOKEN }}
#GITHUB_TOKEN: ${{ secrets.MAKE_DIST_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: "GHA-05: CodeQL"

on:
push:
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
id: cache-ccache
uses: actions/cache@v4
env:
cache-name: cache-ccache-${{ matrix.compiler }}-${{ matrix.NUT_SSL_VARIANTS }}-${{ matrix.NUT_SSL_VARIANTS }}
cache-name: cache-ccache-${{ matrix.compiler }}-${{ matrix.NUT_SSL_VARIANTS }}-${{ matrix.NUT_USB_VARIANTS }}
with:
path: |
~/.ccache
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish PyNUT client bindings for NUT 🐍 distributions 📦 to PyPI
name: "GHA-08: Publish PyNUT client bindings for NUT 🐍 distributions 📦 to PyPI"
# based on https://medium.com/@VersuS_/automate-pypi-releases-with-github-actions-4c5a9cfe947d
# and https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

Expand Down
51 changes: 51 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -823,10 +823,13 @@ EXTRA_DIST += VERSION_DEFAULT

# Best-effort delivery for (overly?) customized distros, e.g. via
# echo NUT_VERSION_FORCED_SEMVER=1.1.1 > VERSION_FORCED_SEMVER
# ONLY populated into dist tarball if present in the build area!
# (Note we do tarball the VERSION_DEFAULT generated just above)
dist-hook:
for D in "$(abs_top_srcdir)" "$(abs_top_builddir)" ; do \
for F in VERSION_FORCED VERSION_FORCED_SEMVER ; do \
if [ -s "$$D/$$F" ] ; then \
echo " DIST $$D/$$F => $(top_distdir)/$$F"; \
cat "$$D/$$F" > "$(top_distdir)/$$F" || true ; \
fi ; \
done ; \
Expand Down Expand Up @@ -1019,6 +1022,9 @@ nut-@PACKAGE_VERSION@.tar.gz: dist
nut-@PACKAGE_VERSION@.tar.gz.sig: dist-sig
nut-@PACKAGE_VERSION@.tar.gz.md5 nut-@PACKAGE_VERSION@.tar.gz.sha256: dist-hash

# Bonus feature, results depend on configure script options and available tools
nut-@PACKAGE_VERSION@-docs.tar.gz: dist-docs

dist-sig: nut-@PACKAGE_VERSION@.tar.gz
rm -f nut-@PACKAGE_VERSION@.tar.gz.sig
gpg --detach-sign nut-@PACKAGE_VERSION@.tar.gz
Expand All @@ -1027,6 +1033,51 @@ dist-hash: nut-@PACKAGE_VERSION@.tar.gz
md5sum nut-@PACKAGE_VERSION@.tar.gz > nut-@PACKAGE_VERSION@.tar.gz.md5
sha256sum nut-@PACKAGE_VERSION@.tar.gz > nut-@PACKAGE_VERSION@.tar.gz.sha256

# Helper to have all built docs (config-dependent) neatly aligned
# NOT part of standard tarball, though
EXTRA_DIST_DOCS = VERSION_* *.adoc-parsed

if WITH_CHANGELOG_TEXT
EXTRA_DIST_DOCS += ChangeLog
endif WITH_CHANGELOG_TEXT

if WITH_CHANGELOG_ADOC
EXTRA_DIST_DOCS += ChangeLog.adoc
endif WITH_CHANGELOG_ADOC

if KEEP_NUT_REPORT
EXTRA_DIST_DOCS += config.nut_report_feature.log
endif KEEP_NUT_REPORT

if WITH_HTML_SINGLE
EXTRA_DIST_DOCS += docs/man/*.html docs/*.html
endif WITH_HTML_SINGLE

if WITH_HTML_CHUNKED
EXTRA_DIST_DOCS += docs/*.chunked
endif WITH_HTML_CHUNKED

if WITH_PDFS
EXTRA_DIST_DOCS += docs/*.pdf
endif WITH_PDFS

if WITH_MANS
if !KNOWN_UNABLE_MANS
EXTRA_DIST_DOCS += \
docs/man/*.@MAN_SECTION_API_BASE@ \
docs/man/*.@MAN_SECTION_CFG_BASE@ \
docs/man/*.@MAN_SECTION_CMD_SYS_BASE@ \
docs/man/*.@MAN_SECTION_CMD_USR_BASE@ \
docs/man/*.@MAN_SECTION_MISC_BASE@
endif !KNOWN_UNABLE_MANS
endif WITH_MANS

# Modeled after automake generated mesh of rules for "distdir" handling with "am__tar"
dist-docs: all-docs
$${TAR-tar} cf - $(EXTRA_DIST_DOCS) | eval GZIP= gzip $(GZIP_ENV) -c > $(distdir)-docs.tar.gz
ls -la $(distdir)-docs.tar.gz
$${TAR-tar} tzvf $(distdir)-docs.tar.gz || true

# ----------------------------------------------------------------------
# targets from old build system (pre-automake).
# supported for a period of time for backward "compatibility".
Expand Down
Loading
Loading