This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new b07e3f1962 GH-36154: [JS][CI] Use `jest` cache in CI (#36373)
b07e3f1962 is described below

commit b07e3f196236e598f1d07b9f9312cbb5d01a7903
Author: Abe Tomoaki <[email protected]>
AuthorDate: Tue Jul 11 11:58:41 2023 +0900

    GH-36154: [JS][CI] Use `jest` cache in CI (#36373)
    
    
    
    ### Rationale for this change
    
    Use the cache of `test` to reduce test time.
    
    ### What changes are included in this PR?
    
    Use `jest` cache with `actions/cache@ v3`.
    
    ### Are these changes tested?
    
    In GitHub Actions, test time was reduced.
    
    ### Are there any user-facing changes?
    
    * Closes: #36154
    
    Authored-by: abetomo <[email protected]>
    Signed-off-by: Sutou Kouhei <[email protected]>
---
 .github/workflows/js.yml | 14 +++++++++++++-
 js/.gitignore            |  3 +++
 js/jest.config.js        |  1 +
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/js.yml b/.github/workflows/js.yml
index 60e880101f..7e8ef31b49 100644
--- a/.github/workflows/js.yml
+++ b/.github/workflows/js.yml
@@ -80,7 +80,7 @@ jobs:
     name: AMD64 macOS 11 NodeJS ${{ matrix.node }}
     runs-on: macos-latest
     if: github.event_name == 'push'
-    timeout-minutes: 60
+    timeout-minutes: 90
     strategy:
       fail-fast: false
       matrix:
@@ -90,6 +90,12 @@ jobs:
         uses: actions/checkout@v3
         with:
           fetch-depth: 0
+      - name: Jest Cache
+        uses: actions/cache@v3
+        with:
+          path: js/.jest-cache
+          key: js-jest-cache-${{ runner.os }}-${{ hashFiles('js/src/**/*.ts', 
'js/test/**/*.ts', 'js/yarn.lock') }}
+          restore-keys: js-jest-cache-${{ runner.os }}-
       - name: Install NodeJS
         uses: actions/setup-node@v3
         with:
@@ -114,6 +120,12 @@ jobs:
         uses: actions/checkout@v3
         with:
           fetch-depth: 0
+      - name: Jest Cache
+        uses: actions/cache@v3
+        with:
+          path: js/.jest-cache
+          key: js-jest-cache-${{ runner.os }}-${{ hashFiles('js/src/**/*.ts', 
'js/test/**/*.ts', 'js/yarn.lock') }}
+          restore-keys: js-jest-cache-${{ runner.os }}-
       - name: Install NodeJS
         uses: actions/setup-node@v3
         with:
diff --git a/js/.gitignore b/js/.gitignore
index 5b8e0dcc7e..5752f9249f 100644
--- a/js/.gitignore
+++ b/js/.gitignore
@@ -84,5 +84,8 @@ test/bundle/**/*-bundle.js*
 # jest snapshots (too big)
 test/__snapshots__/
 
+# jest cache
+.jest-cache/
+
 # VSCode
 !.vscode
diff --git a/js/jest.config.js b/js/jest.config.js
index 8aaf60a0ff..5a004ef8e9 100644
--- a/js/jest.config.js
+++ b/js/jest.config.js
@@ -22,6 +22,7 @@ export default {
     roots: [
         "<rootDir>/test/",
     ],
+    cacheDirectory: ".jest-cache",
     extensionsToTreatAsEsm: [".ts"],
     moduleFileExtensions: ["js", "mjs", "ts"],
     coverageReporters: ["lcov", "json",],

Reply via email to