ci: cache prepackaged plugins in mmctl tests

Cache the prepackaged_plugins directory between mmctl test runs using
actions/cache. The cache key is derived from a SHA-256 hash of the
PLUGIN_PACKAGES lines in server/Makefile, so the cache automatically
invalidates whenever any plugin version is bumped — no manual key
updates needed.

Uses actions/cache output (cache-hit) to skip the download step
entirely on cache hits.

Saves ~1-2 minutes per mmctl test run by avoiding repeated plugin
downloads.

Co-authored-by: Claude <claude@anthropic.com>
This commit is contained in:
Pavel Zeman 2026-03-20 01:39:58 +00:00
parent d5fdc1f534
commit acd1ec757a

View file

@ -54,7 +54,23 @@ jobs:
run: |
echo "${{ inputs.name }}" > server/test-name
echo "${{ github.event.pull_request.number }}" > server/pr-number
- name: Compute plugin cache key
id: plugin-cache-key
run: |
# Extract PLUGIN_PACKAGES lines from Makefile to derive a stable cache key.
# Cache auto-invalidates whenever any plugin version changes in the Makefile.
PLUGIN_HASH=$(grep '^PLUGIN_PACKAGES' server/Makefile | sha256sum | cut -d' ' -f1)
echo "hash=$PLUGIN_HASH" >> "$GITHUB_OUTPUT"
- name: Cache prepackaged plugins
id: plugin-cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: server/prepackaged_plugins
key: prepackaged-plugins-${{ steps.plugin-cache-key.outputs.hash }}
- name: Setup needed prepackaged plugins
if: steps.plugin-cache.outputs.cache-hit != 'true'
run: |
cd server
make prepackaged-plugins PLUGIN_PACKAGES=mattermost-plugin-jira-v3.2.5