Skip to content

Commit 474b7a2

Browse files
committed
Avoid redundantly preparing the environmont
1 parent d2efd03 commit 474b7a2

2 files changed

Lines changed: 11 additions & 76 deletions

File tree

.github/actions/setup-strawberry-perl/action.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
11
name: Setup Strawberry Perl
22
description: Restore or build the Windows packaging environment (pre-installed Strawberry Perl + CPAN modules + libcurl) used to pack centreon_plugins.exe
33

4-
inputs:
5-
lookup-only:
6-
description: Only check if cache exists without restoring (set to true for pre-build caching jobs)
7-
default: 'false'
8-
9-
outputs:
10-
cache-hit:
11-
description: Whether the Strawberry Perl cache was found
12-
value: ${{ steps.cache-perl.outputs.cache-hit }}
13-
cache-key:
14-
description: Cache key used for the environment (content-hashed; reuse it to save the cache)
15-
value: ${{ steps.cache-perl.outputs.cache-primary-key }}
16-
174
runs:
185
using: composite
196
steps:
20-
- name: Check/restore Perl environment cache
7+
- name: Restore Perl environment cache
218
id: cache-perl
229
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
2310
with:
@@ -26,7 +13,6 @@ runs:
2613
# definition changes (this action or the libcurl closure script), so it
2714
# is not tied to manual version bumps.
2815
key: centreon-plugins-windows-env-${{ hashFiles('.github/actions/setup-strawberry-perl/action.yml', '.github/scripts/windows/copy-curl-closure.sh') }}
29-
lookup-only: ${{ inputs.lookup-only }}
3016

3117
# Strawberry Perl is pre-installed on GitHub windows runners under C:\Strawberry;
3218
# we build on top of it rather than installing our own copy.
@@ -119,6 +105,16 @@ runs:
119105
perl C:\Strawberry\perl\bin\cpanm --notest Net::Curl
120106
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
121107
108+
# Save the environment we just built, so the next run restores it instead of
109+
# reinstalling everything. Whoever builds the environment caches it -- no
110+
# separate pre-build workflow is needed.
111+
- name: Save Perl environment cache
112+
if: steps.cache-perl.outputs.cache-hit != 'true'
113+
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
114+
with:
115+
path: C:\Strawberry
116+
key: ${{ steps.cache-perl.outputs.cache-primary-key }}
117+
122118
- name: Show cpanm build logs on failure
123119
if: ${{ failure() }}
124120
shell: powershell

.github/workflows/docker-builder-packaging-plugins-windows.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)