Skip to content

Commit

Permalink
Fix version comparisons and update engine versions in workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
avifenesh committed Oct 25, 2024
1 parent 6365e0c commit ccea995
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 114 deletions.
4 changes: 2 additions & 2 deletions .github/json_matrices/engine-matrix.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
{
"type": "valkey",
"version": "8.0.0",
"version": "8.0",
"run": "always"
},
{
"type": "valkey",
"version": "7.2.5"
"version": "7.2"
},
{
"type": "redis",
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
with:
cargo-toml-folder: go
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
Expand All @@ -155,9 +155,7 @@ jobs:
- name: Install and run linters
working-directory: go
run: |
sudo apt install golang-goprotobuf-dev
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/go/target/release/deps/
make install-dev-tools install-build-tools generate-protobuf lint-ci
make install-dev-tools install-build-tools build lint-ci
get-containers:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -197,7 +195,6 @@ jobs:
git config --global --add safe.directory "$GITHUB_WORKSPACE"
echo IMAGE=amazonlinux:latest | sed -r 's/:/-/g' >> $GITHUB_ENV
# Replace `:` in the variable otherwise it can't be used in `upload-artifact`

- uses: actions/checkout@v4
with:
submodules: recursive
Expand Down
27 changes: 23 additions & 4 deletions .github/workflows/install-valkey/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,44 @@ inputs:

env:
CARGO_TERM_COLOR: always
VALKEY_MIN_VERSION: "7.2.5"
VALKEY_MIN_VERSION: "7.2"

runs:
using: "composite"

steps:
- name:
Cache Valkey
# TODO: remove the musl ARM64 limitation when https://github.com/actions/runner/issues/801 is resolved
if: ${{ inputs.target != 'aarch64-unknown-linux-musl' }}
# TODO: self-hosted runners are actually cloning the repo, using the cache from the previous run
# will not work as expected. We need to find a way to cache the valkey repo on the runner itself.
if: ${{!contains(inputs.target, 'aarch64') }}
uses: actions/cache@v4
id: cache-valkey
with:
path: |
~/valkey
key: valkey-${{ inputs.engine-version }}-${{ inputs.target }}

- name: Build Valkey for ARM
shell: bash
working-directory: ~
run: |
echo "Building valkey ${{ inputs.engine-version }}"
# check if the valkey repo is already cloned
if [[ ! -d valkey ]]; then
git clone https://github.com/valkey-io/valkey.git
fi
cd valkey
make clean
# check if the branch=version is already checked out
if [[ $(git branch --show-current) != ${{ inputs.engine-version }} ]]; then
sudo rm -rf /usr/local/bin/redis-* /usr/local/bin/valkey-* ./valkey-* ./redis-* ./dump.rdb
git checkout ${{ inputs.engine-version }}
make BUILD_TLS=yes
fi
- name: Build Valkey
if: ${{ steps.cache-valkey.outputs.cache-hit != 'true' }}
if: ${{ steps.cache-valkey.outputs.cache-hit != 'true' && !contains(inputs.target, 'aarch64') }}
shell: bash
run: |
echo "Building valkey ${{ inputs.engine-version }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/java-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ jobs:
uses: ./.github/workflows/install-shared-dependencies
with:
os: ${{ matrix.host.OS }}
engine-version: "7.2.5"
engine-version: "7.2"
target: ${{ matrix.host.TARGET }}
github-token: ${{ secrets.GITHUB_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ on:
default: false

schedule: # running tests by cron is disabled on forks by the condition defined for each job
- cron: "0 3 * * *" # Runs at 03:00 (3 AM) UTC every day
- cron: "0 3 * * *" # Runs at 03:00 (3 AM) UTC every day

concurrency:
group: nightly-${{ github.head_ref || github.ref }}-${{ toJson(inputs) }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ on:
workflow_call:

concurrency:
group: node-cd-${{ github.head_ref || github.ref }}-${{ toJson(inputs) }}
group: node-${{ github.head_ref || github.ref }}-${{ toJson(inputs) }}
cancel-in-progress: true

env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/npm-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
npm_scope: ${{ vars.NPM_SCOPE }}
publish: "true"
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: "7.2.5"
engine-version: "7.2"

- name: Check if RC and set a distribution tag for the package
shell: bash
Expand Down Expand Up @@ -258,7 +258,7 @@ jobs:
os: ubuntu
target: "x86_64-unknown-linux-gnu"
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: "7.2.5"
engine-version: "7.2"

- name: Check if RC and set a distribution tag for the package
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
target: ${{ matrix.build.TARGET }}
publish: "true"
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: "7.2.5"
engine-version: "7.2"

- name: Include protobuf files in the package
working-directory: ./python
Expand Down
49 changes: 7 additions & 42 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,39 +301,12 @@ jobs:
utils/clusters/**
benchmarks/results/**
start-self-hosted-runner:
if: github.event.pull_request.head.repo.owner.login == 'valkey-io'
runs-on: ubuntu-latest
environment: AWS_ACTIONS
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Start self hosted EC2 runner
uses: ./.github/workflows/start-self-hosted-runner
with:
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
ec2-instance-id: ${{ secrets.AWS_EC2_INSTANCE_ID }}

test-modules:
needs: [start-self-hosted-runner, get-matrices]
if: (github.repository_owner == 'valkey-io' && github.event_name == 'workflow_dispatch') || github.event.pull_request.head.repo.owner.login == 'valkey-io'
environment: AWS_ACTIONS
name: Running Module Tests
runs-on: ${{ matrix.host.RUNNER }}
timeout-minutes: 35
strategy:
fail-fast: false
matrix:
engine: ${{ fromJson(needs.load-engine-matrix.outputs.matrix) }}
python:
- "3.12"
host:
- {
OS: "ubuntu",
NAMED_OS: "linux",
RUNNER: ["self-hosted", "Linux", "ARM64"],
TARGET: "aarch64-unknown-linux-gnu",
}
runs-on: [self-hosted, linux, ARM64]
timeout-minutes: 15

steps:
- name: Setup self-hosted runner access
Expand All @@ -344,32 +317,24 @@ jobs:
with:
submodules: recursive

- name: Setup Python for self-hosted Ubuntu runners
run: |
sudo apt update -y
sudo apt upgrade -y
sudo apt install python3 python3-venv python3-pip -y
- name: Build Python wrapper
uses: ./.github/workflows/build-python-wrapper
with:
os: ${{ matrix.host.OS }}
target: ${{ matrix.host.TARGET }}
os: ubuntu
target: aarch64-unknown-linux-gnu
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: ${{ matrix.engine.version }}

- name: Test with pytest
working-directory: ./python
run: |
source .env/bin/activate
cd python/tests/
pytest --asyncio-mode=auto --tls --cluster-endpoints=${{ secrets.MEMDB_MODULES_ENDPOINT }} -k server_modules --html=pytest_report.html --self-contained-html
- name: Upload test reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: modules-report-python-${{ matrix.python }}-${{ matrix.engine.type }}-${{ matrix.engine.version }}-${{ matrix.host.RUNNER }}
name: modules-test-report
path: |
python/python/tests/pytest_report.html
12 changes: 3 additions & 9 deletions node/tests/GlideClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,7 @@ describe("GlideClient", () => {
getClientConfigurationOption(cluster.getAddresses(), protocol),
);
const transaction = new Transaction();
const expectedRes = await encodedTransactionTest(
transaction,
cluster.getVersion(),
);
const expectedRes = await encodedTransactionTest(transaction);
transaction.select(0);
const result = await client.exec(transaction, {
decoder: Decoder.Bytes,
Expand All @@ -308,10 +305,7 @@ describe("GlideClient", () => {
getClientConfigurationOption(cluster.getAddresses(), protocol),
);
const bytesTransaction = new Transaction();
const expectedBytesRes = await DumpAndRestoreTest(
bytesTransaction,
Buffer.from("value"),
);
const expectedBytesRes = await DumpAndRestoreTest(bytesTransaction);
bytesTransaction.select(0);
const result = await client.exec(bytesTransaction, {
decoder: Decoder.Bytes,
Expand All @@ -321,7 +315,7 @@ describe("GlideClient", () => {
validateTransactionResponse(result, expectedBytesRes);

const stringTransaction = new Transaction();
await DumpAndRestoreTest(stringTransaction, "value");
await DumpAndRestoreTest(stringTransaction);
stringTransaction.select(0);

// Since DUMP gets binary results, we cannot use the string decoder here, so we expected to get an error.
Expand Down
16 changes: 16 additions & 0 deletions node/tests/GlideClusterClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,21 @@ describe("GlideClusterClient", () => {
const client = await GlideClusterClient.createClient(
getClientConfigurationOption(cluster.getAddresses(), protocol),
);
const lmpopArr = [];

if (!cluster.checkIfServerVersionLessThan("7.0.0")) {
lmpopArr.push(
client.lmpop(["abc", "def"], ListDirection.LEFT, {
count: 1,
}),
);
lmpopArr.push(
client.blmpop(["abc", "def"], ListDirection.RIGHT, 0.1, {
count: 1,
}),
);
}

const promises: Promise<unknown>[] = [
client.blpop(["abc", "zxy", "lkn"], 0.1),
client.rename("abc", "zxy"),
Expand All @@ -389,6 +404,7 @@ describe("GlideClusterClient", () => {
client.sdiffstore("abc", ["zxy", "lkn"]),
client.sortStore("abc", "zyx"),
client.sortStore("abc", "zyx", { isAlpha: true }),
...lmpopArr,
client.bzpopmax(["abc", "def"], 0.5),
client.bzpopmin(["abc", "def"], 0.5),
client.xread({ abc: "0-0", zxy: "0-0", lkn: "0-0" }),
Expand Down
Loading

0 comments on commit ccea995

Please sign in to comment.