Skip to content

[refactor] Metrics plugin #998

[refactor] Metrics plugin

[refactor] Metrics plugin #998

Workflow file for this run

name: Continuous Integration
on: pull_request
jobs:
unit-test:
name: Unit tests
runs-on: ubuntu-latest
env:
FORCE_COLOR: true
steps:
- uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Cache build:all
id: cache-build
uses: actions/cache@v4
with:
path: packages/published/**/dist
key: ${{ matrix.node }}-cache-build-${{ hashFiles('packages/core/**', 'packages/factory/**', 'packages/plugins/**', 'packages/published/**', 'packages/tools/src/rollupConfig.mjs', 'yarn.lock') }}
- name: Configure Datadog Test Optimization
uses: datadog/test-visibility-github-action@v2
with:
languages: js
service: build-plugins-unit
api_key: ${{secrets.DATADOG_API_KEY}}
site: datadoghq.com
- run: yarn install
- name: Build all plugins
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build:all # We need the full build because one of the test verifies that we do produce the *.d.ts files.
- run: yarn test:unit --silent
env:
NODE_OPTIONS: -r ${{env.DD_TRACE_PACKAGE}}
e2e:
timeout-minutes: 10
name: End to End
runs-on: ubuntu-latest
env:
FORCE_COLOR: true
steps:
- uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Cache build:all
id: cache-build
uses: actions/cache@v4
with:
path: packages/published/**/dist
key: node18-cache-build-${{ hashFiles('packages/core/**', 'packages/factory/**', 'packages/plugins/**', 'packages/published/**', 'packages/tools/src/rollupConfig.mjs', 'yarn.lock') }}
- name: Cache playwright binaries
id: cache-playwright-binaries
uses: actions/cache@v4
with:
path: |
~/.cache/ms-playwright
~/Library/Caches/ms-playwright
%USERPROFILE%\AppData\Local\ms-playwright
key: cache-playwright-binaries-${{ hashFiles('yarn.lock') }}
- name: Configure Datadog Test Optimization
uses: datadog/test-visibility-github-action@v2
with:
languages: js
service: build-plugins-e2e
api_key: ${{secrets.DATADOG_API_KEY}}
site: datadoghq.com
- run: yarn install
- name: Install playwright
run: yarn workspace @dd/tests playwright install --with-deps
- name: Build all plugins
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build:all-no-types
- run: yarn test:e2e
env:
NODE_OPTIONS: -r ${{env.DD_TRACE_PACKAGE}}
- name: Save playwright cache
if: always() && steps.cache-playwright-binaries.outputs.cache-hit != 'true'
id: save-playwright-cache
uses: actions/cache/save@v4
with:
path: |
~/.cache/ms-playwright
~/Library/Caches/ms-playwright
%USERPROFILE%\AppData\Local\ms-playwright
key: cache-playwright-binaries-${{ hashFiles('yarn.lock') }}
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: playwright
path: |
packages/tests/playwright-report
packages/tests/test-results
retention-days: 3
lint:
name: Linting
runs-on: ubuntu-latest
env:
FORCE_COLOR: true
steps:
- uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Cache build:rollup
id: cache-build-rollup
uses: actions/cache@v4
with:
path: packages/published/rollup-plugin/dist-basic
key: node18-cache-build-rollup-${{ hashFiles('packages/core/**', 'packages/factory/**', 'packages/plugins/**', 'packages/published/**', 'packages/tools/src/rollupConfig.mjs', 'yarn.lock') }}
- name: Cache build:all
id: cache-build
uses: actions/cache@v4
with:
path: packages/published/**/dist
key: node18-cache-build-${{ hashFiles('packages/core/**', 'packages/factory/**', 'packages/plugins/**', 'packages/published/**', 'packages/tools/src/rollupConfig.mjs', 'yarn.lock') }}
- run: yarn install
# Pre build the rollup plugin so it can be used in the following step.
- name: Build rollup's plugin
if: steps.cache-build-rollup.outputs.cache-hit != 'true'
run: yarn workspace @datadog/rollup-plugin run buildBasic
- name: Build all plugins
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build:all-no-types
env:
ADD_BUILD_PLUGINS: 1
DD_GITHUB_JOB_NAME: Linting # Needs to be the same as the job to have CI Vis link the spans.
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
- run: yarn cli integrity
- run: git diff --exit-code && git diff --cached --exit-code || (echo "Please run 'yarn cli integrity' and commit the result." && exit 1)