Skip to content

Commit

Permalink
apacheGH-36154: [JS][CI] Use jest cache in CI (apache#36373)
Browse files Browse the repository at this point in the history
### 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: apache#36154

Authored-by: abetomo <abe@enzou.tokyo>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
abetomo authored Jul 11, 2023
1 parent dda3808 commit b07e3f1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions js/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,8 @@ test/bundle/**/*-bundle.js*
# jest snapshots (too big)
test/__snapshots__/

# jest cache
.jest-cache/

# VSCode
!.vscode
1 change: 1 addition & 0 deletions js/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default {
roots: [
"<rootDir>/test/",
],
cacheDirectory: ".jest-cache",
extensionsToTreatAsEsm: [".ts"],
moduleFileExtensions: ["js", "mjs", "ts"],
coverageReporters: ["lcov", "json",],
Expand Down

0 comments on commit b07e3f1

Please sign in to comment.