-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into fix/39852
- Loading branch information
Showing
13 changed files
with
26,944 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
name: 'Validate Regression Test Output' | ||
description: 'Validates the output of regression tests and determines if a test action should fail.' | ||
inputs: | ||
DURATION_DEVIATION_PERCENTAGE: | ||
description: Allowable percentage deviation for the mean duration in regression test results. | ||
required: true | ||
runs: | ||
using: 'node20' | ||
main: './index.js' |
26,708 changes: 26,708 additions & 0 deletions
26,708
.github/actions/validateReassureOutput/index.js
Large diffs are not rendered by default.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
.github/actions/validateReassureOutput/validateReassureOutput.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* NOTE: After changes to the file it needs to be compiled using [`ncc`](https://github.com/vercel/ncc) | ||
* Example: ncc build -t validateReassureOutput.ts -o index.js | ||
*/ | ||
|
||
import * as core from '@actions/core'; | ||
import type {CompareResult, PerformanceEntry} from '@callstack/reassure-compare/src/types'; | ||
import fs from 'fs'; | ||
|
||
async function run() { | ||
try { | ||
const regressionOutput: CompareResult = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8')); | ||
const durationDeviation = Number(core.getInput('DURATION_DEVIATION_PERCENTAGE', {required: true})); | ||
|
||
if (regressionOutput.significant === undefined || regressionOutput.significant.length === 0) { | ||
console.log('No significant data available. Exiting...'); | ||
return true; | ||
} | ||
|
||
console.log(`Processing ${regressionOutput.significant.length} measurements...`); | ||
|
||
for (let i = 0; i < regressionOutput.significant.length; i++) { | ||
const measurement = regressionOutput.significant[i]; | ||
const baseline: PerformanceEntry = measurement.baseline; | ||
const current: PerformanceEntry = measurement.current; | ||
|
||
console.log(`Processing measurement ${i + 1}: ${measurement.name}`); | ||
|
||
const increasePercentage = ((current.meanDuration - baseline.meanDuration) / baseline.meanDuration) * 100; | ||
if (increasePercentage > durationDeviation) { | ||
core.setFailed(`Duration increase percentage exceeded the allowed deviation of ${durationDeviation}%. Current percentage: ${increasePercentage}%`); | ||
break; | ||
} else { | ||
console.log(`Duration increase percentage ${increasePercentage}% is within the allowed deviation range of ${durationDeviation}%.`); | ||
} | ||
} | ||
|
||
return true; | ||
} catch (error) { | ||
console.log('error: ', error); | ||
core.setFailed(error.message); | ||
} | ||
} | ||
|
||
run(); | ||
|
||
export default run; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Reassure Performance Tests | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
branches-ignore: [staging, production] | ||
paths-ignore: [tests/**, '**.md', '**.sh'] | ||
jobs: | ||
perf-tests: | ||
if: ${{ github.actor != 'OSBotify' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
|
||
- name: Set dummy git credentials | ||
run: | | ||
git config --global user.email "test@test.com" | ||
git config --global user.name "Test" | ||
- name: Run performance testing script | ||
shell: bash | ||
run: | | ||
set -e | ||
BASELINE_BRANCH=${BASELINE_BRANCH:="main"} | ||
git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1 | ||
git switch "$BASELINE_BRANCH" | ||
npm install --force | ||
npm install reassure | ||
npx reassure --baseline | ||
git switch --force --detach - | ||
npm install --force | ||
npm install reassure | ||
npx reassure --branch | ||
- name: Validate output.json | ||
id: validateReassureOutput | ||
uses: ./.github/actions/validateReassureOutput | ||
with: | ||
DURATION_DEVIATION_PERCENTAGE: 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,9 @@ dist/ | |
# Published package | ||
*.tgz | ||
|
||
# Yalc | ||
.yalc | ||
yalc.lock | ||
|
||
# Perf tests | ||
.reassure | ||
.reassure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.