Skip to content

Commit 7eed47a

Browse files
authored
Cherry-picking: #5019 and #5022 from release-2.2 branch to main (#5025)
* JAVA: Add Windows support to Java build matrix and workflows (#5019) * JAVA: Add Windows support to Java build matrix and workflows - Add Windows x64 runner configuration to build-matrix.json with Maven package manager - Update create-test-matrices action to filter "always run" runners by language - Add x86_64-pc-windows-msvc target support to install-rust-and-protoc action - Add Windows OS support to install-shared-dependencies action with Python setup - Exclude Windows from engine installation until integration tests are implemented - Update java-cd.yml to use conditional gradle/gradlew.bat commands based on OS - Skip integration tests on Windows builds with TODO for future implementation - Add language parameter to install-shared-dependencies for language-specific setup - Update java.yml to support Windows platform with appropriate build configurations Signed-off-by: affonsov <[email protected]> * fix windows exclusion on the java pubsub tests Signed-off-by: affonsov <[email protected]> * chore: Add Rust toolchain configuration files - Add rust-toolchain.toml to ffi directory with Rust 1.91.1 - Add rust-toolchain.toml to glide-core directory with Rust 1.91.1 - Configure clippy and rustfmt components for both toolchains Signed-off-by: affonsov <[email protected]> * Add Rust toolchain configuration files - Add rust-toolchain.toml to benchmarks/rust directory - Add rust-toolchain.toml to glide-core/redis-rs/redis directory Signed-off-by: affonsov <[email protected]> * adding rust-toolchain on redis-rs folder Signed-off-by: affonsov <[email protected]> * downgrade to use 1.91.0 Signed-off-by: affonsov <[email protected]> * remove rust-toolchain pinned rust version on install-rust-and-protoc workflow Signed-off-by: affonsov <[email protected]> * Update Rust toolchain to stable and remove redundant configuration - Update Rust toolchain from pinned version 1.91.0 to stable in install-rust-and-protoc action - Remove rust-toolchain.toml file from glide-core/redis-rs directory - Remove CARGO_BUILD_JOBS environment variable from java-cd.yml workflow - Remove CARGO_BUILD_JOBS environment variable from java.yml workflow (build and container build jobs) Signed-off-by: affonsov <[email protected]> * - Add #[default] attribute to Random variant in InternalSingleNodeRouting enum Signed-off-by: affonsov <[email protected]> * Replace statistical crate with statrs - Replace `statistical` dependency with `statrs` (v0.18.0) in Cargo.toml - Update latency calculation to use `statrs::statistics::Data` API - Import `Data` and `Distribution` traits from statrs - Calculate mean using `data.mean()` with fallback to 0.0 - Calculate standard deviation using `data.std_dev()` with fallback to 0.0 Signed-off-by: affonsov <[email protected]> * fix java.yml Signed-off-by: affonsov <[email protected]> --------- Signed-off-by: affonsov <[email protected]> * JAVA: Add explicit bash shell to workflow steps for Windows compatibility (#5022) - Add `shell: bash` directive to all shell script steps in java-cd workflow - Add conditional check `if: runner.os != 'Windows'` to self-hosted runner setup step - Ensure consistent shell behavior across other platforms and Windows runners Signed-off-by: affonsov <[email protected]> --------- Signed-off-by: affonsov <[email protected]>
1 parent 050bc2e commit 7eed47a

File tree

7 files changed

+101
-23
lines changed

7 files changed

+101
-23
lines changed

.github/json_matrices/build-matrix.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,15 @@
8181
"IMAGE": "amazonlinux:latest",
8282
"PACKAGE_MANAGERS": [],
8383
"languages": ["python", "node", "java", "go"]
84+
},
85+
{
86+
"OS": "windows",
87+
"NAMED_OS": "windows",
88+
"RUNNER": "windows-latest",
89+
"ARCH": "x64",
90+
"TARGET": "x86_64-pc-windows-msvc",
91+
"PACKAGE_MANAGERS": ["maven"],
92+
"languages": ["java"],
93+
"run": "always"
8494
}
8595
]

.github/workflows/create-test-matrices/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ runs:
7878
echo 'Select runners (VMs) to run tests on'
7979
8080
if [[ "$EVENT_NAME" == "pull_request" || "$EVENT_NAME" == "push" || "$RUN_FULL_MATRIX" == "false" ]]; then
81-
echo 'Getting "always run" runners'
82-
BASE_MATRIX=$(jq -c '[.[] | select(.run == "always")]' < .github/json_matrices/build-matrix.json)
81+
echo 'Getting "always run" runners for this language'
82+
BASE_MATRIX=$(jq --arg lang "$LANGUAGE_NAME" -c '[.[] | select(.run == "always" and .languages? and any(.languages[] == $lang; .) and '"$CONDITION"')]' < .github/json_matrices/build-matrix.json)
8383
else
8484
echo 'Getting full matrix for language excluding macOS'
8585
BASE_MATRIX=$(jq --arg lang "$LANGUAGE_NAME" -c '[.[] | select(.languages? and any(.languages[] == $lang; .) and '"$CONDITION"' and .TARGET != "aarch64-apple-darwin")]' < .github/json_matrices/build-matrix.json)

.github/workflows/install-rust-and-protoc/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ inputs:
1111
- aarch64-unknown-linux-gnu
1212
- x86_64-apple-darwin
1313
- aarch64-apple-darwin
14+
- x86_64-pc-windows-msvc
1415
github-token:
1516
description: "GitHub token"
1617
type: string

.github/workflows/install-shared-dependencies/action.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ inputs:
99
- amazon-linux
1010
- macos
1111
- ubuntu
12+
- windows
1213
target:
1314
description: "Specified target for rust toolchain, ex. x86_64-apple-darwin"
1415
type: string
@@ -21,10 +22,15 @@ inputs:
2122
- aarch64-apple-darwin
2223
- aarch64-unknown-linux-musl
2324
- x86_64-unknown-linux-musl
25+
- x86_64-pc-windows-msvc
2426
engine-version:
2527
description: "Engine version to install"
2628
required: false
2729
type: string
30+
language:
31+
description: "The language being built (optional, for language-specific setup)"
32+
required: false
33+
type: string
2834
github-token:
2935
description: "GITHUB_TOKEN, GitHub App installation access token"
3036
required: true
@@ -62,6 +68,20 @@ runs:
6268
run: |
6369
yum install -y gcc pkgconfig openssl openssl-devel which curl gettext libasan tar --allowerasing
6470
71+
- name: Install software dependencies for Windows
72+
shell: pwsh
73+
if: "${{ inputs.os == 'windows' }}"
74+
run: |
75+
# Verify Rust toolchain is available
76+
rustc --version
77+
cargo --version
78+
79+
- name: Setup Python for Windows
80+
if: "${{ inputs.os == 'windows' }}"
81+
uses: actions/setup-python@v5
82+
with:
83+
python-version: "3.x"
84+
6585
- name: Install Rust toolchain and protoc
6686
if: "${{ !contains(inputs.target, 'musl') }}"
6787
uses: ./.github/workflows/install-rust-and-protoc
@@ -70,7 +90,8 @@ runs:
7090
github-token: ${{ inputs.github-token }}
7191

7292
- name: Install engine
73-
if: "${{ inputs.engine-version }}"
93+
# TODO: Remove Windows exclusion when Windows integration tests are implemented
94+
if: "${{ inputs.engine-version && inputs.os != 'windows' }}"
7495
uses: ./.github/workflows/install-engine
7596
with:
7697
engine-version: ${{ inputs.engine-version }}

.github/workflows/java-cd.yml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ jobs:
8484

8585
steps:
8686
- name: Setup self-hosted runner access
87+
if: runner.os != 'Windows'
88+
shell: bash
8789
run: |
8890
GHA_HOME=/home/ubuntu/actions-runner/_work/valkey-glide
8991
if [ -d $GHA_HOME ]; then
@@ -106,6 +108,7 @@ jobs:
106108
os: ${{ matrix.host.OS }}
107109
target: ${{ matrix.host.CD_TARGET || matrix.host.TARGET }}
108110
github-token: ${{ secrets.GITHUB_TOKEN }}
111+
language: java
109112

110113
- name: Run rustup with correct target
111114
if: ${{ contains(matrix.host.TARGET, 'musl') }}
@@ -131,6 +134,7 @@ jobs:
131134
132135
- name: Create secret key ring file for all Java submodules
133136
working-directory: java/client
137+
shell: bash
134138
run: |
135139
# Decode the provided base64 GPG key into the client module
136140
echo "$SECRING_GPG" | base64 --decode > ./secring.gpg
@@ -150,31 +154,43 @@ jobs:
150154

151155
- name: Build java client
152156
working-directory: java
157+
shell: bash
158+
env:
159+
GLIDE_RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
153160
run: |
161+
# Determine gradle command based on OS
162+
if [[ "${{ matrix.host.OS }}" == "windows" ]]; then
163+
GRADLE_CMD="./gradlew.bat"
164+
# TODO: Remove -x :integTest:test when Windows integration tests are implemented
165+
EXTRA_ARGS="-x :integTest:test"
166+
else
167+
GRADLE_CMD="./gradlew"
168+
EXTRA_ARGS=""
169+
fi
170+
154171
if [[ "${{ matrix.host.TARGET }}" == *"musl"* ]]; then
155172
# Build and publish client first
156-
./gradlew --build-cache :client:publishToMavenLocal -Psigning.secretKeyRingFile=secring.gpg \
173+
$GRADLE_CMD --build-cache :client:publishToMavenLocal -Psigning.secretKeyRingFile=secring.gpg \
157174
-Psigning.password="${{ secrets.GPG_PASSWORD }}" -Psigning.keyId=${{ secrets.GPG_KEY_ID }} \
158-
-Ptarget=${{ matrix.host.TARGET }}
175+
-Ptarget=${{ matrix.host.TARGET }} $EXTRA_ARGS
159176
160177
# Then build jedis-compatibility
161-
./gradlew --build-cache :jedis-compatibility:publishToMavenLocal -Psigning.secretKeyRingFile=secring.gpg \
178+
$GRADLE_CMD --build-cache :jedis-compatibility:publishToMavenLocal -Psigning.secretKeyRingFile=secring.gpg \
162179
-Psigning.password="${{ secrets.GPG_PASSWORD }}" -Psigning.keyId=${{ secrets.GPG_KEY_ID }} \
163-
-Ptarget=${{ matrix.host.TARGET }}
180+
-Ptarget=${{ matrix.host.TARGET }} $EXTRA_ARGS
164181
else
165182
# Build and publish client first
166-
./gradlew --build-cache :client:publishToMavenLocal -Psigning.secretKeyRingFile=secring.gpg \
167-
-Psigning.password="${{ secrets.GPG_PASSWORD }}" -Psigning.keyId=${{ secrets.GPG_KEY_ID }}
183+
$GRADLE_CMD --build-cache :client:publishToMavenLocal -Psigning.secretKeyRingFile=secring.gpg \
184+
-Psigning.password="${{ secrets.GPG_PASSWORD }}" -Psigning.keyId=${{ secrets.GPG_KEY_ID }} $EXTRA_ARGS
168185
169186
# Then build jedis-compatibility
170-
./gradlew --build-cache :jedis-compatibility:publishToMavenLocal -Psigning.secretKeyRingFile=secring.gpg \
171-
-Psigning.password="${{ secrets.GPG_PASSWORD }}" -Psigning.keyId=${{ secrets.GPG_KEY_ID }}
187+
$GRADLE_CMD --build-cache :jedis-compatibility:publishToMavenLocal -Psigning.secretKeyRingFile=secring.gpg \
188+
-Psigning.password="${{ secrets.GPG_PASSWORD }}" -Psigning.keyId=${{ secrets.GPG_KEY_ID }} $EXTRA_ARGS
172189
fi
173-
env:
174-
GLIDE_RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
175190
176191
- name: Bundle JAR
177192
working-directory: java
193+
shell: bash
178194
run: |
179195
# Bundle client JAR
180196
src_folder=~/.m2/repository/io/valkey/valkey-glide/${{ env.RELEASE_VERSION }}
@@ -214,18 +230,21 @@ jobs:
214230
uses: actions/download-artifact@v4
215231

216232
- name: Move all required files to one directory
233+
shell: bash
217234
run: |
218235
mkdir maven-files
219236
cd maven-files
220237
for file in $(find ../. -name "*.jar"); do jar xf "$file" ; done
221238
222239
- name: Generate sha1 and md5 files for all Maven files
240+
shell: bash
223241
run: |
224242
cd maven-files
225243
for i in *.jar *.pom *.module; do md5sum $i | cut -d ' ' -f 1 > $i.md5; done
226244
for i in *.jar *.pom *.module; do sha1sum $i | cut -d ' ' -f 1 > $i.sha1; done
227245
228246
- name: Move files to the correct directory tree
247+
shell: bash
229248
run: |
230249
mkdir -p build/io/valkey/valkey-glide/${{ env.RELEASE_VERSION }}
231250
mkdir -p build/io/valkey/valkey-glide-jedis-compatibility/${{ env.RELEASE_VERSION }}
@@ -250,6 +269,7 @@ jobs:
250269
251270
- name: Publish to Maven Central
252271
id: maven-deployment
272+
shell: bash
253273
run: |
254274
export DEPLOYMENT_ID=`curl --request POST \
255275
-u "${{ secrets.CENTRAL_TOKEN_USERNAME }}:${{ secrets.CENTRAL_TOKEN_PASSWORD }}" \
@@ -260,6 +280,7 @@ jobs:
260280
echo Uploaded to Maven deployment with deployment ID $DEPLOYMENT_ID. Will be released if smoke tests pass and approved for release.
261281
262282
- name: Check status of deployment
283+
shell: bash
263284
run: |
264285
for ((retries = 0; retries < 20; retries++)); do
265286
sleep 5
@@ -296,6 +317,9 @@ jobs:
296317
exclude:
297318
- host:
298319
TARGET: aarch64-unknown-linux-musl
320+
# TODO: Remove Windows exclusion when Windows integration tests are implemented
321+
- host:
322+
OS: windows
299323
runs-on: ${{ matrix.host.test-runner || matrix.host.runner }}
300324
container:
301325
image: ${{ matrix.host.IMAGE || ''}}

.github/workflows/java.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
test-java:
9595
name: Java Tests - ${{ matrix.java }}, EngineVersion - ${{ matrix.engine.version }}, Target - ${{ matrix.host.TARGET }}
9696
needs: get-matrices
97-
timeout-minutes: 35
97+
timeout-minutes: ${{ matrix.host.OS == 'windows' && 60 || 35 }}
9898
strategy:
9999
fail-fast: false
100100
matrix:
@@ -126,6 +126,7 @@ jobs:
126126
target: ${{ matrix.host.TARGET }}
127127
github-token: ${{ secrets.GITHUB_TOKEN }}
128128
engine-version: ${{ matrix.engine.version }}
129+
language: java
129130

130131
- name: Install protoc (protobuf)
131132
uses: arduino/setup-protoc@v3
@@ -153,13 +154,33 @@ jobs:
153154
restore-keys: |
154155
${{ runner.os }}-gradle-
155156
157+
- name: Setup Python3 for Windows
158+
if: ${{ matrix.host.OS == 'windows' }}
159+
shell: bash
160+
run: |
161+
# Create python3 symlink for Windows
162+
ln -sf $(which python) /usr/bin/python3
163+
156164
- name: Build java client
157165
working-directory: java
158-
run: ./gradlew --build-cache --continue build test -x javadoc
166+
shell: bash
167+
run: |
168+
if [[ "${{ matrix.host.OS }}" == "windows" ]]; then
169+
# TODO: Remove -x :integTest:test when Windows integration tests are implemented
170+
./gradlew.bat --build-cache --continue build test -x javadoc -x :integTest:test
171+
else
172+
./gradlew --build-cache --continue build test -x javadoc
173+
fi
159174
160175
- name: Ensure no skipped files by linter
161176
working-directory: java
162-
run: ./gradlew --build-cache spotlessDiagnose | grep 'All formatters are well behaved for all files'
177+
shell: bash
178+
run: |
179+
if [[ "${{ matrix.host.OS }}" == "windows" ]]; then
180+
./gradlew.bat --build-cache spotlessDiagnose | grep 'All formatters are well behaved for all files'
181+
else
182+
./gradlew --build-cache spotlessDiagnose | grep 'All formatters are well behaved for all files'
183+
fi
163184
164185
- uses: ./.github/workflows/test-benchmark
165186
if: ${{ matrix.engine.version == '8.0' && matrix.host.RUNNER == 'ubuntu-latest' && matrix.java == '17' }}
@@ -189,6 +210,10 @@ jobs:
189210
java: ${{ fromJson(needs.get-matrices.outputs.version-matrix-output) }}
190211
engine: ${{ fromJson(needs.get-matrices.outputs.engine-matrix-output) }}
191212
host: ${{ fromJson(needs.get-matrices.outputs.host-matrix-output) }}
213+
# TODO: Remove Windows exclusion when Windows integration tests are implemented
214+
exclude:
215+
- host:
216+
OS: windows
192217
runs-on: ${{ matrix.host.RUNNER }}
193218

194219
steps:
@@ -212,6 +237,7 @@ jobs:
212237
target: ${{ matrix.host.TARGET }}
213238
github-token: ${{ secrets.GITHUB_TOKEN }}
214239
engine-version: ${{ matrix.engine.version }}
240+
language: java
215241

216242
- name: Install protoc (protobuf)
217243
uses: arduino/setup-protoc@v3
@@ -319,6 +345,7 @@ jobs:
319345
os: ${{ matrix.host.OS }}
320346
target: ${{ matrix.host.TARGET }}
321347
github-token: ${{ secrets.GITHUB_TOKEN }}
348+
language: java
322349
engine-version: ${{ matrix.engine.version }}
323350

324351
- name: Install protoc (protobuf)

glide-core/redis-rs/redis/src/cluster_async/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -598,8 +598,9 @@ impl<C> From<InternalSingleNodeRouting<C>> for InternalRoutingInfo<C> {
598598
}
599599
}
600600

601-
#[derive(Clone)]
601+
#[derive(Clone, Default)]
602602
pub(crate) enum InternalSingleNodeRouting<C> {
603+
#[default]
603604
Random,
604605
SpecificNode(Route),
605606
ByAddress(String),
@@ -613,12 +614,6 @@ pub(crate) enum InternalSingleNodeRouting<C> {
613614
},
614615
}
615616

616-
impl<C> Default for InternalSingleNodeRouting<C> {
617-
fn default() -> Self {
618-
Self::Random
619-
}
620-
}
621-
622617
impl<C> From<SingleNodeRoutingInfo> for InternalSingleNodeRouting<C> {
623618
fn from(value: SingleNodeRoutingInfo) -> Self {
624619
match value {

0 commit comments

Comments
 (0)