Skip to content

Commit 909036a

Browse files
committed
.github/workflows/04-maven-nit.yml: fetch just the nit.sh script not the whole repo by default (and cache it for fallback) [#13]
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent e798cbe commit 909036a

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

.github/workflows/04-maven-nit.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,36 @@ jobs:
7272
# Setup NUT, run client (add in-tree script for that and call it)
7373
# NOTE: We use binaries from the package for speedier turnaround
7474
# TOTHINK: No SSL self-reporting before NUT v2.8.5 ...
75-
- name: Checkout NUT sources (for NIT script)
75+
#- name: Checkout NUT sources (for NIT script)
76+
# run: |
77+
# git clone --depth=1 https://github.com/networkupstools/nut
78+
79+
- name: Fetch NIT script from NUT sources
7680
run: |
77-
git clone --depth=1 https://github.com/networkupstools/nut
81+
curl -L https://raw.githubusercontent.com/networkupstools/nut/refs/heads/master/tests/NIT/nit.sh > ~/nit.sh \
82+
|| cp -pf ~/nit.sh.bak ~/nit.sh \
83+
|| { git clone --depth=1 https://github.com/networkupstools/nut && cp -pf nut/tests/NIT/nit.sh ~/nit.sh ; } \
84+
|| exit
85+
[ -s ~/nit.sh ] || exit
86+
chmod +x ~/nit.sh
87+
cp -pf ~/nit.sh ~/nit.sh.bak
88+
89+
- name: Prepare nit.sh.bak cache
90+
# Based on https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#example-using-the-cache-action example
91+
id: cache-nitcache
92+
uses: actions/cache@v4
93+
env:
94+
cache-name: cache-nitcache-
95+
with:
96+
path: |
97+
~/nit.sh.bak
98+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/.timestamp-init') }}
99+
restore-keys: |
100+
${{ runner.os }}-build-${{ env.cache-name }}-
101+
${{ runner.os }}-build-
102+
${{ runner.os }}-
78103
79104
- if: matrix.os == 'ubuntu-latest'
80105
name: Test jNut with NIT
81106
run: |
82-
PATH="`pwd`/nut/tests/NIT:${PATH}" ./test-NIT.sh
107+
PATH="${HOME}:${PATH}" ./test-NIT.sh

0 commit comments

Comments
 (0)