Skip to content

Commit

Permalink
chore(ci): cache node build in workflows
Browse files Browse the repository at this point in the history
Building Node is failing often due to network error.
Caching a successful build will allow more reliable workflows.
  • Loading branch information
soonum committed Nov 4, 2024
1 parent e8a3da9 commit 8d53fa1
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 3 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/aws_tfhe_fast_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,36 @@ jobs:
run: |
make test_user_doc
- name: Get Node version
run: |
echo "NODE_VERSION=$(make node_version)" >> "${GITHUB_ENV}"
- name: Node cache restoration
id: node-cache
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a #v4.1.2
with:
path: |
~/.nvm
~/.npm
key: node-${{ env.NODE_VERSION }}

- name: Install Node
if: steps.node-cache.outputs.cache-hit != 'true'
run: |
make install_node
- name: Node cache save
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a #v4.1.2
if: steps.node-cache.outputs.cache-hit != 'true'
with:
path: |
~/.nvm
~/.npm
key: node-${{ env.NODE_VERSION }}

- name: Run js on wasm API tests
if: needs.should-run.outputs.wasm_test == 'true'
run: |
make install_node
make test_nodejs_wasm_api_ci
- name: Gen Keys if required
Expand Down
28 changes: 27 additions & 1 deletion .github/workflows/aws_tfhe_wasm_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,35 @@ jobs:
with:
toolchain: stable

- name: Install web resources
- name: Get Node version
run: |
echo "NODE_VERSION=$(make node_version)" >> "${GITHUB_ENV}"
- name: Node cache restoration
id: node-cache
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a #v4.1.2
with:
path: |
~/.nvm
~/.npm
key: node-${{ env.NODE_VERSION }}

- name: Install Node
if: steps.node-cache.outputs.cache-hit != 'true'
run: |
make install_node
- name: Node cache save
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a #v4.1.2
if: steps.node-cache.outputs.cache-hit != 'true'
with:
path: |
~/.nvm
~/.npm
key: node-${{ env.NODE_VERSION }}

- name: Install web resources
run: |
make install_chrome_browser
make install_chrome_web_driver
Expand Down
28 changes: 27 additions & 1 deletion .github/workflows/benchmark_wasm_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,35 @@ jobs:
with:
toolchain: nightly

- name: Install web resources
- name: Get Node version
run: |
echo "NODE_VERSION=$(make node_version)" >> "${GITHUB_ENV}"
- name: Node cache restoration
id: node-cache
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a #v4.1.2
with:
path: |
~/.nvm
~/.npm
key: node-${{ env.NODE_VERSION }}

- name: Install Node
if: steps.node-cache.outputs.cache-hit != 'true'
run: |
make install_node
- name: Node cache save
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a #v4.1.2
if: steps.node-cache.outputs.cache-hit != 'true'
with:
path: |
~/.nvm
~/.npm
key: node-${{ env.NODE_VERSION }}

- name: Install web resources
run: |
make install_${{ matrix.browser }}_browser
make install_${{ matrix.browser }}_web_driver
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ install_node:
$(SHELL) -i -c 'nvm install $(NODE_VERSION)' || \
( echo "Unable to install node, unknown error." && exit 1 )

.PHONY: node_version # Return Node version that will be installed
node_version:
@echo "$(NODE_VERSION)"

.PHONY: install_dieharder # Install dieharder for apt distributions or macOS
install_dieharder:
@dieharder -h > /dev/null 2>&1 || \
Expand Down

0 comments on commit 8d53fa1

Please sign in to comment.