diff --git a/.github/workflows/build_and_test_workflow.yml b/.github/workflows/build_and_test_workflow.yml index c8b7239a4041..1557eef64b58 100644 --- a/.github/workflows/build_and_test_workflow.yml +++ b/.github/workflows/build_and_test_workflow.yml @@ -47,6 +47,18 @@ jobs: run: | npm uninstall -g yarn npm i -g yarn@1.22.10 + yarn config set network-timeout 1000000 -g + + - name: Configure Yarn Cache + run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV + + - name: Initialize Yarn Cache + uses: actions/cache@v3 + with: + path: ${{ env.YARN_CACHE_LOCATION }} + key: yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + yarn- - name: Run bootstrap run: yarn osd bootstrap @@ -101,14 +113,23 @@ jobs: run: | npm uninstall -g yarn npm i -g yarn@1.22.10 + yarn config set network-timeout 1000000 -g - # https://github.com/yarnpkg/yarn/issues/8242#issuecomment-776561223 - # Increase network timeout for Windows, retry once if bootstrap fails - - name: Run bootstrap + - name: Configure Yarn Cache run: | - yarn cache clean - yarn config set network-timeout 1000000 -g - yarn osd bootstrap || yarn osd bootstrap + echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $env:GITHUB_ENV + echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" + + - name: Initialize Yarn Cache + uses: actions/cache@v3 + with: + path: ${{ env.YARN_CACHE_LOCATION }} + key: yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + yarn- + + - name: Run bootstrap + run: yarn osd bootstrap || yarn osd bootstrap - name: Run linter id: linter @@ -158,6 +179,18 @@ jobs: run: | npm uninstall -g yarn npm i -g yarn@1.22.10 + yarn config set network-timeout 1000000 -g + + - name: Configure Yarn Cache + run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV + + - name: Initialize Yarn Cache + uses: actions/cache@v3 + with: + path: ${{ env.YARN_CACHE_LOCATION }} + key: yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + yarn- - name: Setup chromedriver run: node scripts/upgrade_chromedriver.js @@ -217,17 +250,26 @@ jobs: run: | npm uninstall -g yarn npm i -g yarn@1.22.10 + yarn config set network-timeout 1000000 -g + + - name: Configure Yarn Cache + run: | + echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $env:GITHUB_ENV + echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" + + - name: Initialize Yarn Cache + uses: actions/cache@v3 + with: + path: ${{ env.YARN_CACHE_LOCATION }} + key: yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + yarn- - name: Setup chromedriver run: node scripts/upgrade_chromedriver.js - # https://github.com/yarnpkg/yarn/issues/8242#issuecomment-776561223 - # Increase network timeout for Windows, retry once if bootstrap fails - name: Run bootstrap - run: | - yarn cache clean - yarn config set network-timeout 1000000 -g - yarn osd bootstrap || yarn osd bootstrap + run: yarn osd bootstrap || yarn osd bootstrap - name: Build plugins run: node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 10 @@ -285,6 +327,18 @@ jobs: run: | npm uninstall -g yarn npm i -g yarn@1.22.10 + yarn config set network-timeout 1000000 -g + + - name: Configure Yarn Cache + run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV + + - name: Initialize Yarn Cache + uses: actions/cache@v3 + with: + path: ${{ env.YARN_CACHE_LOCATION }} + key: yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + yarn- - name: Get package version run: | @@ -341,6 +395,20 @@ jobs: run: | npm uninstall -g yarn npm i -g yarn@1.22.10 + yarn config set network-timeout 1000000 -g + + - name: Configure Yarn Cache + run: | + echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $env:GITHUB_ENV + echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%" + + - name: Initialize Yarn Cache + uses: actions/cache@v3 + with: + path: ${{ env.YARN_CACHE_LOCATION }} + key: yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + yarn- - name: Get package version run: | @@ -395,6 +463,18 @@ jobs: run: | npm uninstall -g yarn npm i -g yarn@1.22.10 + yarn config set network-timeout 1000000 -g + + - name: Configure Yarn Cache + run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV + + - name: Initialize Yarn Cache + uses: actions/cache@v3 + with: + path: ${{ env.YARN_CACHE_LOCATION }} + key: yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + yarn- - name: Get package version run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index 76074e073827..d51b059b9506 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Add CHANGELOG.md and related workflows ([#2414](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2414)) - Update backport custom branch name to utilize head template ([#2766](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2766)) - Add automatic selection of the appropriate version of chrome driver to run functional tests ([#2990](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2990)) +- Improve yarn's performance in workflows by caching yarn's cache folder ([#3194](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3194)) ### 📝 Documentation