From 3945b9da6c1d04516ecd0d8240c147d37b025157 Mon Sep 17 00:00:00 2001 From: bryanhuhta Date: Mon, 6 Apr 2026 15:54:52 -0700 Subject: [PATCH 1/2] Create integration test --- .github/workflows/integration.yml | 46 +++++++++++++++++++++++++++++++ smoke/Dockerfile | 22 +++++++++++++++ smoke/app.mjs | 26 +++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 .github/workflows/integration.yml create mode 100644 smoke/Dockerfile create mode 100644 smoke/app.mjs diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 00000000..1b40553b --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,46 @@ +name: Integration + +on: + push: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'LICENSE' + - '.editorconfig' + branches: + - main + pull_request: + paths-ignore: + - 'docs/**' + - 'README.md' + - 'LICENSE' + - '.editorconfig' + branches: + - main + +permissions: + contents: read + +jobs: + smoke: + runs-on: ubuntu-x64-small + strategy: + fail-fast: false + matrix: + node: [20, 22, 24, 25] + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: 'false' + + - name: Set node version in Dockerfile + run: sed -i 's/^ARG NODE_VERSION=.*/ARG NODE_VERSION=${{ matrix.node }}/' smoke/Dockerfile + + - uses: grafana/pyroscope-sdk-smoke-action@main + with: + dockerfile: smoke/Dockerfile + service-name: smoke + search-term: smokeWork + profile-type: process_cpu:wall:nanoseconds:wall:nanoseconds + timeout-seconds: '90' diff --git a/smoke/Dockerfile b/smoke/Dockerfile new file mode 100644 index 00000000..28b0ad3d --- /dev/null +++ b/smoke/Dockerfile @@ -0,0 +1,22 @@ +ARG NODE_VERSION=lts +FROM node:${NODE_VERSION}-alpine + +RUN apk add --no-cache python3 make g++ + +WORKDIR /sdk + +COPY package.json yarn.lock .yarnrc.yml ./ +RUN corepack enable && yarn install --immutable + +COPY tsconfig.json ./ +COPY config/ ./config/ +COPY src/ ./src/ +COPY tools/ ./tools/ +RUN yarn build && yarn pack --out /tmp/pyroscope-nodejs.tgz + +WORKDIR /app +RUN npm init -y && npm install /tmp/pyroscope-nodejs.tgz + +COPY smoke/app.mjs ./ + +CMD ["node", "app.mjs"] diff --git a/smoke/app.mjs b/smoke/app.mjs new file mode 100644 index 00000000..76d0845a --- /dev/null +++ b/smoke/app.mjs @@ -0,0 +1,26 @@ +import { init, start } from '@pyroscope/nodejs'; + +function smokeWork(n) { + const primes = []; + let candidate = 2; + while (primes.length < n) { + const isPrime = !primes.some((p) => candidate % p === 0); + if (isPrime) primes.push(candidate); + candidate++; + } + return primes; +} + +const N = 10_000_000; + +init({ + serverAddress: process.env.PYROSCOPE_SERVER_ADDRESS, + appName: 'smoke', + flushIntervalMs: 5000, + wall: { + samplingDurationMs: 5000, + }, +}); +start(); + +smokeWork(N); From 16227c92b58e1541ca16b989c1789a93132cb414 Mon Sep 17 00:00:00 2001 From: bryanhuhta Date: Mon, 6 Apr 2026 16:04:54 -0700 Subject: [PATCH 2/2] Checkout internal repo action --- .github/workflows/integration.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 1b40553b..32dfee11 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -34,10 +34,16 @@ jobs: with: persist-credentials: 'false' + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + repository: grafana/pyroscope-sdk-smoke-action + path: .github/actions/pyroscope-sdk-smoke-action + persist-credentials: 'false' + - name: Set node version in Dockerfile run: sed -i 's/^ARG NODE_VERSION=.*/ARG NODE_VERSION=${{ matrix.node }}/' smoke/Dockerfile - - uses: grafana/pyroscope-sdk-smoke-action@main + - uses: ./.github/actions/pyroscope-sdk-smoke-action with: dockerfile: smoke/Dockerfile service-name: smoke