chore: allure test reporting (#1668)

* allure test reporting

* make reports only for the main job

* fail a test for demo

* fail a test for demo

* revert

* fail a test for demo

* revert

* deploy to allure-jswaku

* use PAT

* add pat as secret

* check if pat exists

* debug secrets issue

* remove debug steps

* debug1

* debug2

* debug3

* debug4

* set reports for all tests

* fix after ci run

* self review

---------

Co-authored-by: Sasha <118575614+weboko@users.noreply.github.com>
This commit is contained in:
Florin Barbu 2023-10-23 17:53:56 +03:00 committed by GitHub
parent 491366bd4f
commit 80a33b9c2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 407 additions and 99 deletions

View File

@ -70,9 +70,11 @@ jobs:
node:
uses: ./.github/workflows/test-node.yml
secrets: inherit
with:
nim_wakunode_image: ${{ inputs.nim_wakunode_image || 'wakuorg/nwaku:v0.21.0' }}
test_type: node
allure_reports: true
node_optional:
uses: ./.github/workflows/test-node.yml

View File

@ -18,18 +18,24 @@ on:
required: false
type: string
default: ''
allure_reports:
required: false
type: boolean
default: false
env:
NODE_JS: "18"
# Ensure test type conditions remain consistent.
WAKU_SERVICE_NODE_PARAMS: ${{ (inputs.test_type == 'go-waku-master') && '--min-relay-peers-to-publish=0' || '' }}
DEBUG: ${{ inputs.debug }}
GITHUB_TOKEN: ${{ secrets.DEPLOY_TEST_REPORTS_PAT }}
jobs:
node:
runs-on: ubuntu-latest
env:
WAKUNODE_IMAGE: ${{ inputs.nim_wakunode_image }}
ALLURE_REPORTS: ${{ inputs.allure_reports }}
steps:
- uses: actions/checkout@v3
with:
@ -45,6 +51,39 @@ jobs:
- run: ${{ (inputs.test_type == 'node-optional') && 'npm run test:optional --workspace=@waku/tests' || 'npm run test:node' }}
- name: Merge allure reports
if: always() && env.ALLURE_REPORTS == 'true'
run: node ci/mergeAllureResults.cjs
- name: Get allure history
if: always() && env.ALLURE_REPORTS == 'true'
uses: actions/checkout@v3
continue-on-error: true
with:
repository: waku-org/allure-jswaku
ref: gh-pages
path: gh-pages
token: ${{ env.GITHUB_TOKEN }}
- name: Setup allure report
if: always() && env.ALLURE_REPORTS == 'true'
uses: simple-elf/allure-report-action@master
id: allure-report
with:
allure_results: allure-results
gh_pages: gh-pages
allure_history: allure-history
keep_reports: 30
- name: Deploy report to Github Pages
if: always() && env.ALLURE_REPORTS == 'true'
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ env.GITHUB_TOKEN }}
external_repository: waku-org/allure-jswaku
publish_branch: gh-pages
publish_dir: allure-history
- name: Upload debug logs on failure
uses: actions/upload-artifact@v3
if: failure()

1
.gitignore vendored
View File

@ -12,3 +12,4 @@ docs
test-results
playwright-report
example
allure-results

19
ci/mergeAllureResults.cjs Normal file
View File

@ -0,0 +1,19 @@
const fs = require("fs-extra");
const glob = require("glob");
const ROOT_ALLURE_RESULTS = "./allure-results"; // Target directory in the root
fs.ensureDirSync(ROOT_ALLURE_RESULTS);
const directories = glob.sync("packages/**/allure-results");
directories.forEach((dir) => {
const files = fs.readdirSync(dir);
files.forEach((file) => {
const sourcePath = `${dir}/${file}`;
const targetPath = `${ROOT_ALLURE_RESULTS}/${file}`;
fs.copyFileSync(sourcePath, targetPath);
});
});
console.log("All allure-results directories merged successfully!");

125
package-lock.json generated
View File

@ -3980,9 +3980,9 @@
"license": "MIT"
},
"node_modules/@types/lodash": {
"version": "4.14.199",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.199.tgz",
"integrity": "sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg==",
"version": "4.14.200",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.200.tgz",
"integrity": "sha512-YI/M/4HRImtNf3pJgbF+W6FrXovqj+T+/HpENLTooK9PnkacBsDpeP3IpHab40CClUfhNmdM2WTNP2sa2dni5Q==",
"dev": true
},
"node_modules/@types/markdown-it": {
@ -5525,6 +5525,36 @@
"ajv": "^6.9.1"
}
},
"node_modules/allure-commandline": {
"version": "2.24.1",
"resolved": "https://registry.npmjs.org/allure-commandline/-/allure-commandline-2.24.1.tgz",
"integrity": "sha512-eNto3ipBq+O2B/f8/OwiS3E8R7jYENs3qv8jT7wMZmziYLANsISC9tX/FfEqR3FDiQlEOjkP7iyTEZ3ph53FPg==",
"dev": true,
"bin": {
"allure": "bin/allure"
}
},
"node_modules/allure-js-commons": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/allure-js-commons/-/allure-js-commons-2.9.2.tgz",
"integrity": "sha512-Qvi+zMZQruklqcnqG/zHCnE209v1YiWGhO3H2aPW2aXC8Ockqd01a+w2lP4Qqp3SfC+WQDeAK2+pp+v+eNl8xQ==",
"dev": true,
"dependencies": {
"properties": "^1.2.1"
}
},
"node_modules/allure-mocha": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/allure-mocha/-/allure-mocha-2.9.2.tgz",
"integrity": "sha512-JOWvqn6534VfrfGhOtjBtGUMMO3+zKKujay5dnfbWncGlIQK9c+qrDPvbTupBc9uIvIFT5EjSAtTYKPAAWz5EQ==",
"dev": true,
"dependencies": {
"allure-js-commons": "2.9.2"
},
"peerDependencies": {
"mocha": ">=6.2.x"
}
},
"node_modules/ansi-align": {
"version": "3.0.1",
"license": "ISC",
@ -10213,7 +10243,8 @@
},
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"license": "MIT"
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
},
"node_modules/fast-diff": {
"version": "1.3.0",
@ -15035,7 +15066,8 @@
},
"node_modules/mocha": {
"version": "10.2.0",
"license": "MIT",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz",
"integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==",
"dependencies": {
"ansi-colors": "4.1.1",
"browser-stdout": "1.3.1",
@ -15071,6 +15103,22 @@
"url": "https://opencollective.com/mochajs"
}
},
"node_modules/mocha-multi-reporters": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/mocha-multi-reporters/-/mocha-multi-reporters-1.5.1.tgz",
"integrity": "sha512-Yb4QJOaGLIcmB0VY7Wif5AjvLMUFAdV57D2TWEva1Y0kU/3LjKpeRVmlMIfuO1SVbauve459kgtIizADqxMWPg==",
"dev": true,
"dependencies": {
"debug": "^4.1.1",
"lodash": "^4.17.15"
},
"engines": {
"node": ">=6.0.0"
},
"peerDependencies": {
"mocha": ">=3.1.2"
}
},
"node_modules/mocha/node_modules/ansi-colors": {
"version": "4.1.1",
"license": "MIT",
@ -20901,6 +20949,15 @@
"node": ">= 4"
}
},
"node_modules/properties": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/properties/-/properties-1.2.1.tgz",
"integrity": "sha512-qYNxyMj1JeW54i/EWEFsM1cVwxJbtgPp8+0Wg9XjNaK6VE/c4oRi6PNu5p7w1mNXEIQIjV5Wwn8v8Gz82/QzdQ==",
"dev": true,
"engines": {
"node": ">=0.10"
}
},
"node_modules/proto-list": {
"version": "1.2.4",
"license": "ISC"
@ -26204,6 +26261,8 @@
"@waku/message-encryption": "*",
"@waku/peer-exchange": "*",
"@waku/sdk": "*",
"allure-commandline": "^2.24.1",
"allure-mocha": "^2.9.2",
"chai": "^4.3.7",
"cspell": "^7.3.2",
"datastore-core": "^9.2.3",
@ -26211,6 +26270,7 @@
"interface-datastore": "^8.2.5",
"libp2p": "^0.46.14",
"mocha": "^10.2.0",
"mocha-multi-reporters": "^1.5.1",
"npm-run-all": "^4.1.5"
},
"engines": {
@ -28786,9 +28846,9 @@
"dev": true
},
"@types/lodash": {
"version": "4.14.199",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.199.tgz",
"integrity": "sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg==",
"version": "4.14.200",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.200.tgz",
"integrity": "sha512-YI/M/4HRImtNf3pJgbF+W6FrXovqj+T+/HpENLTooK9PnkacBsDpeP3IpHab40CClUfhNmdM2WTNP2sa2dni5Q==",
"dev": true
},
"@types/markdown-it": {
@ -29474,6 +29534,8 @@
"@waku/peer-exchange": "*",
"@waku/sdk": "*",
"@waku/utils": "*",
"allure-commandline": "^2.24.1",
"allure-mocha": "^2.9.2",
"app-root-path": "^3.1.0",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
@ -29485,6 +29547,7 @@
"libp2p": "^0.46.14",
"lodash": "^4.17.21",
"mocha": "^10.2.0",
"mocha-multi-reporters": "^1.5.1",
"npm-run-all": "^4.1.5",
"p-retry": "^6.1.0",
"p-timeout": "^6.1.0",
@ -30018,6 +30081,30 @@
"dev": true,
"requires": {}
},
"allure-commandline": {
"version": "2.24.1",
"resolved": "https://registry.npmjs.org/allure-commandline/-/allure-commandline-2.24.1.tgz",
"integrity": "sha512-eNto3ipBq+O2B/f8/OwiS3E8R7jYENs3qv8jT7wMZmziYLANsISC9tX/FfEqR3FDiQlEOjkP7iyTEZ3ph53FPg==",
"dev": true
},
"allure-js-commons": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/allure-js-commons/-/allure-js-commons-2.9.2.tgz",
"integrity": "sha512-Qvi+zMZQruklqcnqG/zHCnE209v1YiWGhO3H2aPW2aXC8Ockqd01a+w2lP4Qqp3SfC+WQDeAK2+pp+v+eNl8xQ==",
"dev": true,
"requires": {
"properties": "^1.2.1"
}
},
"allure-mocha": {
"version": "2.9.2",
"resolved": "https://registry.npmjs.org/allure-mocha/-/allure-mocha-2.9.2.tgz",
"integrity": "sha512-JOWvqn6534VfrfGhOtjBtGUMMO3+zKKujay5dnfbWncGlIQK9c+qrDPvbTupBc9uIvIFT5EjSAtTYKPAAWz5EQ==",
"dev": true,
"requires": {
"allure-js-commons": "2.9.2"
}
},
"ansi-align": {
"version": "3.0.1",
"requires": {
@ -32786,7 +32873,9 @@
}
},
"fast-deep-equal": {
"version": "3.1.3"
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
},
"fast-diff": {
"version": "1.3.0",
@ -35670,6 +35759,8 @@
},
"mocha": {
"version": "10.2.0",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz",
"integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==",
"requires": {
"ansi-colors": "4.1.1",
"browser-stdout": "1.3.1",
@ -35841,6 +35932,16 @@
}
}
},
"mocha-multi-reporters": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/mocha-multi-reporters/-/mocha-multi-reporters-1.5.1.tgz",
"integrity": "sha512-Yb4QJOaGLIcmB0VY7Wif5AjvLMUFAdV57D2TWEva1Y0kU/3LjKpeRVmlMIfuO1SVbauve459kgtIizADqxMWPg==",
"dev": true,
"requires": {
"debug": "^4.1.1",
"lodash": "^4.17.15"
}
},
"modify-values": {
"version": "1.0.1"
},
@ -39216,6 +39317,12 @@
}
}
},
"properties": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/properties/-/properties-1.2.1.tgz",
"integrity": "sha512-qYNxyMj1JeW54i/EWEFsM1cVwxJbtgPp8+0Wg9XjNaK6VE/c4oRi6PNu5p7w1mNXEIQIjV5Wwn8v8Gz82/QzdQ==",
"dev": true
},
"proto-list": {
"version": "1.2.4"
},

View File

@ -0,0 +1,6 @@
{
"reporterEnabled": "spec, allure-mocha",
"allureMochaReporter": {
"outputDir": "allure-results"
}
}

View File

@ -0,0 +1,26 @@
const config = {
extension: ['ts'],
spec: 'src/**/*.spec.ts',
require: ['ts-node/register', 'isomorphic-fetch'],
loader: 'ts-node/esm',
nodeOptions: [
'experimental-specifier-resolution=node',
'loader=ts-node/esm'
],
exit: true
};
if (process.env.CI) {
console.log("Running tests in parallel");
config.parallel = true;
config.jobs = 6;
console.log("Activating allure reporting");
config.reporter = 'mocha-multi-reporters';
config.reporterOptions = {
configFile: '.mocha.reporters.json'
};
} else {
console.log("Running tests serially. To enable parallel execution update mocha config");
}
module.exports = config;

View File

@ -1,11 +0,0 @@
{
"extension": ["ts"],
"spec": "src/**/*.spec.ts",
"require": ["ts-node/register", "isomorphic-fetch"],
"loader": "ts-node/esm",
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"exit": true
}

View File

@ -0,0 +1,6 @@
{
"reporterEnabled": "spec, allure-mocha",
"allureMochaReporter": {
"outputDir": "allure-results"
}
}

View File

@ -0,0 +1,26 @@
const config = {
extension: ['ts'],
spec: 'src/**/*.spec.ts',
require: ['ts-node/register', 'isomorphic-fetch'],
loader: 'ts-node/esm',
'node-option': [
'experimental-specifier-resolution=node',
'loader=ts-node/esm'
],
exit: true
};
if (process.env.CI) {
console.log("Running tests in parallel");
config.parallel = true;
config.jobs = 6;
console.log("Activating allure reporting");
config.reporter = 'mocha-multi-reporters';
config.reporterOptions = {
configFile: '.mocha.reporters.json'
};
} else {
console.log("Running tests serially. To enable parallel execution update mocha config");
}
module.exports = config;

View File

@ -1,11 +0,0 @@
{
"extension": ["ts"],
"spec": "src/**/*.spec.ts",
"require": ["ts-node/register", "isomorphic-fetch"],
"loader": "ts-node/esm",
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"exit": true
}

View File

@ -0,0 +1,6 @@
{
"reporterEnabled": "spec, allure-mocha",
"allureMochaReporter": {
"outputDir": "allure-results"
}
}

26
packages/enr/.mocharc.cjs Normal file
View File

@ -0,0 +1,26 @@
const config = {
extension: ['ts'],
spec: 'src/**/*.spec.ts',
require: ['ts-node/register', 'isomorphic-fetch'],
loader: 'ts-node/esm',
'node-option': [
'experimental-specifier-resolution=node',
'loader=ts-node/esm'
],
exit: true
};
if (process.env.CI) {
console.log("Running tests in parallel");
config.parallel = true;
config.jobs = 6;
console.log("Activating allure reporting");
config.reporter = 'mocha-multi-reporters';
config.reporterOptions = {
configFile: '.mocha.reporters.json'
};
} else {
console.log("Running tests serially. To enable parallel execution update mocha config");
}
module.exports = config;

View File

@ -1,11 +0,0 @@
{
"extension": ["ts"],
"spec": "src/**/*.spec.ts",
"require": ["ts-node/register", "isomorphic-fetch"],
"loader": "ts-node/esm",
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"exit": true
}

View File

@ -0,0 +1,6 @@
{
"reporterEnabled": "spec, allure-mocha",
"allureMochaReporter": {
"outputDir": "allure-results"
}
}

View File

@ -0,0 +1,26 @@
const config = {
extension: ['ts'],
spec: 'src/**/*.spec.ts',
require: ['ts-node/register', 'isomorphic-fetch'],
loader: 'ts-node/esm',
'node-option': [
'experimental-specifier-resolution=node',
'loader=ts-node/esm'
],
exit: true
};
if (process.env.CI) {
console.log("Running tests in parallel");
config.parallel = true;
config.jobs = 6;
console.log("Activating allure reporting");
config.reporter = 'mocha-multi-reporters';
config.reporterOptions = {
configFile: '.mocha.reporters.json'
};
} else {
console.log("Running tests serially. To enable parallel execution update mocha config");
}
module.exports = config;

View File

@ -1,11 +0,0 @@
{
"extension": ["ts"],
"spec": "src/**/*.spec.ts",
"require": ["ts-node/register", "isomorphic-fetch"],
"loader": "ts-node/esm",
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"exit": true
}

View File

@ -6,6 +6,7 @@ import { getPublicKey } from "./crypto/index.js";
import { createDecoder, createEncoder } from "./ecies.js";
describe("Ecies Encryption", function () {
this.timeout(20000);
it("Round trip binary encryption [ecies, no signature]", async function () {
await fc.assert(
fc.asyncProperty(

View File

@ -11,7 +11,8 @@ import {
preCipher
} from "./waku_payload.js";
describe("Waku Payload", () => {
describe("Waku Payload", function () {
this.timeout(20000);
it("Asymmetric encrypt & decrypt", async function () {
await fc.assert(
fc.asyncProperty(

View File

@ -0,0 +1,6 @@
{
"reporterEnabled": "spec, allure-mocha",
"allureMochaReporter": {
"outputDir": "allure-results"
}
}

View File

@ -0,0 +1,26 @@
const config = {
extension: ['ts'],
spec: 'src/**/*.spec.ts',
require: ['ts-node/register', 'isomorphic-fetch'],
loader: 'ts-node/esm',
'node-option': [
'experimental-specifier-resolution=node',
'loader=ts-node/esm'
],
exit: true
};
if (process.env.CI) {
console.log("Running tests in parallel");
config.parallel = true;
config.jobs = 6;
console.log("Activating allure reporting");
config.reporter = 'mocha-multi-reporters';
config.reporterOptions = {
configFile: '.mocha.reporters.json'
};
} else {
console.log("Running tests serially. To enable parallel execution update mocha config");
}
module.exports = config;

View File

@ -1,11 +0,0 @@
{
"extension": ["ts"],
"spec": "src/**/*.spec.ts",
"require": ["ts-node/register", "isomorphic-fetch"],
"loader": "ts-node/esm",
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"exit": true
}

View File

@ -0,0 +1,6 @@
{
"reporterEnabled": "spec, allure-mocha",
"allureMochaReporter": {
"outputDir": "allure-results"
}
}

View File

@ -0,0 +1,26 @@
const config = {
extension: ['ts'],
spec: 'src/**/*.spec.ts',
require: ['ts-node/register', 'isomorphic-fetch'],
loader: 'ts-node/esm',
'node-option': [
'experimental-specifier-resolution=node',
'loader=ts-node/esm'
],
exit: true
};
if (process.env.CI) {
console.log("Running tests in parallel");
config.parallel = true;
config.jobs = 6;
console.log("Activating allure reporting");
config.reporter = 'mocha-multi-reporters';
config.reporterOptions = {
configFile: '.mocha.reporters.json'
};
} else {
console.log("Running tests serially. To enable parallel execution update mocha config");
}
module.exports = config;

View File

@ -1,11 +0,0 @@
{
"extension": ["ts"],
"spec": "src/**/*.spec.ts",
"require": ["ts-node/register", "isomorphic-fetch"],
"loader": "ts-node/esm",
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"exit": true
}

View File

@ -0,0 +1,6 @@
{
"reporterEnabled": "spec, allure-mocha",
"allureMochaReporter": {
"outputDir": "allure-results"
}
}

View File

@ -0,0 +1,26 @@
const config = {
extension: ['ts'],
require: ['ts-node/register', 'isomorphic-fetch'],
loader: 'ts-node/esm',
'node-option': [
'experimental-specifier-resolution=node',
'loader=ts-node/esm'
],
exit: true,
retries: 4
};
if (process.env.CI) {
console.log("Running tests in parallel");
config.parallel = true;
config.jobs = 6;
console.log("Activating allure reporting");
config.reporter = 'mocha-multi-reporters';
config.reporterOptions = {
configFile: '.mocha.reporters.json'
};
} else {
console.log("Running tests serially. To enable parallel execution update mocha config");
}
module.exports = config;

View File

@ -1,13 +0,0 @@
{
"extension": ["ts"],
"require": ["ts-node/register", "isomorphic-fetch"],
"loader": "ts-node/esm",
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"exit": true,
"retries": 4,
"parallel": false,
"jobs": 6
}

View File

@ -79,6 +79,8 @@
"@waku/message-encryption": "*",
"@waku/peer-exchange": "*",
"@waku/sdk": "*",
"allure-commandline": "^2.24.1",
"allure-mocha": "^2.9.2",
"chai": "^4.3.7",
"cspell": "^7.3.2",
"datastore-core": "^9.2.3",
@ -86,6 +88,7 @@
"interface-datastore": "^8.2.5",
"libp2p": "^0.46.14",
"mocha": "^10.2.0",
"mocha-multi-reporters": "^1.5.1",
"npm-run-all": "^4.1.5"
}
}

View File

@ -24,16 +24,6 @@ async function main() {
...process.argv.slice(2)
];
// If in CI, add --parallel
if (process.env.CI) {
mochaArgs.push("--parallel");
console.log("Running tests in parallel");
} else {
console.log(
"Running tests serially. To enable parallel execution update mocha config"
);
}
// Run mocha tests
const mocha = spawn("npx", mochaArgs, {
stdio: "inherit"