diff --git a/.github/workflows/performance-test-inband.yml b/.github/workflows/performance-test-inband.yml deleted file mode 100644 index bbdc498..0000000 --- a/.github/workflows/performance-test-inband.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Extraction algorithm Benchmark.js -on: - push: - branches: - - fix-perf - -permissions: - contents: write - deployments: write - -jobs: - benchmark: - name: Run JavaScript benchmark example - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: '20.x' - - run: npm ci - - run: npm run build --if-present - - run: node ./perf/perftest-inband.js | tee output.txt - - - name: Store benchmark result - uses: benchmark-action/github-action-benchmark@v1 - with: - name: Extraction algorithm Benchmark for inband data - tool: 'benchmarkjs' - output-file-path: output.txt - github-token: ${{ secrets.GITHUB_TOKEN }} - benchmark-data-dir-path: docs/ - auto-push: true - # Show alert with commit comment on detecting possible performance regression - alert-threshold: '200%' - comment-on-alert: true - fail-on-alert: true - alert-comment-cc-users: '@xdxxxdx' diff --git a/.github/workflows/performance-test-outband.yml b/.github/workflows/performance-test-outband.yml deleted file mode 100644 index 72d7f78..0000000 --- a/.github/workflows/performance-test-outband.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Extraction algorithm Benchmark.js -on: - push: - branches: - - fix-perf - -permissions: - contents: write - deployments: write - -jobs: - benchmark: - name: Run JavaScript benchmark example - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: '20.x' - - run: npm ci - - run: npm run build --if-present - - run: npm run data - - run: node ./perf/perftest-inband.js | tee output.txt - - # - name: Store benchmark result - # uses: benchmark-action/github-action-benchmark@v1 - # with: - # name: Extraction algorithm Benchmark for outband data - # tool: 'benchmarkjs' - # output-file-path: output.txt - # github-token: ${{ secrets.GITHUB_TOKEN }} - # benchmark-data-dir-path: docs/ - # auto-push: true - # # Show alert with commit comment on detecting possible performance regression - # alert-threshold: '200%' - # comment-on-alert: true - # fail-on-alert: true - # alert-comment-cc-users: '@xdxxxdx' diff --git a/.github/workflows/performance-test.yml b/.github/workflows/performance-test.yml new file mode 100644 index 0000000..c1dde7d --- /dev/null +++ b/.github/workflows/performance-test.yml @@ -0,0 +1,94 @@ +name: Benchmark for extraction algorithm +on: + push: + branches: + - fix-perf + +permissions: + contents: write + deployments: write + +jobs: + benchmark-inband: + name: Benchmark for extraction algorithm (inband) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '20.x' + - run: npm ci + - run: npm run build --if-present + - run: node ./perf/perftest-inband.js | tee output.txt + + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1 + with: + name: Extraction algorithm Benchmark for inband data + tool: 'benchmarkjs' + output-file-path: output.txt + github-token: ${{ secrets.GITHUB_TOKEN }} + benchmark-data-dir-path: docs/ + auto-push: true + # Show alert with commit comment on detecting possible performance regression + alert-threshold: '200%' + comment-on-alert: true + fail-on-alert: true + alert-comment-cc-users: '@xdxxxdx' + + + benchmark-outband: + name: Benchmark for extraction algorithm (outband) + runs-on: ubuntu-latest + #run in sequence after benchmark-inband` + needs: benchmark-inband + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: '20.x' + + - name: Build npm + run: | + npm ci + npm run build --if-present + + - name: Publish data + run: | + npm run data & + disown # Run npm run data in the background and disown the process + + - name: Verify server + run: | + response_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8080/member-1.ttl) + + if [ "$response_code" -eq 200 ]; then + echo "Server verification successful (HTTP 200)" + else + echo "Server verification failed with HTTP $response_code" + exit 1 # Exit the script with an error code + fi + - name: Run Benchmark + run: | + node ./perf/perftest-outband.js | tee output.txt + + - name: Store benchmark result + uses: benchmark-action/github-action-benchmark@v1 + with: + name: Extraction algorithm Benchmark for outband data + tool: 'benchmarkjs' + output-file-path: output.txt + github-token: ${{ secrets.GITHUB_TOKEN }} + benchmark-data-dir-path: docs/ + auto-push: true + # Show alert with commit comment on detecting possible performance regression + alert-threshold: '200%' + comment-on-alert: true + fail-on-alert: true + alert-comment-cc-users: '@xdxxxdx' + + diff --git a/perf/perftest-outband.js b/perf/perftest-outband.js index 992ef64..05efd1c 100644 --- a/perf/perftest-outband.js +++ b/perf/perftest-outband.js @@ -172,7 +172,11 @@ let main = async function () { }, 25000); // Set the timeout for this specific benchmark }) - + //add listeners + .on('cycle', function(event) { + console.log(String(event.target)); + }) + //add listeners .on("complete", function () { const results = this.map((test) => { return {