|
1 | 1 | name: Setup Strawberry Perl |
2 | 2 | description: Restore or build the Windows packaging environment (pre-installed Strawberry Perl + CPAN modules + libcurl) used to pack centreon_plugins.exe |
3 | 3 |
|
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 | | - |
17 | 4 | runs: |
18 | 5 | using: composite |
19 | 6 | steps: |
20 | | - - name: Check/restore Perl environment cache |
| 7 | + - name: Restore Perl environment cache |
21 | 8 | id: cache-perl |
22 | 9 | uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 |
23 | 10 | with: |
|
26 | 13 | # definition changes (this action or the libcurl closure script), so it |
27 | 14 | # is not tied to manual version bumps. |
28 | 15 | 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 }} |
30 | 16 |
|
31 | 17 | # Strawberry Perl is pre-installed on GitHub windows runners under C:\Strawberry; |
32 | 18 | # we build on top of it rather than installing our own copy. |
@@ -119,6 +105,16 @@ runs: |
119 | 105 | perl C:\Strawberry\perl\bin\cpanm --notest Net::Curl |
120 | 106 | if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% |
121 | 107 |
|
| 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 | + |
122 | 118 | - name: Show cpanm build logs on failure |
123 | 119 | if: ${{ failure() }} |
124 | 120 | shell: powershell |
|
0 commit comments