Skip to content

Support custom socket address resolution #11707

Support custom socket address resolution

Support custom socket address resolution #11707

Workflow file for this run

name: Node
permissions:
contents: read
on:
push:
branches:
- main
- release-*
- v*
paths:
- glide-core/src/**
- glide-core/redis-rs/redis/src/**
- node/**
- utils/cluster_manager.py
- .github/workflows/node.yml
- .github/workflows/install-shared-dependencies/action.yml
- .github/workflows/test-benchmark/action.yml
- .github/workflows/lint-rust/action.yml
- .github/workflows/install-engine/action.yml
- .github/json_matrices/**
- .github/workflows/create-test-matrices/action.yml
pull_request:
paths:
- glide-core/src/**
- glide-core/redis-rs/redis/src/**
- node/**
- utils/cluster_manager.py
- .github/workflows/node.yml
- .github/workflows/install-shared-dependencies/action.yml
- .github/workflows/test-benchmark/action.yml
- .github/workflows/lint-rust/action.yml
- .github/workflows/install-engine/action.yml
- .github/json_matrices/**
- .github/workflows/create-test-matrices/action.yml
workflow_dispatch:
inputs:
full-matrix:
description: "Run the full engine, host, and language version matrix"
type: boolean
default: false
run-with-macos:
description: "Run with macos included (only when necessary)"
type: choice
options:
- false
- use-self-hosted
- use-github
default: false
name:
required: false
type: string
description: "(Optional) Test run name"
run-modules-tests:
description: "Run modules tests"
type: boolean
default: false
workflow_call:
inputs:
run-with-macos:
description: "Run with macos included (only when necessary)"
type: string
default: false
concurrency:
group: node-${{ github.head_ref || github.ref }}-${{ toJson(inputs) }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
run-name:
# Set custom name if job is started manually and name is given
${{ github.event_name == 'workflow_dispatch' && (inputs.name == '' && format('{0} @ {1} {2}', github.ref_name, github.sha, toJson(inputs)) || inputs.name) || '' }}
jobs:
get-matrices:
runs-on: ubuntu-latest
outputs:
engine-matrix-output: ${{ steps.get-matrices.outputs.engine-matrix-output }}
host-matrix-output: ${{ steps.get-matrices.outputs.host-matrix-output }}
version-matrix-output: ${{ steps.get-matrices.outputs.version-matrix-output }}
steps:
- uses: actions/checkout@v4
- id: get-matrices
uses: ./.github/workflows/create-test-matrices
with:
language-name: node
run-full-matrix: ${{ github.event.inputs.full-matrix == 'true' || github.event_name == 'schedule' }}
run-with-macos: ${{ github.event.inputs.run-with-macos }}
test-node:
name: Node Tests - ${{ matrix.node }}, EngineVersion - ${{ matrix.engine.version }}, Target - ${{ matrix.host.TARGET }}
runs-on: ${{ matrix.host.RUNNER }}
needs: [get-matrices]
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
engine: ${{ fromJson(needs.get-matrices.outputs.engine-matrix-output) }}
host: ${{ fromJson(needs.get-matrices.outputs.host-matrix-output) }}
node: ${{ fromJson(needs.get-matrices.outputs.version-matrix-output) }}
steps:
- uses: actions/checkout@v4
- name: Output Matrix Parameters for this job
run: |
echo "Job running with the following matrix configuration:"
echo "${{ toJson(matrix) }}"
# Install software dependencies
- name: Install shared dependencies
uses: ./.github/workflows/install-shared-dependencies
with:
os: ${{ matrix.host.OS }}
target: ${{ matrix.host.TARGET }}
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: ${{ matrix.engine.version }}
# Setup Node.js
- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node }}
- uses: actions/cache@v4
with:
path: |
node/rust-client/target
glide-core/src/generated
key: ${{ matrix.host.TARGET }}-node
restore-keys: |
${{ matrix.host.TARGET }}-glide-core
${{ matrix.host.TARGET }}
# Install npm dependencies and build with release flag to ensure we testing the release version
- name: Install and Build
working-directory: ./node
run: |
npm install
npm run build:release
- name: Test
shell: bash
run: |
npm run build
npm run test
working-directory: ./node
env:
JEST_HTML_REPORTER_OUTPUT_PATH: test-report-node.html
- name: Upload test reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: node-test-reports-${{ matrix.node }}-${{ matrix.engine.type }}-${{ matrix.engine.version }}-${{ matrix.host.OS }}-${{ matrix.host.ARCH }}
path: |
node/test-report*.html
test-node-extras:
name: Node Extra Tests (ES/CJS, Yarn, Types, Benchmarks)
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- name: Output job information
run: |
echo "Running one-time Node.js extra tests"
echo "Target: x86_64-unknown-linux-gnu"
echo "Node: 23.x"
echo "Engine: 8.0"
# Install software dependencies
- name: Install shared dependencies
uses: ./.github/workflows/install-shared-dependencies
with:
os: ubuntu
target: x86_64-unknown-linux-gnu
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: "8.0"
# Setup Node.js
- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: 23.x
- uses: actions/cache@v4
with:
path: |
node/rust-client/target
glide-core/src/generated
key: x86_64-unknown-linux-gnu-node-extras
restore-keys: |
x86_64-unknown-linux-gnu-glide-core
x86_64-unknown-linux-gnu
# Install npm dependencies and build with release flag
- name: Install and Build
working-directory: ./node
run: |
npm install
npm run build:release
- name: Install Yarn
id: install-yarn
shell: bash
run: |
curl -o- -L https://yarnpkg.com/install.sh | bash
- name: Add Yarn to PATH
id: add-yarn-to-path
if: ${{ steps.install-yarn.outcome == 'success' }}
run: |
echo "$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin" >> $GITHUB_PATH
echo "Yarn PATH configured"
- name: Test yarn compatibility and correct typescript
if: ${{ steps.add-yarn-to-path.outcome == 'success' }}
working-directory: ./node/pm-and-types-tests
shell: bash
run: |
cd depend-on-glide-package
yarn install
rm -rf node_modules/@valkey/valkey-glide/build-ts/*
cp -r ../../build-ts ./node_modules/@valkey/valkey-glide/
yarn run build
cd ../depend-on-glide-dependent
yarn install
yarn run build
# Test hybrid node modules - commonjs
- name: Test hybrid node modules - commonjs
run: |
npm install
npm run test
working-directory: ./node/hybrid-node-tests/commonjs-test
env:
JEST_HTML_REPORTER_OUTPUT_PATH: test-report-commonjs.html
- name: Test hybrid node modules - ecma
run: |
npm install
npm run test
working-directory: ./node/hybrid-node-tests/ecmascript-test
env:
JEST_HTML_REPORTER_OUTPUT_PATH: test-report-ecma.html
- name: Run benchmarks
uses: ./.github/workflows/test-benchmark
with:
language-flag: -node
- name: Upload test reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: node-extra-test-reports-${{ github.run_id }}
path: |
node/hybrid-node-tests/**/test-report*.html
utils/clusters/**
benchmarks/results/**
lint-rust:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: lint node rust
uses: ./.github/workflows/lint-rust
with:
cargo-toml-folder: ./node/rust-client
github-token: ${{ secrets.GITHUB_TOKEN }}
get-containers:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.full-matrix == 'true' || github.event_name == 'schedule' }}
outputs:
engine-matrix-output: ${{ steps.get-matrices.outputs.engine-matrix-output }}
host-matrix-output: ${{ steps.get-matrices.outputs.host-matrix-output }}
version-matrix-output: ${{ steps.get-matrices.outputs.version-matrix-output }}
steps:
- uses: actions/checkout@v4
- id: get-matrices
uses: ./.github/workflows/create-test-matrices
with:
language-name: node
run-full-matrix: true
containers: true
test-node-container:
runs-on: ${{ matrix.host.RUNNER }}
needs: [get-containers]
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
node: ${{ fromJson(needs.get-containers.outputs.version-matrix-output) }}
engine: ${{ fromJson(needs.get-containers.outputs.engine-matrix-output) }}
host: ${{ fromJson(needs.get-containers.outputs.host-matrix-output) }}
container:
image: ${{ matrix.host.IMAGE }}
options: ${{ join(' -q ', matrix.host.CONTAINER_OPTIONS) }} # adding `-q` to bypass empty options
steps:
- name: Install git and required tools
run: |
if [[ "${{ matrix.host.OS }}" == "amazon-linux" ]]; then
# Basic tools needed for actions to work properly
yum install -y git tar which
yum install -y --allowerasing curl
elif [[ "${{ matrix.host.TARGET }}" == "x86_64-unknown-linux-musl" ]]; then
# Basic tools needed for actions to work properly
apk update
apk add git bash tar curl which build-base python3
fi
- name: Create directory structure if needed
run: mkdir -p $GITHUB_WORKSPACE
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set permissions after checkout
run: chown -R $(id -u):$(id -g) $GITHUB_WORKSPACE
# Install shared dependencies including Rust and Protocol Buffers
- name: Install shared dependencies
uses: ./.github/workflows/install-shared-dependencies
with:
os: ${{ matrix.host.OS }}
target: ${{ matrix.host.TARGET }}
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: ${{ matrix.engine.version }}
# Ensure Rust is in PATH for container environments
- name: Setup Rust PATH
if: ${{ contains(matrix.host.TARGET, 'musl') }}
run: |
echo 'source "$HOME/.cargo/env"' >> ~/.bashrc
source "$HOME/.cargo/env"
echo "PATH=$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV
# Verify Rust is available
which cargo || echo "Cargo still not found in PATH"
echo "Current PATH: $PATH"
- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node }}
- uses: actions/cache@v4
with:
path: |
node/rust-client/target
glide-core/src/generated
key: ${{ matrix.host.IMAGE }}-node
restore-keys: ${{ matrix.host.IMAGE }}
- name: Build and Test
working-directory: ./node
env:
PATH: ${{ env.PATH }}:/root/.cargo/bin:/home/ubuntu/.cargo/bin
run: |
# Verify Rust is available
which cargo || echo "Cargo not found in PATH"
echo "Current PATH: $PATH"
# Check where cargo is installed
find / -name cargo -type f 2>/dev/null || echo "Could not find cargo executable"
# Explicitly source cargo env before build
if [ -f "$HOME/.cargo/env" ]; then
source "$HOME/.cargo/env"
echo "Sourced $HOME/.cargo/env"
fi
# Try to find rustc version
rustc --version || echo "rustc command failed"
npm run build
npm run test
- name: Sanitize IMAGE variable
# Replace `:` in the variable otherwise it can't be used in `upload-artifact`
run: echo "SANITIZED_IMAGE=${{ matrix.host.IMAGE }}" | sed -r 's/:/-/g' >> $GITHUB_ENV
- name: Upload test reports
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: test-report-node-${{ matrix.node }}-${{ matrix.engine.type }}-${{ matrix.engine.version }}-${{ env.SANITIZED_IMAGE }}-${{ matrix.host.ARCH }}
path: |
node/test-report*.html
utils/clusters/**
benchmarks/results/**
test-modules:
if: ((github.repository_owner == 'valkey-io' && github.event_name == 'workflow_dispatch' && github.event.inputs.run-modules-tests == 'true') || github.event.pull_request.head.repo.owner.login == 'valkey-io')
environment: AWS_ACTIONS
name: Running Module Tests
runs-on: [self-hosted, linux, ARM64, persistent]
timeout-minutes: 15
steps:
- name: Setup self-hosted runner access
run: sudo chown -R $USER:$USER /home/ubuntu/actions-runner/_work/valkey-glide
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v5
with:
node-version: latest
- uses: actions/cache@v4
with:
path: |
node/rust-client/target
glide-core/src/generated
key: aarch64-unknown-linux-gnu-node
restore-keys: |
aarch64-unknown-linux-gnu-glide-core
aarch64-unknown-linux-gnu
- name: Install and build
working-directory: ./node
run: |
npm install
npm run build
- name: test
run: npm run test:modules -- --cluster-endpoints=${{ secrets.MEMDB_MODULES_ENDPOINT }} --tls=true
working-directory: ./node
- name: Upload test reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: test-report-node-modules-ubuntu
path: |
node/test-report*.html