Skip to content

Commit

Permalink
Merge branch 'main' into java/integ_yuryf_it
Browse files Browse the repository at this point in the history
  • Loading branch information
Yury-Fridlyand authored Jan 31, 2024
2 parents 27c6472 + 96adb91 commit 8139859
Show file tree
Hide file tree
Showing 135 changed files with 607 additions and 184 deletions.
109 changes: 3 additions & 106 deletions .github/workflows/cd.yml → .github/workflows/npm-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- "v*.*"
jobs:
publish-binaries:
name: Publish packages
name: Publish packages to NPM
runs-on: ${{ matrix.build.RUNNER }}
strategy:
fail-fast: false
Expand All @@ -21,7 +21,6 @@ jobs:
ARCH: x64,
TARGET: x86_64-unknown-linux-gnu,
NPM_PUBLISH: true,
PYPI_PUBLISH: true,
}
- {
OS: ubuntu-latest,
Expand All @@ -30,7 +29,6 @@ jobs:
ARCH: arm64,
TARGET: aarch64-unknown-linux-gnu,
NPM_PUBLISH: true,
PYPI_PUBLISH: true,
CONTAINER: "2_28",
}
- {
Expand All @@ -40,7 +38,6 @@ jobs:
ARCH: x64,
TARGET: x86_64-apple-darwin,
NPM_PUBLISH: true,
PYPI_PUBLISH: true,
}
- {
OS: macos-latest,
Expand All @@ -49,7 +46,6 @@ jobs:
arch: arm64,
TARGET: aarch64-apple-darwin,
NPM_PUBLISH: true,
PYPI_PUBLISH: true,
}
steps:
- name: Checkout
Expand All @@ -62,8 +58,6 @@ jobs:
run: |
echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
###### NODEJS #####

- name: Setup node
if: matrix.build.NPM_PUBLISH == true
uses: actions/setup-node@v3
Expand Down Expand Up @@ -92,7 +86,7 @@ jobs:
shell: bash
working-directory: ./node
run: |
npm publish
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

Expand All @@ -118,103 +112,6 @@ jobs:
path: ./node/bin
if-no-files-found: error

###### PYTHON #####

- name: Set the package version for Python
if: matrix.build.PYPI_PUBLISH == true
working-directory: ./python
run: |
SED_FOR_MACOS=`if [[ "${{ matrix.build.OS }}" =~ .*"macos".* ]]; then echo "''"; fi`
sed -i $SED_FOR_MACOS "s|255.255.255|${{ env.RELEASE_VERSION }}|g" ./Cargo.toml
# Log the edited Cargo.toml file
cat Cargo.toml
- name: Set up Python
if: matrix.build.PYPI_PUBLISH == true && !contains(matrix.build.RUNNER, 'self-hosted')
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Setup Python for self-hosted Ubuntu runners
if: matrix.build.PYPI_PUBLISH == true && contains(matrix.build.OS, 'ubuntu') && contains(matrix.build.RUNNER, 'self-hosted')
run: |
sudo apt update -y
sudo apt upgrade -y
sudo apt install python3 python3-venv python3-pip -y
- name: Build Python wrapper
if: matrix.build.PYPI_PUBLISH == true
uses: ./.github/workflows/build-python-wrapper
with:
os: ${{ matrix.build.OS }}
target: ${{ matrix.build.TARGET }}
publish: "true"
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Include protobuf files in the package
working-directory: ./python
if: matrix.build.PYPI_PUBLISH == true
run: |
SED_FOR_MACOS=`if [[ "${{ matrix.build.OS }}" =~ .*"macos".* ]]; then echo "''"; fi`
sed -i $SED_FOR_MACOS '/pb2.py/d' .gitignore
# Log the edited .gitignore file
cat .gitignore
- name: Build Python wheels (linux)
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'linux')
uses: PyO3/maturin-action@v1
with:
working-directory: ./python
target: ${{ matrix.build.TARGET }}
args: --release --strip --out wheels -i python3.8 python3.9 python3.10 python3.11 python3.12
manylinux: auto
container: ${{ matrix.build.CONTAINER != '' && matrix.build.CONTAINER || '2014' }}
before-script-linux: |
# Install protobuf compiler
if [[ $(`which apt`) != '' ]]
then
apt install protobuf-compiler -y
else
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO $PB_REL/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
unzip protoc-3.15.8-linux-x86_64.zip -d $HOME/.local
export PATH="$PATH:$HOME/.local/bin"
fi
- name: Build Python wheels (macos)
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'darwin')
uses: PyO3/maturin-action@v1
with:
working-directory: ./python
target: ${{ matrix.build.TARGET }}
args: --release --strip --out wheels -i python3.10 python3.11 python3.12

- name: Upload Python wheels
if: matrix.build.PYPI_PUBLISH == true
uses: actions/upload-artifact@v3
with:
name: wheels
path: python/wheels
if-no-files-found: error

publish-to-pypi:
name: Publish PyPI package
runs-on: ubuntu-latest
needs: publish-binaries
steps:
- uses: actions/download-artifact@v3
with:
path: python/wheels
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.LIVEPYPI_API_TOKEN }}
MATURIN_REPOSITORY: pypi
with:
command: upload
args: --skip-existing python/wheels/*

publish-base-to-npm:
name: Publish the base NPM package
needs: publish-binaries
Expand Down Expand Up @@ -290,6 +187,6 @@ jobs:
cp ../../README.md .
npm install
npm run build
npm publish
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
159 changes: 159 additions & 0 deletions .github/workflows/pypi-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# The cross platform build was created based on the [Packaging Rust Applications for the NPM Registry blog](https://blog.orhun.dev/packaging-rust-for-npm/).

name: Continuous Deployment

on:
push:
tags:
- "v*.*"
jobs:
publish-binaries:
name: Publish packages to PyPi
runs-on: ${{ matrix.build.RUNNER }}
strategy:
fail-fast: false
matrix:
build:
- {
OS: ubuntu-latest,
NAMED_OS: linux,
RUNNER: ubuntu-latest,
ARCH: x64,
TARGET: x86_64-unknown-linux-gnu,
PYPI_PUBLISH: true,
}
- {
OS: ubuntu-latest,
NAMED_OS: linux,
RUNNER: [self-hosted, Linux, ARM64],
ARCH: arm64,
TARGET: aarch64-unknown-linux-gnu,
PYPI_PUBLISH: true,
CONTAINER: "2_28",
}
- {
OS: macos-latest,
NAMED_OS: darwin,
RUNNER: macos-latest,
ARCH: x64,
TARGET: x86_64-apple-darwin,
PYPI_PUBLISH: true,
}
- {
OS: macos-latest,
NAMED_OS: darwin,
RUNNER: macos-13-xlarge,
arch: arm64,
TARGET: aarch64-apple-darwin,
PYPI_PUBLISH: true,
}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "true"

- name: Set the release version
shell: bash
run: |
echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Set the package version for Python
if: matrix.build.PYPI_PUBLISH == true
working-directory: ./python
run: |
SED_FOR_MACOS=`if [[ "${{ matrix.build.OS }}" =~ .*"macos".* ]]; then echo "''"; fi`
sed -i $SED_FOR_MACOS "s|255.255.255|${{ env.RELEASE_VERSION }}|g" ./Cargo.toml
# Log the edited Cargo.toml file
cat Cargo.toml
- name: Set up Python
if: matrix.build.PYPI_PUBLISH == true && !contains(matrix.build.RUNNER, 'self-hosted')
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Set up Python older versions for MacOS
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'darwin')
run: |
brew install [email protected] [email protected]
- name: Setup Python for self-hosted Ubuntu runners
if: matrix.build.PYPI_PUBLISH == true && contains(matrix.build.OS, 'ubuntu') && contains(matrix.build.RUNNER, 'self-hosted')
run: |
sudo apt update -y
sudo apt upgrade -y
sudo apt install python3 python3-venv python3-pip -y
- name: Build Python wrapper
if: matrix.build.PYPI_PUBLISH == true
uses: ./.github/workflows/build-python-wrapper
with:
os: ${{ matrix.build.OS }}
target: ${{ matrix.build.TARGET }}
publish: "true"
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Include protobuf files in the package
working-directory: ./python
if: matrix.build.PYPI_PUBLISH == true
run: |
SED_FOR_MACOS=`if [[ "${{ matrix.build.OS }}" =~ .*"macos".* ]]; then echo "''"; fi`
sed -i $SED_FOR_MACOS '/pb2.py/d' .gitignore
# Log the edited .gitignore file
cat .gitignore
- name: Build Python wheels (linux)
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'linux')
uses: PyO3/maturin-action@v1
with:
working-directory: ./python
target: ${{ matrix.build.TARGET }}
args: --release --strip --out wheels -i python3.8 python3.9 python3.10 python3.11 python3.12
manylinux: auto
container: ${{ matrix.build.CONTAINER != '' && matrix.build.CONTAINER || '2014' }}
before-script-linux: |
# Install protobuf compiler
if [[ $(`which apt`) != '' ]]
then
apt install protobuf-compiler -y
else
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO $PB_REL/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
unzip protoc-3.15.8-linux-x86_64.zip -d $HOME/.local
export PATH="$PATH:$HOME/.local/bin"
fi
- name: Build Python wheels (macos)
if: matrix.build.PYPI_PUBLISH == true && startsWith(matrix.build.NAMED_OS, 'darwin')
uses: PyO3/maturin-action@v1
with:
working-directory: ./python
target: ${{ matrix.build.TARGET }}
args: --release --strip --out wheels -i python3.8 python3.9 python3.10 python3.11 python3.12

- name: Upload Python wheels
if: matrix.build.PYPI_PUBLISH == true
uses: actions/upload-artifact@v3
with:
name: wheels
path: python/wheels
if-no-files-found: error

publish-to-pypi:
name: Publish the base PyPi package
runs-on: ubuntu-latest
needs: publish-binaries
steps:
- uses: actions/download-artifact@v3
with:
path: python/wheels
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.LIVEPYPI_API_TOKEN }}
MATURIN_REPOSITORY: pypi
with:
command: upload
args: --skip-existing python/wheels/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ utils/tls_crts/
# OSS Review Toolkit (ORT) files
**/ort*/**
**/ort_results/**

# java compiled files.
*.class
4 changes: 4 additions & 0 deletions benchmarks/csharp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

using System.Collections.Concurrent;
using System.Diagnostics;
using System.Linq;
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/node/node_benchmark.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

import { writeFileSync } from "fs";
import { Logger, RedisClient, RedisClusterClient } from "glide-for-redis";
import { Cluster, Redis } from "ioredis";
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/python/python_benchmark.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0

import argparse
import asyncio
import functools
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/rust/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

#[cfg(not(target_env = "msvc"))]
use tikv_jemallocator::Jemalloc;

Expand Down
2 changes: 2 additions & 0 deletions benchmarks/utilities/csv_exporter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/python3

# Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0

import csv
import json
import os
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/utilities/fill_db.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

import {
SIZE_SET_KEYSPACE,
createRedisClient,
Expand Down
4 changes: 4 additions & 0 deletions benchmarks/utilities/flush_db.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

import { RedisClientType, RedisClusterType } from "redis";
import { createRedisClient, receivedOptions } from "./utils";

Expand Down
4 changes: 4 additions & 0 deletions benchmarks/utilities/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Copyright GLIDE-for-Redis Project Contributors - SPDX Identifier: Apache-2.0
*/

import commandLineArgs from "command-line-args";
import {
RedisClientType,
Expand Down
Loading

0 comments on commit 8139859

Please sign in to comment.