From d18125ff39a42ebd8a1cd2d70d27ec8282672965 Mon Sep 17 00:00:00 2001 From: George Usynin <103181646+heorhi-deriv@users.noreply.github.com> Date: Tue, 3 Dec 2024 11:45:41 +0300 Subject: [PATCH] [FEQ] george / FEQ-2702 / Improve Coverall workflow time execution. Part 2. Adding caching npm packages (#17708) * chore: add caching * fix: :ambulance: cache not reading form base repo * fix: :ambulance: add update cache workflow, fix coverall restore cache * Rename update_cache.yml to update_npm_cache.yml --- .github/workflows/coveralls.yml | 23 +++++++++++++++------- .github/workflows/update_npm_cache.yml | 27 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/update_npm_cache.yml diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index fc42c15c6c35..eae895f262fb 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -1,10 +1,9 @@ +name: Reporter + on: - push: - branches: - - master pull_request: - types: [opened, synchronize, edited] -name: Reporter + types: [opened, synchronize, edited] + jobs: test: name: Run tests in parallel @@ -18,7 +17,17 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Setup Node uses: './.github/actions/setup_node' - - name: Install dependencies + - name: Restore npm cache + uses: actions/cache/restore@v4 + id: cache-npm + with: + path: | + node_modules + packages/*/node_modules + key: node_modules-cache-${{ hashFiles('package-lock.json', 'packages/*/package.json') }} + restore-keys: node_modules-cache- + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: Install dependencies uses: "./.github/actions/npm_install_from_cache" - name: Build components package working-directory: packages/components @@ -28,7 +37,7 @@ jobs: - name: Coveralls Parallel uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949 with: - flag-name: ${{ matrix.shard}} + flag-name: ${{ matrix.shard }} parallel: true finish: diff --git a/.github/workflows/update_npm_cache.yml b/.github/workflows/update_npm_cache.yml new file mode 100644 index 000000000000..2b7a88693f01 --- /dev/null +++ b/.github/workflows/update_npm_cache.yml @@ -0,0 +1,27 @@ +name: Update node modules cache + +on: + push: + branches: + - master + +jobs: + build_cache: + name: Build cache + runs-on: Runner_16cores_Deriv-app + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + - name: Setup Node + uses: './.github/actions/setup_node' + - name: Cache node modules + id: cache-npm + uses: actions/cache@v4 + with: + path: | + node_modules + packages/*/node_modules + key: node_modules-cache-${{ hashFiles('package-lock.json', 'packages/*/package.json') }} + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: Install dependencies + uses: "./.github/actions/npm_install_from_cache"