Skip to content

Commit

Permalink
Node client CI: Add reporting (valkey-io#1983)
Browse files Browse the repository at this point in the history
Signed-off-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
Yury-Fridlyand authored Jul 29, 2024
1 parent a302dc8 commit d693105
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 42 deletions.
120 changes: 84 additions & 36 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
fail-fast: false
matrix:
engine: ${{ fromJson(needs.load-engine-matrix.outputs.matrix) }}

steps:
- uses: actions/checkout@v4
with:
Expand All @@ -85,21 +85,36 @@ jobs:
- name: test hybrid node modules - commonjs
run: |
npm install --package-lock-only
npm ci
npm ci
npm run build-and-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 --package-lock-only
npm ci
npm run build-and-test
working-directory: ./node/hybrid-node-tests/ecmascript-test
env:
JEST_HTML_REPORTER_OUTPUT_PATH: test-report-ecma.html

- 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: test-report-node-${{ matrix.engine.type }}-${{ matrix.engine.version }}-ubuntu
path: |
node/test-report*.html
utils/clusters/**
benchmarks/results/**
lint-rust:
timeout-minutes: 15
runs-on: ubuntu-latest
Expand Down Expand Up @@ -147,6 +162,17 @@ jobs:
# run: npm test -- -t "set and get flow works"
# working-directory: ./node

# - name: Upload test reports
# if: always()
# continue-on-error: true
# uses: actions/upload-artifact@v4
# with:
# name: test-report-node-${{ matrix.engine.type }}-${{ matrix.engine.version }}-macos
# path: |
# node/test-report*.html
# utils/clusters/**
# benchmarks/results/**

build-amazonlinux-latest:
runs-on: ubuntu-latest
container: amazonlinux:latest
Expand All @@ -157,7 +183,7 @@ jobs:
yum -y remove git
yum -y remove git-*
yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
yum install -y git
yum install -y git
git --version
- uses: actions/checkout@v4
Expand All @@ -181,8 +207,19 @@ jobs:

- name: Test compatibility
run: npm test -- -t "set and get flow works"
working-directory: ./node

working-directory: ./node

- name: Upload test reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: test-report-node-amazonlinux
path: |
node/test-report*.html
utils/clusters/**
benchmarks/results/**
build-and-test-linux-musl-on-x86:
name: Build and test Node wrapper on Linux musl
runs-on: ubuntu-latest
Expand All @@ -191,33 +228,44 @@ jobs:
options: --user root --privileged

steps:
- name: Install git
run: |
apk update
apk add git
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup musl on Linux
uses: ./.github/workflows/setup-musl-on-linux
with:
workspace: $GITHUB_WORKSPACE
npm-scope: ${{ secrets.NPM_SCOPE }}
npm-auth-token: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Build Node wrapper
uses: ./.github/workflows/build-node-wrapper
with:
os: ubuntu
named_os: linux
arch: x64
target: x86_64-unknown-linux-musl
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: "7.2.5"

- name: Test compatibility
shell: bash
run: npm test -- -t "set and get flow works"
working-directory: ./node
- name: Install git
run: |
apk update
apk add git
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup musl on Linux
uses: ./.github/workflows/setup-musl-on-linux
with:
workspace: $GITHUB_WORKSPACE
npm-scope: ${{ secrets.NPM_SCOPE }}
npm-auth-token: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Build Node wrapper
uses: ./.github/workflows/build-node-wrapper
with:
os: ubuntu
named_os: linux
arch: x64
target: x86_64-unknown-linux-musl
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: "7.2.5"

- name: Test compatibility
shell: bash
run: npm test -- -t "set and get flow works"
working-directory: ./node

- name: Upload test reports
if: always()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: test-report-node-linux-musl
path: |
node/test-report*.html
utils/clusters/**
benchmarks/results/**
2 changes: 2 additions & 0 deletions node/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ lerna-debug.log*
.pnpm-debug.log*
rust-client/index.*

# Test reports
*.html

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
Expand Down
12 changes: 12 additions & 0 deletions node/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,16 @@ module.exports = {
"mjs",
],
testTimeout: 20000,
reporters: [
"default",
[
"./node_modules/jest-html-reporter",
{
includeFailureMsg: true,
includeSuiteFailure: true,
executionTimeWarningThreshold: 60,
sort: "status",
},
],
],
};
1 change: 1 addition & 0 deletions node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"eslint-plugin-tsdoc": "^0.2.17",
"find-free-port": "^2.0.0",
"jest": "^28.1.3",
"jest-html-reporter": "^3.10.2",
"protobufjs-cli": "^1.1.1",
"redis-server": "^1.2.2",
"replace": "^1.2.2",
Expand Down
7 changes: 1 addition & 6 deletions node/tests/TestUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0
*/

import { beforeAll, expect } from "@jest/globals";
import { expect } from "@jest/globals";
import { exec } from "child_process";
import parseArgs from "minimist";
import { v4 as uuidv4 } from "uuid";
Expand All @@ -20,7 +20,6 @@ import {
GlideClient,
GlideClusterClient,
InsertPosition,
Logger,
ListDirection,
ProtocolVersion,
ReturnType,
Expand All @@ -29,10 +28,6 @@ import {
Transaction,
} from "..";

beforeAll(() => {
Logger.init("info");
});

/* eslint-disable @typescript-eslint/no-explicit-any */
function intoArrayInternal(obj: any, builder: Array<string>) {
if (obj == null) {
Expand Down

0 comments on commit d693105

Please sign in to comment.