Skip to content

Commit

Permalink
Fix caches
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 b488f79 commit 90a8b7b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 41 deletions.
22 changes: 6 additions & 16 deletions .github/workflows/ftr-e2e-dashboards-observability-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,30 +109,20 @@ jobs:
registry-url: "https://registry.npmjs.org"

- name: Install correct yarn version for OpenSearch Dashboards
id: setup-yarn
run: |
npm uninstall -g yarn
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache node modules
- name: Yarn Cache
uses: actions/cache@v4
with:
path: OpenSearch-Dashboards/**/node_modules
key: ${{ runner.OS }}-node-${{ hashFiles('OpenSearch-Dashboards/**/package-lock.json') }}
path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }}
key: ${{ runner.OS }}-yarn-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }}
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
${{ runner.OS }}-yarn-
- name: Bootstrap OpenSearch Dashboards
run: |
Expand Down
40 changes: 15 additions & 25 deletions .github/workflows/integration-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,30 +131,32 @@ jobs:
working-directory: OpenSearch-Dashboards

- name: Install correct yarn version for OpenSearch Dashboards
id: setup-yarn
run: |
npm uninstall -g yarn
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
echo "yarn-cache-dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache node modules
- name: Yarn Cache
uses: actions/cache@v4
with:
path: OpenSearch-Dashboards/**/node_modules
path: ${{ steps.setup-yarn.outputs.yarn-cache-dir }}
key: ${{ runner.OS }}-node-${{ hashFiles('OpenSearch-Dashboards/**/yarn.lock') }}
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: Cache build targets
uses: actions/cache@v4
with:
path: |
OpenSearch-Dashboards/packages/*/target
OpenSearch-Dashboards/src/plugins/*/target
OpenSearch-Dashboards/src/core/target
OpenSearch-Dashboards/plugins/dashboards-observability/target
key: ${{ runner.OS }}-targets-${{ hashFiles('OpenSearch-Dashboards/yarn.lock' 'OpenSearch-Dashboards/plugins/dashboards-observability/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-targets-
- name: Bootstrap OpenSearch Dashboards
run: |
Expand All @@ -166,18 +168,6 @@ jobs:
cd OpenSearch-Dashboards
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: |
cd OpenSearch-Dashboards
Expand Down

0 comments on commit 90a8b7b

Please sign in to comment.