Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/actions/setup-node-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 'Setup Node and Install Dependencies'
description: 'Sets up Node.js, configures NPM cache, and installs dependencies with retry logic'

inputs:
node-version:
description: 'Version of Node.js to install'
required: false
default: '22'
platform:
description: 'Platform identifier for cache key (e.g., linux-x64, macos-arm, windows-x64)'
required: true
save-cache:
description: 'Whether to save the NPM cache at the end'
required: false
default: 'false'

outputs:
cache-dir:
description: 'Path to the NPM cache directory'
value: ${{ steps.npm-cache-dir.outputs.dir }}
cache-hit:
description: 'Whether the cache was restored successfully'
value: ${{ steps.restore-cache.outputs.cache-hit }}

runs:
using: 'composite'
steps:
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}

- name: Get NPM cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Restore NPM cache
id: restore-cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: npm-main-${{ inputs.platform }}-${{ hashFiles('./package-lock.json') }}
restore-keys: |
npm-main-${{ inputs.platform }}-

- name: Download dependencies
shell: bash
run: |
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose

- name: Save NPM cache
if: inputs.save-cache == 'true'
uses: actions/cache/save@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: npm-main-${{ inputs.platform }}-${{ hashFiles('./package-lock.json') }}
22 changes: 3 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ jobs:
name: corebridge-native-debug-${{ matrix.platform }}
path: ./packages/core-bridge/releases

- name: Install Node
uses: actions/setup-node@v4
- name: Setup Node and Install Dependencies
uses: ./.github/actions/setup-node-deps
with:
node-version: ${{ matrix.node-release-override || matrix.node }}
platform: ${{ matrix.platform }}

# On Windows, the 'runner.temp' variable uses backslashes as path separators, but
# that may pose problems in later steps when we try to join that with subpaths;
Expand All @@ -176,23 +177,6 @@ jobs:
run: echo "dir=$(pwd)" >> ${GITHUB_OUTPUT}
working-directory: ${{ runner.temp }}

- name: Get NPM cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Restore NPM cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: npm-main-${{ matrix.platform }}-${{ hashFiles('./package-lock.json') }}
restore-keys: |
npm-main-${{ matrix.platform }}-

- name: Download dependencies
# Make up to 3 attempts to install NPM dependencies, to work around transient NPM errors :(
run: |
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose

- name: Compile code
run: npm run build -- --ignore @temporalio/core-bridge

Expand Down
24 changes: 4 additions & 20 deletions .github/workflows/conventions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,11 @@ jobs:
with:
submodules: recursive

- name: Install Node
uses: actions/setup-node@v4
- name: Setup Node and Install Dependencies
uses: ./.github/actions/setup-node-deps
with:
node-version: 22

- name: Get NPM cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Restore NPM cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: npm-main-linux-x64-${{ hashFiles('./package-lock.json') }}
restore-keys: |
npm-main-linux-x64-
node-version: '22'
platform: 'linux-x64'

- name: Install protoc
uses: arduino/setup-protoc@v3
Expand All @@ -58,10 +46,6 @@ jobs:
env-vars: ''
save-if: false

- name: Download dependencies
run: |
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose

# eslint-import-resolver-typescript requires packages to be built
- name: Compile all non-rust code
run: npm run build -- --ignore @temporalio/core-bridge
Expand Down
26 changes: 4 additions & 22 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,11 @@ jobs:
with:
submodules: recursive

- name: Install Node
uses: actions/setup-node@v4
- name: Setup Node and Install Dependencies
uses: ./.github/actions/setup-node-deps
with:
node-version: 22

- name: Get NPM cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Restore NPM cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: npm-main-linux-x64-${{ hashFiles('./package-lock.json') }}
restore-keys: |
npm-main-linux-x64-

- name: Download dependencies
# Make up to 3 attempts to install NPM dependencies, to work around transient NPM errors
# Don't build during install phase since we're going to explicitly build anyway
run: |
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose
node-version: '22'
platform: 'linux-x64'

- run: npm run build -- --ignore @temporalio/core-bridge

Expand Down
28 changes: 6 additions & 22 deletions .github/workflows/nightly-throughput-stress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,12 @@ jobs:
go-version-file: omes/go.mod
cache-dependency-path: omes/go.sum

- name: Setup Node
uses: actions/setup-node@v4
- name: Setup Node and Install Dependencies
id: setup-node
uses: ./.github/actions/setup-node-deps
with:
node-version: 22

- name: Get NPM cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Restore NPM cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: npm-main-linux-x64-${{ hashFiles('./package-lock.json') }}
restore-keys: |
npm-main-linux-x64-
node-version: '22'
platform: 'linux-x64'

- name: Install protoc
uses: arduino/setup-protoc@v3
Expand All @@ -106,12 +96,6 @@ jobs:
with:
workspaces: packages/core-bridge -> target

- name: Install SDK dependencies
run: |
npm ci --ignore-scripts --verbose || \
npm ci --ignore-scripts --verbose || \
npm ci --ignore-scripts --verbose

- name: Build SDK
run: npm run build
env:
Expand All @@ -121,7 +105,7 @@ jobs:
uses: actions/cache/save@v4
if: always()
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
path: ${{ steps.setup-node.outputs.cache-dir }}
key: npm-main-linux-x64-${{ hashFiles('./package-lock.json') }}

- name: Install Temporal CLI
Expand Down
50 changes: 9 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,27 +169,12 @@ jobs:
mv tmp/corebridge-*/* ./
rm -rf tmp

- name: Install Node
uses: actions/setup-node@v4
- name: Setup Node and Install Dependencies
id: setup-node
uses: ./.github/actions/setup-node-deps
with:
node-version: 22

- name: Get NPM cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Restore NPM cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: npm-main-${{ matrix.platform }}-${{ hashFiles('./package-lock.json') }}
restore-keys: |
npm-main-${{ matrix.platform }}-

- name: Download dependencies
# Make up to 3 attempts to install NPM dependencies, to work around transient NPM errors :(
run: |
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose
node-version: '22'
platform: ${{ matrix.platform }}

- name: Compile code
run: npm run build -- --ignore @temporalio/core-bridge
Expand All @@ -208,7 +193,7 @@ jobs:
# Only saves NPM cache from the main branch, to reduce pressure on the cache (limited to 10GB).
if: ${{ env.IS_MAIN_OR_RELEASE == 'true' }}
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
path: ${{ steps.setup-node.outputs.cache-dir }}
key: npm-main-${{ matrix.platform }}-${{ hashFiles('./package-lock.json') }}

# Tests that npm init @temporalio results in a working worker and client
Expand Down Expand Up @@ -258,28 +243,11 @@ jobs:
# We don't need the core submodule here since won't build the project
submodules: false

- name: Install Node
uses: actions/setup-node@v4
- name: Setup Node and Install Dependencies
uses: ./.github/actions/setup-node-deps
with:
node-version: ${{ matrix.node }}

- name: Get NPM cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Restore NPM cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: npm-main-${{ matrix.platform }}-${{ hashFiles('./package-lock.json') }}
restore-keys: |
npm-main-${{ matrix.platform }}-

# No need to compile anything, we just need the package ./scripts and their dependencies
- name: Install dependencies without compilation
run: |
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose
platform: ${{ matrix.platform }}

- name: Restore Verdaccio repo artifact
uses: actions/download-artifact@v4
Expand Down
24 changes: 4 additions & 20 deletions .github/workflows/stress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,11 @@ jobs:
submodules: recursive
ref: ${{ inputs.ref }}

- name: Install Node
uses: actions/setup-node@v4
- name: Setup Node and Install Dependencies
uses: ./.github/actions/setup-node-deps
with:
node-version: 22

- name: Get NPM cache directory
id: npm-cache-dir
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Restore NPM cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: npm-main-linux-x64-${{ hashFiles('./package-lock.json') }}
restore-keys: |
npm-main-linux-x64-
node-version: '22'
platform: 'linux-x64'

- name: Install protoc
uses: arduino/setup-protoc@v3
Expand All @@ -99,11 +88,6 @@ jobs:
env-vars: ''
save-if: ${{ env.IS_MAIN_OR_RELEASE == 'true' }}

- name: Download dependencies
# Make up to 3 attempts to install NPM dependencies, to work around transient NPM errors
run: |
npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose || npm ci --ignore-scripts --verbose

- name: Compile code
run: npm run build
env:
Expand Down
Loading