Skip to content

Commit

Permalink
Add caches for different package targets
Browse files Browse the repository at this point in the history
Signed-off-by: Simeon Widdis <[email protected]>
  • Loading branch information
Swiddis committed Oct 1, 2024
1 parent c0e4415 commit b488f79
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/ftr-e2e-dashboards-observability-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ jobs:
restore-keys: |
${{ runner.OS }}-node-
- name: Restore target caches
id: cache-target-folders-restore
shell: bash
run: |
echo "Restoring target folder caches..."
target_folders=("./OpenSearch-Dashboards/packages/*/target" "./OpenSearch-Dashboards/src/plugins/*/target" "./OpenSearch-Dashboards/src/core/target" "./plugins/dashboards-observability/target")
for target_folder in "${target_folders[@]}"; do
target_name = $(echo "$target_folder" | sed 's/\/target//g')
cache_key="${{ runner.OS }}-$target_name-${{ hashFiles("$target_folder/**/*", "!$target_folder/target/**") }}
restored_cache=$(actions/cache/restore@v4 -p "$target_folder/target" -k "$cache_key" -r "${{ runner.OS }}-$target_name-")
done
- name: Bootstrap OpenSearch Dashboards
run: |
cd OpenSearch-Dashboards
Expand All @@ -130,7 +142,19 @@ jobs:
- name: Compile OpenSearch Dashboards
run: |
cd OpenSearch-Dashboards
node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers=10
node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers=10 --verbose
- name: Save target caches
id: cache-target-folders-save
shell: bash
run: |
echo "Saving target folder caches..."
target_folders=("./OpenSearch-Dashboards/packages/*/target" "./OpenSearch-Dashboards/src/plugins/*/target" "./OpenSearch-Dashboards/src/core/target" "./plugins/dashboards-observability/target")
for target_folder in "${target_folders[@]}"; do
target_name = $(echo "$target_folder" | sed 's/\/target//g')
cache_key="${{ runner.OS }}-$target_name-${{ hashFiles("$target_folder/**/*", "!$target_folder/target/**") }}
actions/cache/save@v4 -p "$target_folder/target" -k "$cache_key" -r "${{ runner.OS }}-$target_name-"
done
- name: Run OpenSearch Dashboards server
run: |
Expand Down
26 changes: 25 additions & 1 deletion .github/workflows/integration-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,18 @@ jobs:
restore-keys: |
${{ runner.OS }}-node-
- name: Restore core-targets caches
id: cache-target-folders
shell: bash
run: |
echo "Restoring target folder caches..."
target_folders=("./OpenSearch-Dashboards/packages/*/target" "./OpenSearch-Dashboards/src/plugins/*/target" "./OpenSearch-Dashboards/src/core/target" "./plugins/dashboards-observability/target")
for target_folder in "${target_folders[@]}"; do
target_name = $(echo "$target_folder" | sed 's/\/target//g')
cache_key="${{ runner.OS }}-$target_name-${{ hashFiles("$target_folder/**/*", "!$target_folder/target/**") }}
restored_cache=$(actions/cache/restore@v4 -p "$target_folder/target" -k "$cache_key" -r "${{ runner.OS }}-$target_name-")
done
- name: Bootstrap OpenSearch Dashboards
run: |
cd OpenSearch-Dashboards
Expand All @@ -152,7 +164,19 @@ jobs:
- name: Compile OpenSearch Dashboards
run: |
cd OpenSearch-Dashboards
node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers=10
node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers=10 --verbose
- name: Stash core-targets caches
id: cache-target-folders
shell: bash
run: |
echo "Saving target folder caches..."
target_folders=("./OpenSearch-Dashboards/packages/*/target" "./OpenSearch-Dashboards/src/plugins/*/target" "./OpenSearch-Dashboards/src/core/target" "./plugins/dashboards-observability/target")
for target_folder in "${target_folders[@]}"; do
target_name = $(echo "$target_folder" | sed 's/\/target//g')
cache_key="${{ runner.OS }}-$target_name-${{ hashFiles("$target_folder/**/*", "!$target_folder/target/**") }}
actions/cache/save@v4 -p "$target_folder/target" -k "$cache_key" -r "${{ runner.OS }}-$target_name-"
done
- name: Run OpenSearch Dashboards server
run: |
Expand Down

0 comments on commit b488f79

Please sign in to comment.