Skip to content

v2.45.0

v2.45.0 #6152

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests
name: Continuous Integration
on: push
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
version: [14, 16, 18, 20]
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
- run: yarn install --immutable
- run: yarn build
- name: Run yarn lint:ci
run: |
if ! yarn lint:ci ; then
echo "ESLint failed with the following errors:"
jq '.runs[].results' sarif-datadog-ci.sarif
echo ""
echo "Find the full SARIF report in the Artifacts section here: https://github.com/DataDog/datadog-ci/actions/runs/${{ github.run_id }}"
echo "You can fix this by running ==> yarn format <=="
echo ""
exit 1
fi
- run: yarn no-only-in-tests
- run: yarn test
env:
CI: true
DD_SERVICE: datadog-ci-tests
DD_CIVISIBILITY_AGENTLESS_ENABLED: 1
DD_API_KEY: ${{ secrets.DATADOG_API_KEY_MAIN_ACCOUNT }}
DD_APP_KEY: ${{ secrets.DATADOG_APP_KEY_MAIN_ACCOUNT }}
DD_ENV: ci
NODE_OPTIONS: -r dd-trace/ci/init
- run: mkdir artifacts
- run: yarn pack --filename artifacts/datadog-ci-${{ matrix.version }}.tgz
- run: cp -r .github/workflows/e2e artifacts/
- uses: actions/upload-artifact@v4
with:
name: artifacts-${{ matrix.version }}
path: artifacts/
- uses: actions/upload-artifact@v4
if: always()
with:
name: sarif-datadog-ci-${{ matrix.version }}.sarif
path: sarif-datadog-ci.sarif
if-no-files-found: error
e2e-test:
strategy:
matrix:
version: [14, 16, 18, 20]
name: End-to-end test the package
runs-on: ubuntu-latest
needs: build-and-test
env:
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
- uses: actions/download-artifact@v4
with:
name: artifacts-${{ matrix.version }}
path: artifacts/
- run: yarn add ./artifacts/datadog-ci-${{ matrix.version }}.tgz
- name: Run synthetics test
run: yarn datadog-ci synthetics run-tests --config artifacts/e2e/global.config.json
env:
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
- name: Run sourcemaps upload test
run: yarn datadog-ci sourcemaps upload artifacts/e2e/sourcemaps/ --release-version=e2e --service=e2e-tests --minified-path-prefix=https://e2e-tests.datadoghq.com/static/
env:
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
- name: Run junit upload test (measures)
run: yarn datadog-ci junit upload --service=datadog-ci-e2e-tests-junit **/junit-reports/**/*.xml --measures testmeasure1:20 --report-measures sessionmeasure1:40
env:
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
- name: Check that test data can be queried (measures)
run: |
yarn add @datadog/datadog-api-client
yarn check-junit-upload
env:
EXTRA_TEST_QUERY_FILTER: '@testmeasure1:20'
EXTRA_SESSION_QUERY_FILTER: '@sessionmeasure1:40'
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
DD_SERVICE: datadog-ci-e2e-tests-junit
- name: Run junit upload test (metrics), passing glob as literal string
run: yarn datadog-ci junit upload --service=datadog-ci-e2e-tests-junit '**/junit-reports/**' --metrics testmeasure2:60 --report-metrics sessionmeasure2:80
env:
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
- name: Check that test data can be queried (metrics)
run: |
yarn add @datadog/datadog-api-client
yarn check-junit-upload
env:
EXTRA_TEST_QUERY_FILTER: '@testmeasure2:60'
EXTRA_SESSION_QUERY_FILTER: '@sessionmeasure2:80'
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
DD_SERVICE: datadog-ci-e2e-tests-junit
- name: Run sarif upload test
run: yarn datadog-ci sarif upload --service=datadog-ci-e2e-tests-sarif artifacts/e2e/sarif-reports
env:
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
- name: Run sbom upload test
run: yarn datadog-ci sbom upload --service=datadog-ci-e2e-tests-sbom --env test artifacts/e2e/sbom-reports/sbom.json
env:
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
standalone-binary-test-ubuntu:
name: Test standalone binary in ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20.11.0 # Use newer version to build the standalone binary
- run: yarn install --immutable
- run: yarn build
- name: Create standalone binary
run: yarn dist-standalone -t node14-linux-x64 -o datadog-ci_linux-x64
- name: Remove dist and src folder to check that binary can stand alone
run: |
rm -rf dist
rm -rf src
- name: Test generated standalone binary
run: yarn dist-standalone:test
standalone-binary-test-ubuntu-arm:
name: Test standalone binary in ARM ubuntu
runs-on:
group: ARM LINUX SHARED
labels: arm-4core-linux
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20.11.0 # Use newer version to build the standalone binary
- run: npm install -g yarn
name: Install Yarn # Yarn is not installed by default in this runner
- run: yarn install --immutable
- run: yarn build
- name: Create standalone binary
run: yarn dist-standalone -t node14-linux-arm64 -o datadog-ci_linux-arm64
- name: Remove dist and src folder to check that binary can stand alone
run: |
rm -rf dist
rm -rf src
- name: Test generated standalone binary
run: yarn dist-standalone:test
standalone-binary-test-windows:
name: Test standalone binary in windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20.11.0 # Use newer version to build the standalone binary
- run: yarn install --immutable
- run: yarn build:win
- name: Create standalone binary
run: yarn dist-standalone -t node14-win-x64 -o datadog-ci_win-x64
- name: Remove dist and src folder to check that binary can stand alone
run: |
rm dist -r
rm src -r
- name: Test generated standalone binary
run: yarn dist-standalone:test
standalone-binary-test-macos:
name: Test standalone binary in macOS
# `macos-latest-large` is an x64 image, and we need it to run the standalone tests
# https://github.com/actions/runner-images#available-images
runs-on: macos-latest-large
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20.11.0 # Use newer version to build the standalone binary
- run: yarn install --immutable
- run: yarn build
- name: Create standalone binary
run: yarn dist-standalone -t node14-macos-x64 -o datadog-ci_darwin-x64
- name: Remove dist and src folder to check that binary can stand alone
run: |
rm -rf dist
rm -rf src
- name: Test generated standalone binary
run: yarn dist-standalone:test
standalone-binary-test-macos-arm:
name: Test standalone binary in ARM macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 20.11.0 # Use newer version to build the standalone binary
- run: yarn install --immutable
- run: yarn build
- name: Create standalone binary
run: yarn dist-standalone -t node14-macos-arm64 -o datadog-ci_darwin-arm64
- name: Remove dist and src folder to check that binary can stand alone
run: |
rm -rf dist
rm -rf src
- name: Test generated standalone binary
run: yarn dist-standalone:test
datadog-static-analyzer:
runs-on: ubuntu-latest
name: Static Analyzer - Diff Aware
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Datadog static analyzer
id: datadog-static-analysis
uses: DataDog/datadog-static-analyzer-github-action@main
with:
dd_app_key: ${{ secrets.DATADOG_APP_KEY_MAIN_ACCOUNT }}
dd_api_key: ${{ secrets.DATADOG_API_KEY_MAIN_ACCOUNT }}
dd_service: 'datadog-ci'
dd_env: 'ci'
cpu_count: 2
diff_aware: true
datadog-static-analyzer-non-diff-aware:
runs-on: ubuntu-latest
name: Static Analyzer - Non Diff Aware
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Datadog static analyzer
id: datadog-static-analysis
uses: DataDog/datadog-static-analyzer-github-action@main
with:
dd_app_key: ${{ secrets.DATADOG_APP_KEY_MAIN_ACCOUNT }}
dd_api_key: ${{ secrets.DATADOG_API_KEY_MAIN_ACCOUNT }}
dd_service: 'datadog-ci'
dd_env: 'ci-no-da'
cpu_count: 2
diff_aware: false
check-licenses:
name: Check licenses
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 14.18.3
# The install step has been added here such that the `.yarn/install-state.gz` file is generated. This file is used
# by the script `check-licenses` below.
- run: yarn install --immutable
- run: yarn check-licenses