diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 00000000..32dfee11 --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,52 @@ +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' + + - 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: ./.github/actions/pyroscope-sdk-smoke-action + 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);