Skip to content

Commit 2edff0f

Browse files
authored
Merge 3e6e05a into 9b4d841
2 parents 9b4d841 + 3e6e05a commit 2edff0f

15 files changed

Lines changed: 909 additions & 67 deletions

.circleci/config.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ jobs:
5353
#type: string
5454
#default: "/opt/homebrew" # since July 2024 CircleCI only serves Apple Silicon instances
5555
#default: "/usr/local" # was when CircleCI builders had x86
56+
DO_CLEAN_NUTCI_CACHE:
57+
type: string
58+
default: "no"
59+
DO_USE_NUTCI_CACHE:
60+
type: string
61+
default: "yes"
5662

5763
environment:
5864
CC: << parameters.CC >>
@@ -64,6 +70,8 @@ jobs:
6470
CI_BUILDDIR: << parameters.CI_BUILDDIR >>
6571
BREW_MORE: << parameters.BREW_MORE >>
6672
#HOMEBREW_PREFIX: << parameters.HOMEBREW_PREFIX >>
73+
DO_CLEAN_NUTCI_CACHE: << parameters.DO_CLEAN_NUTCI_CACHE >>
74+
DO_USE_NUTCI_CACHE: << parameters.DO_USE_NUTCI_CACHE >>
6775

6876
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
6977
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
@@ -130,6 +138,7 @@ jobs:
130138
keys:
131139
- ccache-{{ .Branch }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
132140
- ccache-master-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
141+
- config-cache-{{ .Branch }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
133142

134143
# Help SEMVER look right (optionally)
135144
- run:
@@ -198,10 +207,17 @@ jobs:
198207
# be beneficial to instead share the cache between jobs; more so
199208
# while we are on free CircleCI tier and run them sequentially.
200209
- save_cache:
210+
name: Save .ccache for later runs
201211
paths:
202212
- ~/.ccache
203213
key: ccache-{{ .Branch }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
204214

215+
- save_cache:
216+
name: Save config.cache for later runs
217+
paths:
218+
- ~/.cache/nut-ci
219+
key: config-cache-{{ .Branch }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
220+
205221
- store_artifacts:
206222
path: config.log
207223

Makefile.am

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,12 @@ DISTCHECK_LIGHT_FLAGS = --with-all=auto --with-ssl=auto --with-doc=auto --enable
607607
DISTCHECK_LIGHT_MAN_FLAGS = --with-all=auto --with-ssl=auto --with-doc=man --enable-docs-man-for-progs-built-only=no --with-pynut=app --with-nut_monitor=force CXXFLAGS='@NUT_CONFIG_CXXFLAGS@' CFLAGS='@NUT_CONFIG_CFLAGS@' CPPFLAGS='@NUT_CONFIG_CPPFLAGS@' LDFLAGS='@NUT_CONFIG_LDFLAGS@'
608608
DISTCHECK_VALGRIND_FLAGS = --with-all=auto --with-ssl=auto --with-doc=skip --with-valgrind CXXFLAGS='@NUT_CONFIG_CXXFLAGS@ -g' CFLAGS='@NUT_CONFIG_CFLAGS@ -g' CPPFLAGS='@NUT_CONFIG_CPPFLAGS@' LDFLAGS='@NUT_CONFIG_LDFLAGS@' --with-pynut=app --with-nut_monitor=force
609609

610-
# Note: this rule uses envvar DISTCHECK_FLAGS expanded at run-time
610+
# Note: this rule uses envvar DISTCHECK_FLAGS expanded at run-time, which
611+
# may be passed down from caller and/or one of distcheck-* rules below.
612+
# The CI_CACHE_NUT_HASHDIR_CFG_OPT can also be passed down (by ci_build.sh
613+
# as generated for each specific build circumstance).
611614
DISTCHECK_CONFIGURE_FLAGS = ${DISTCHECK_FLAGS} \
615+
${CI_CACHE_NUT_HASHDIR_CFG_OPT} \
612616
PKG_CONFIG_PATH='@PKG_CONFIG_PATH@' \
613617
--with-systemdsystemunitdir='$${prefix}/lib/systemd/system' \
614618
--with-systemdsystempresetdir='$${prefix}/usr/lib/systemd/system-preset' \

NEWS.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ https://github.com/networkupstools/nut/milestone/13
7373
This change impacted also the classic C `libupsclient` library.
7474
[issue #3387, PR #3402]
7575

76+
- Introduced `ci_build.sh` settings and respective CI workflow settings
77+
to optionally re-use a `config.cache` file from older runs, and similar
78+
logic for NIT `nit.sh` to re-use generated certificate and private key
79+
files. Both can be enabled by `export DO_USE_NUTCI_CACHE=yes` and would
80+
store data under a `${CI_CACHE_NUT_BASEDIR}` directory (defaults to
81+
`~/.cache/nut-ci`); more fine-tuning environment variables are provided.
82+
[issues #3108, #3390, #1711, PR #3109]
83+
7684

7785
Release notes for NUT 2.8.5 - what's new since 2.8.4
7886
----------------------------------------------------

appveyor.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ environment:
2727
APPVEYOR_SAVE_CACHE_ON_ERROR: true
2828
APPVEYOR_CACHE_ENTRY_ZIP_ARGS: -t7z -m0=lzma -mx=6
2929
CCACHE_DIR: /home/appveyor/.ccache
30+
DO_CLEAN_NUTCI_CACHE: no
31+
DO_USE_NUTCI_CACHE: yes
3032

3133
# Customize GH notification message template
3234
# TODO: for repetitive commits in a PR consider a clean-up GHA like
@@ -200,7 +202,10 @@ artifacts:
200202
# Example optional cache (depends on file change):
201203
# - C:\msys64 -> appveyor.yml
202204
cache:
205+
- C:\projects\nut\config.cache
206+
- C:\projects\.cache\nut-ci
203207
- C:\msys64\home\appveyor\nut-win-deps
208+
- C:\msys64\home\appveyor\.cache\nut-ci
204209
- C:\msys64\home\appveyor\.ccache
205210
- C:\msys64\home\appveyor\ccache # likely missing, no problem - but the name is reported in ccache status
206211
- C:\Users\appveyor\AppData\Local\ccache # may be default in newer versions

ci_build.adoc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,24 @@ another shell at least for the system call-outs, with options like these:
9494
:; SHELL=/bin/bash CONFIG_SHELL=/bin/bash CI_SHELL_IS_FLAKY=true \
9595
./ci_build.sh
9696

97+
Caching!
98+
--------
99+
100+
The `ci_build.sh` can make use of a persistent cache directory, e.g. to speed
101+
up repetitive runs of the `configure` script on developer or CI machines when
102+
our `*.m4` and `*.ac` script sources and the machine remain the same.
103+
104+
It can be stored outside of the build area(s), under `${CI_CACHE_NUT_BASEDIR}`
105+
(default: `${HOME}/.cache/nut-ci`) if `DO_USE_NUTCI_CACHE=yes` as provided
106+
by caller (e.g. via `~/.profile` of a developer) or guessed from environment
107+
variables typical for CI runs.
108+
109+
If something acts up, or the build environment changes invisibly to the
110+
script, an `export DO_CLEAN_NUTCI_CACHE_BEFORE=yes` (or a more targeted
111+
`DO_CLEAN_AUTOCONF_CACHE_BEFORE`, since NIT uses similar logic and general
112+
toggle to retain generated test certificates) should fix that.
113+
114+
You can also always nuke the `${CI_CACHE_NUT_BASEDIR}` directory, or the
115+
`AUTOCONF_*` subdirectories and stale lock files under it.
116+
It would likely be needed from time to time anyway, as there is now
117+
no automated clean-up of no longer relevant caches.

0 commit comments

Comments
 (0)