From 47e1b2fec2811df377f361130019258217446b04 Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Thu, 31 Aug 2023 15:34:23 -0700 Subject: [PATCH 1/7] add workflow for testing --- .github/workflows/benchmark.yml | 59 +++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/benchmark.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000000..08a20d714d --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,59 @@ +name: Benchmark Tests + +on: workflow_dispatch + +jobs: + node-tests: + strategy: + fail-fast: false + matrix: + node_version: + # - "14" + # - "16" + - "18" + runs-on: ubuntu-latest + env: + NPM_CONFIG_UNSAFE_PERM: true + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node_version }} + + - run: npm install -g npm@latest + + - name: restore lerna + id: cache + uses: actions/cache@v3 + with: + path: | + node_modules + package-lock.json + packages/*/node_modules + packages/*/package-lock.json + experimental/packages/*/node_modules + experimental/packages/*/package-lock.json + key: node-tests-${{ runner.os }}-${{ matrix.node_version }}-${{ hashFiles('package.json', 'packages/*/package.json', 'experimental/packages/*/package.json') }}-04292022 + + - name: Bootstrap + run: | + npm install --ignore-scripts + npx lerna bootstrap --no-ci --hoist --nohoist='zone.js' --ignore @opentelemetry/selenium-tests + + - name: Build 🔧 + run: | + npm run compile + + - name: Benchmark tests + run: | + npm run test:bench + + - name: Store benchmark results + uses: benchmark-action/github-action-benchmark@v1 + with: + tool: 'benchmarkjs' + output-file-path: benchmarks.txt + github-token: ${{ secrets.GITHUB_TOKEN }} + auto-push: true From 5bfe923414c44d3e5093ffe1d945a378fd62108b Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Wed, 13 Sep 2023 15:24:58 -0700 Subject: [PATCH 2/7] combine multiple results, run on self-hosted runner --- .github/workflows/benchmark.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 08a20d714d..523e17ff88 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -8,10 +8,8 @@ jobs: fail-fast: false matrix: node_version: - # - "14" - # - "16" - "18" - runs-on: ubuntu-latest + runs-on: self-hosted env: NPM_CONFIG_UNSAFE_PERM: true steps: @@ -48,12 +46,15 @@ jobs: - name: Benchmark tests run: | - npm run test:bench + npm run test:bench + find . -name benchmarks.txt -exec cat {} + > combined_benchmarks.txt - name: Store benchmark results uses: benchmark-action/github-action-benchmark@v1 with: tool: 'benchmarkjs' - output-file-path: benchmarks.txt + output-file-path: combined_benchmarks.txt + gh-pages-branch: benchmarks github-token: ${{ secrets.GITHUB_TOKEN }} + benchmark-data-dir-path: "docs/benchmarks/loadtests" auto-push: true From 408fd98aae9cb97869de0b1e49beadb5d10842a8 Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Wed, 13 Sep 2023 16:01:55 -0700 Subject: [PATCH 3/7] trigger on release --- .github/workflows/benchmark.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 523e17ff88..a1cb452f1d 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -1,6 +1,8 @@ name: Benchmark Tests -on: workflow_dispatch +on: + release: + types: [published] jobs: node-tests: From 0a5cac28080aa510f4e416c49d94e225ca894364 Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Tue, 26 Sep 2023 17:49:32 -0700 Subject: [PATCH 4/7] added timeout --- .github/workflows/benchmark.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index a1cb452f1d..8558f1e66f 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -5,13 +5,14 @@ on: types: [published] jobs: - node-tests: + benchmark-tests: strategy: fail-fast: false matrix: node_version: - "18" runs-on: self-hosted + timeout-minutes: 10 env: NPM_CONFIG_UNSAFE_PERM: true steps: From c7f1a5d96e9c93df02eaa3388fe9277235ec1012 Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Tue, 26 Sep 2023 17:52:55 -0700 Subject: [PATCH 5/7] updated pages branch and path --- .github/workflows/benchmark.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 8558f1e66f..66eaece6bb 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -57,7 +57,7 @@ jobs: with: tool: 'benchmarkjs' output-file-path: combined_benchmarks.txt - gh-pages-branch: benchmarks + gh-pages-branch: gh-pages github-token: ${{ secrets.GITHUB_TOKEN }} - benchmark-data-dir-path: "docs/benchmarks/loadtests" + benchmark-data-dir-path: "benchmarks" auto-push: true From b77afb97f040e42489ec02d359fa30371c950656 Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Tue, 26 Sep 2023 18:02:01 -0700 Subject: [PATCH 6/7] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad5c780983..a7e1917b11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/ ### :house: (Internal) * test: added a performance benchmark test for span creation [#4105](https://github.com/open-telemetry/opentelemetry-js/pull/4105) +* test: added a workflow to run performance benchmark tests automatically [#4144](https://github.com/open-telemetry/opentelemetry-js/pull/4144) ## 1.17.0 From 2f48f12b3e37b92c4390afc20ae958bb8fda0108 Mon Sep 17 00:00:00 2001 From: Martin Kuba Date: Thu, 28 Sep 2023 08:24:12 -0700 Subject: [PATCH 7/7] updated workflow to run on push to main --- .github/workflows/benchmark.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 66eaece6bb..ea05c89e73 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -1,8 +1,8 @@ name: Benchmark Tests on: - release: - types: [published] + push: + branches: [ main ] jobs: benchmark-tests: