Skip to content

Support windows platforms #11511

Support windows platforms

Support windows platforms #11511

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
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
# Run on every commit of any branch, and not on tags
branches:
- '**'
tags-ignore:
- '**'
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
version: [20, 22, 24]
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ matrix.version }}
- run: yarn install --immutable
- run: yarn lint:packages
- run: yarn lint:readme-usage
- 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 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
yarn loop-packages pack --out ../../artifacts/%s-${{ matrix.version }}.tgz
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: artifacts-${{ matrix.version }}
path: artifacts/
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: always()
with:
name: sarif-datadog-ci-${{ matrix.version }}.sarif
path: sarif-datadog-ci.sarif
if-no-files-found: error
unit-tests-windows:
strategy:
fail-fast: false
matrix:
version: [20, 22, 24]
name: Unit tests (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ matrix.version }}
- run: yarn install --immutable
- run: yarn build
- run: yarn test:windows
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
e2e-test:
strategy:
matrix:
version: [20, 22, 24]
name: End-to-end test the package
runs-on: ubuntu-latest
needs:
- build-and-test
- check-container-app-changes
- check-aas-changes
- check-cloud-run-changes
- check-version-bump-only
- check-lambda-changes
permissions:
contents: read
id-token: write
env:
FORCE_COLOR: 1
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
sparse-checkout: |
e2e/
jest.config-e2e.js
sparse-checkout-cone-mode: false
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ matrix.version }}
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: artifacts-${{ matrix.version }}
path: artifacts/
# Force all dependencies to be installed from the artifacts
- name: Create e2e project
run: |
echo '{
"name": "datadog-ci-e2e-tests",
"resolutions": {
"@datadog/datadog-ci-plugin-coverage": "file:./artifacts/@datadog-datadog-ci-plugin-coverage-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-deployment": "file:./artifacts/@datadog-datadog-ci-plugin-deployment-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-dora": "file:./artifacts/@datadog-datadog-ci-plugin-dora-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-gate": "file:./artifacts/@datadog-datadog-ci-plugin-gate-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-junit": "file:./artifacts/@datadog-datadog-ci-plugin-junit-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-sarif": "file:./artifacts/@datadog-datadog-ci-plugin-sarif-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-sbom": "file:./artifacts/@datadog-datadog-ci-plugin-sbom-${{ matrix.version }}.tgz"
},
"dependencies": {
"@datadog/datadog-ci": "./artifacts/@datadog-datadog-ci-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-aas": "./artifacts/@datadog-datadog-ci-plugin-aas-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-cloud-run": "./artifacts/@datadog-datadog-ci-plugin-cloud-run-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-container-app": "./artifacts/@datadog-datadog-ci-plugin-container-app-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-ecs-fargate": "./artifacts/@datadog-datadog-ci-plugin-ecs-fargate-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-lambda": "./artifacts/@datadog-datadog-ci-plugin-lambda-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-stepfunctions": "./artifacts/@datadog-datadog-ci-plugin-stepfunctions-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-synthetics": "./artifacts/@datadog-datadog-ci-plugin-synthetics-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-terraform": "./artifacts/@datadog-datadog-ci-plugin-terraform-${{ matrix.version }}.tgz",
"@types/jest": "29.5.14",
"jest": "29.6.2",
"ts-jest": "29.1.1",
"typescript": "5.1.6",
"@datadog/datadog-api-client": "^1.0.0"
}
}' > package.json
yarn set version stable
yarn config set nodeLinker node-modules
yarn install --no-immutable
- name: Azure login (OIDC)
if: (needs.check-container-app-changes.outputs.should_run == 'true' || needs.check-aas-changes.outputs.should_run == 'true') && matrix.version == 24
uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3
with:
client-id: ${{ vars.AZURE_CLIENT_ID_E2E }}
tenant-id: ${{ vars.AZURE_TENANT_ID_E2E }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID_E2E }}
- name: Google Cloud auth (OIDC)
if: needs.check-cloud-run-changes.outputs.should_run == 'true' && matrix.version == 24
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
with:
workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER_E2E }}
service_account: ${{ vars.GCP_SERVICE_ACCOUNT_E2E }}
- name: Set up Google Cloud CLI
if: needs.check-cloud-run-changes.outputs.should_run == 'true' && matrix.version == 24
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3.0.1
- name: Configure AWS credentials (OIDC)
if: needs.check-lambda-changes.outputs.should_run == 'true' && matrix.version == 24
uses: aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4.3.1
with:
role-to-assume: ${{ vars.AWS_ROLE_ARN_E2E }}
aws-region: eu-central-1
- name: Run e2e tests
run: yarn jest --config jest.config-e2e.js --colors
env:
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
GITHUB_SHA: ${{ github.sha }}
SKIP_CONTAINER_APP_TESTS: ${{ matrix.version != 24 || needs.check-container-app-changes.outputs.should_run != 'true' || needs.check-version-bump-only.outputs.result == 'true' }}
SKIP_AAS_TESTS: ${{ matrix.version != 24 || needs.check-aas-changes.outputs.should_run != 'true' || needs.check-version-bump-only.outputs.result == 'true' }}
SKIP_CLOUD_RUN_TESTS: ${{ matrix.version != 24 || needs.check-cloud-run-changes.outputs.should_run != 'true' || needs.check-version-bump-only.outputs.result == 'true' }}
SKIP_LAMBDA_TESTS: ${{ matrix.version != 24 || needs.check-lambda-changes.outputs.should_run != 'true' }}
GCP_PROJECT_ID: ${{ vars.GCP_PROJECT_ID_E2E }}
GCP_REGION: ${{ vars.GCP_REGION_E2E }}
GCP_CLOUD_RUN_APP_IMAGE_E2E: ${{ vars.GCP_CLOUD_RUN_APP_IMAGE_E2E }}
AZURE_SUBSCRIPTION_ID: ${{ vars.AZURE_SUBSCRIPTION_ID_E2E }}
AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP_E2E }}
AZURE_CONTAINER_APP_ENV: ${{ vars.AZURE_CONTAINER_APP_ENV_E2E }}
AZURE_CONTAINER_APP_IMAGE_E2E: ${{ vars.AZURE_CONTAINER_APP_IMAGE_E2E }}
AZURE_AAS_LINUX_PLAN: ${{ vars.AZURE_AAS_LINUX_PLAN_E2E }}
AZURE_AAS_WINDOWS_PLAN: ${{ vars.AZURE_AAS_WINDOWS_PLAN_E2E }}
AWS_REGION: eu-central-1
AWS_LAMBDA_EXECUTION_ROLE_ARN: ${{ vars.AWS_LAMBDA_EXECUTION_ROLE_ARN_E2E }}
check-container-app-changes:
name: Check container-app changes
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.filter.outputs.container-app }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
# Full history for all branches is needed so `dorny/paths-filter` can compute the merge-base locally
# without re-fetching the head branch by name, which fails for throwaway `*--headless-tmp-*` branches
# when they are deleted just before `dorny/paths-filter`, making the job flaky.
#
# This happens on ADMS PRs for dependency bumps, which uses: https://github.com/DataDog/commit-headless/blob/5bcf62a22b222221c0d01ce11f6129a7c48ddd9d/github.go#L208-L209
fetch-depth: 0
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4
id: filter
with:
filters: |
container-app:
- 'packages/plugin-container-app/**'
- 'packages/base/package.json'
- 'packages/base/src/helpers/serverless/azure.ts'
- 'packages/base/src/helpers/serverless/common.ts'
- 'packages/base/src/helpers/serverless/constants.ts'
- 'packages/base/src/helpers/serverless/source-code-integration.ts'
- 'e2e/serverless/container-app/**'
- 'e2e/serverless/helpers/**'
- '.github/workflows/ci.yml'
check-cloud-run-changes:
name: Check cloud-run changes
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.filter.outputs.cloud-run }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
# See comment on check-container-app-changes for why `fetch-depth: 0` is needed.
fetch-depth: 0
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4
id: filter
with:
filters: |
cloud-run:
- 'packages/plugin-cloud-run/**'
- 'packages/base/package.json'
- 'packages/base/src/commands/cloud-run/**'
- 'packages/base/src/helpers/serverless/common.ts'
- 'packages/base/src/helpers/serverless/constants.ts'
- 'packages/base/src/helpers/serverless/source-code-integration.ts'
- 'e2e/serverless/cloud-run/**'
- 'e2e/serverless/helpers/**'
- '.github/workflows/ci.yml'
check-aas-changes:
name: Check aas changes
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.filter.outputs.aas }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
# See comment on check-container-app-changes for why `fetch-depth: 0` is needed.
fetch-depth: 0
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4
id: filter
with:
filters: |
aas:
- 'packages/plugin-aas/**'
- 'packages/base/package.json'
- 'packages/base/src/helpers/serverless/azure.ts'
- 'packages/base/src/helpers/serverless/common.ts'
- 'packages/base/src/helpers/serverless/constants.ts'
- 'packages/base/src/helpers/serverless/source-code-integration.ts'
- 'packages/base/src/commands/aas/**'
- 'e2e/serverless/aas/**'
- 'e2e/serverless/helpers/**'
- '.github/workflows/ci.yml'
check-lambda-changes:
name: Check lambda changes
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.filter.outputs.lambda }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
# See comment on check-container-app-changes for why `fetch-depth: 0` is needed.
fetch-depth: 0
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4
id: filter
with:
filters: |
lambda:
- 'packages/plugin-lambda/**'
- 'packages/base/package.json'
- 'packages/base/src/commands/lambda/**'
- 'packages/base/src/helpers/serverless/**'
- 'packages/base/src/helpers/tags.ts'
- 'e2e/serverless/lambda/**'
- 'e2e/serverless/helpers/**'
- 'jest.config-e2e.js'
- '.github/workflows/ci.yml'
check-version-bump-only:
name: Check if only version fields changed
runs-on: ubuntu-latest
outputs:
result: ${{ steps.check.outputs.result }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 2
- name: Detect version-bump-only commit
id: check
run: |
non_json=$(git diff --name-only HEAD^ HEAD | grep -v 'package\.json' || true)
if [ -n "$non_json" ]; then
echo "result=false" >> $GITHUB_OUTPUT
exit 0
fi
leftover=$(git diff HEAD^ HEAD \
| grep '^[+-]' \
| grep -v '^+++\|^---' \
| grep -vE '^[+-]\s*"version":\s*"[0-9]+\.[0-9]+\.[0-9]+"' \
| grep -v '^$' || true)
[ -z "$leftover" ] \
&& echo "result=true" >> $GITHUB_OUTPUT \
|| echo "result=false" >> $GITHUB_OUTPUT
e2e-test-windows:
strategy:
matrix:
version: [20, 22, 24]
name: End-to-end test the package (Windows)
runs-on: windows-latest
needs: build-and-test
env:
FORCE_COLOR: 1
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
sparse-checkout: |
e2e/
jest.config-e2e.js
sparse-checkout-cone-mode: false
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ matrix.version }}
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: artifacts-${{ matrix.version }}
path: artifacts/
# Force all dependencies to be installed from the artifacts
- name: Create e2e project (Windows)
run: |
echo '{
"name": "datadog-ci-e2e-tests",
"resolutions": {
"@datadog/datadog-ci-plugin-coverage": "file:./artifacts/@datadog-datadog-ci-plugin-coverage-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-deployment": "file:./artifacts/@datadog-datadog-ci-plugin-deployment-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-dora": "file:./artifacts/@datadog-datadog-ci-plugin-dora-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-gate": "file:./artifacts/@datadog-datadog-ci-plugin-gate-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-junit": "file:./artifacts/@datadog-datadog-ci-plugin-junit-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-sarif": "file:./artifacts/@datadog-datadog-ci-plugin-sarif-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-sbom": "file:./artifacts/@datadog-datadog-ci-plugin-sbom-${{ matrix.version }}.tgz"
},
"dependencies": {
"@datadog/datadog-ci": "./artifacts/@datadog-datadog-ci-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-aas": "./artifacts/@datadog-datadog-ci-plugin-aas-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-cloud-run": "./artifacts/@datadog-datadog-ci-plugin-cloud-run-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-container-app": "./artifacts/@datadog-datadog-ci-plugin-container-app-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-ecs-fargate": "./artifacts/@datadog-datadog-ci-plugin-ecs-fargate-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-lambda": "./artifacts/@datadog-datadog-ci-plugin-lambda-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-stepfunctions": "./artifacts/@datadog-datadog-ci-plugin-stepfunctions-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-synthetics": "./artifacts/@datadog-datadog-ci-plugin-synthetics-${{ matrix.version }}.tgz",
"@datadog/datadog-ci-plugin-terraform": "./artifacts/@datadog-datadog-ci-plugin-terraform-${{ matrix.version }}.tgz",
"@types/jest": "29.5.14",
"jest": "29.6.2",
"ts-jest": "29.1.1",
"typescript": "5.1.6",
"@datadog/datadog-api-client": "^1.0.0"
}
}' > package.json
yarn set version stable
yarn config set nodeLinker node-modules
yarn install --no-immutable
- name: Run e2e tests
run: yarn jest --config jest.config-e2e.js --colors
env:
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
GITHUB_SHA: ${{ github.sha }}
SKIP_CONTAINER_APP_TESTS: 'true'
SKIP_AAS_TESTS: 'true'
SKIP_CLOUD_RUN_TESTS: 'true'
SKIP_LAMBDA_TESTS: 'true'
# We only test with a single plugin and a single Node.js version.
test-plugin-auto-install-during-npx:
name: Test plugin auto-install during npx
runs-on: ubuntu-latest
needs: build-and-test
env:
FORCE_COLOR: 1
steps:
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 20
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: artifacts-20
path: artifacts/
- name: Run AAS command with auto-install (NPX)
run: |
output=$(npx \
-p ./artifacts/@datadog-datadog-ci-20.tgz \
-p ./artifacts/@datadog-datadog-ci-plugin-coverage-20.tgz \
-p ./artifacts/@datadog-datadog-ci-plugin-deployment-20.tgz \
-p ./artifacts/@datadog-datadog-ci-plugin-dora-20.tgz \
-p ./artifacts/@datadog-datadog-ci-plugin-gate-20.tgz \
-p ./artifacts/@datadog-datadog-ci-plugin-junit-20.tgz \
-p ./artifacts/@datadog-datadog-ci-plugin-sarif-20.tgz \
-p ./artifacts/@datadog-datadog-ci-plugin-sbom-20.tgz \
datadog-ci aas instrument || true
)
if echo "$output" | grep "Successfully installed"; then
echo "AAS plugin was automatically installed"
exit 0
else
echo "AAS plugin was not automatically installed"
echo "Output: $output"
exit 1
fi
env:
DEBUG: plugins
# Needed during releases, to avoid a "No matching version found" errors
PLUGIN_INSTALL_VERSION_OVERRIDE: file:./artifacts/@datadog-datadog-ci-plugin-aas-20.tgz
# Using `npx datadog-ci` only runs the binary without fetching any package.
test-plugin-auto-install-in-project-npm:
name: Test plugin auto-install in existing project (NPM)
runs-on: ubuntu-latest
needs: build-and-test
env:
FORCE_COLOR: 1
steps:
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 20
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: artifacts-20
path: artifacts/
- name: Create test project (NPM)
run: |
echo '{
"name": "datadog-ci-plugin-auto-install-npm",
"overrides": {
"@datadog/datadog-ci-plugin-coverage": "file:./artifacts/@datadog-datadog-ci-plugin-coverage-20.tgz",
"@datadog/datadog-ci-plugin-deployment": "file:./artifacts/@datadog-datadog-ci-plugin-deployment-20.tgz",
"@datadog/datadog-ci-plugin-dora": "file:./artifacts/@datadog-datadog-ci-plugin-dora-20.tgz",
"@datadog/datadog-ci-plugin-gate": "file:./artifacts/@datadog-datadog-ci-plugin-gate-20.tgz",
"@datadog/datadog-ci-plugin-junit": "file:./artifacts/@datadog-datadog-ci-plugin-junit-20.tgz",
"@datadog/datadog-ci-plugin-sarif": "file:./artifacts/@datadog-datadog-ci-plugin-sarif-20.tgz",
"@datadog/datadog-ci-plugin-sbom": "file:./artifacts/@datadog-datadog-ci-plugin-sbom-20.tgz"
},
"dependencies": {
"@datadog/datadog-ci": "file:./artifacts/@datadog-datadog-ci-20.tgz"
}
}' > package.json
# Ignore peer dependencies to fix infinite loop and ignore warnings about tarballs
npm config set legacy-peer-deps true
npm install
- name: Check that AAS plugin is not installed
run: |
if npx datadog-ci plugin check aas; then
echo "Checking for AAS plugin should have failed, but it succeeded"
exit 1
else
echo "Checking for AAS plugin failed as expected"
exit 0
fi
- name: Run AAS command with auto-install
env:
DEBUG: plugins
# Needed during releases, to avoid a "No matching version found" errors
PLUGIN_INSTALL_VERSION_OVERRIDE: file:./artifacts/@datadog-datadog-ci-plugin-aas-20.tgz
run: |
output=$(npx datadog-ci aas instrument || true)
if echo "$output" | grep "Successfully installed"; then
echo "AAS plugin was automatically installed"
exit 0
else
echo "AAS plugin was not automatically installed"
echo "Output: $output"
exit 1
fi
- name: Install AAS plugin
run: npx datadog-ci plugin install aas
env:
DEBUG: plugins
# Needed during releases, to avoid a "No matching version found" errors
PLUGIN_INSTALL_VERSION_OVERRIDE: file:./artifacts/@datadog-datadog-ci-plugin-aas-20.tgz
- name: Check that AAS plugin is installed
run: |
if npx datadog-ci plugin check aas; then
echo "AAS plugin was successfully installed"
exit 0
else
echo "AAS plugin was not installed"
exit 1
fi
test-plugin-auto-install-in-project-yarn:
name: Test plugin auto-install in existing project (Yarn)
runs-on: ubuntu-latest
needs: build-and-test
env:
FORCE_COLOR: 1
steps:
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 20
- uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: artifacts-20
path: artifacts/
- name: Create test project (Yarn)
run: |
echo '{
"name": "datadog-ci-plugin-auto-install-yarn",
"resolutions": {
"@datadog/datadog-ci-plugin-coverage": "file:./artifacts/@datadog-datadog-ci-plugin-coverage-20.tgz",
"@datadog/datadog-ci-plugin-deployment": "file:./artifacts/@datadog-datadog-ci-plugin-deployment-20.tgz",
"@datadog/datadog-ci-plugin-dora": "file:./artifacts/@datadog-datadog-ci-plugin-dora-20.tgz",
"@datadog/datadog-ci-plugin-gate": "file:./artifacts/@datadog-datadog-ci-plugin-gate-20.tgz",
"@datadog/datadog-ci-plugin-junit": "file:./artifacts/@datadog-datadog-ci-plugin-junit-20.tgz",
"@datadog/datadog-ci-plugin-sarif": "file:./artifacts/@datadog-datadog-ci-plugin-sarif-20.tgz",
"@datadog/datadog-ci-plugin-sbom": "file:./artifacts/@datadog-datadog-ci-plugin-sbom-20.tgz"
},
"dependencies": {
"@datadog/datadog-ci": "file:./artifacts/@datadog-datadog-ci-20.tgz"
}
}' > package.json
yarn set version stable
yarn config set nodeLinker node-modules
yarn install --no-immutable
- name: Check that AAS plugin is not installed
run: |
if yarn datadog-ci plugin check aas; then
echo "Checking for AAS plugin should have failed, but it succeeded"
exit 1
else
echo "Checking for AAS plugin failed as expected"
exit 0
fi
- name: Run AAS command with auto-install
env:
DEBUG: plugins
# Needed during releases, to avoid a "No matching version found" errors
PLUGIN_INSTALL_VERSION_OVERRIDE: file:./artifacts/@datadog-datadog-ci-plugin-aas-20.tgz
run: |
output=$(yarn datadog-ci aas instrument || true)
if echo "$output" | grep "Successfully installed"; then
echo "AAS plugin was automatically installed"
exit 0
else
echo "AAS plugin was not automatically installed"
echo "Output: $output"
exit 1
fi
- name: Install AAS plugin
run: yarn datadog-ci plugin install aas
env:
DEBUG: plugins
# Needed during releases, to avoid a "No matching version found" errors
PLUGIN_INSTALL_VERSION_OVERRIDE: file:./artifacts/@datadog-datadog-ci-plugin-aas-20.tgz
- name: Check that AAS plugin is installed
run: |
if yarn datadog-ci plugin check aas; then
echo "AAS plugin was successfully installed"
exit 0
else
echo "AAS plugin was not installed"
exit 1
fi
standalone-binary-test-ubuntu:
name: Test standalone binary in ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 22.19.0
- run: yarn install --immutable
- run: yarn build
- name: Create standalone binary
run: yarn dist-standalone -t node22-linux-x64 -o datadog-ci_linux-x64
- name: Remove src and dist folders to check that binary can stand alone
run: yarn rimraf --glob 'packages/*/{src,dist}'
- name: Smoke tests
run: yarn dist-standalone:test
- name: E2E tests
run: yarn e2e:test
env:
DATADOG_CI_COMMAND: ./datadog-ci_linux-x64
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
GITHUB_SHA: ${{ github.sha }}
IS_STANDALONE_BINARY: true
standalone-binary-test-ubuntu-arm:
name: Test standalone binary in ARM ubuntu
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 22.19.0
- run: yarn install --immutable
- run: yarn build
- name: Create standalone binary
run: yarn dist-standalone -t node22-linux-arm64 -o datadog-ci_linux-arm64
- name: Remove src and dist folders to check that binary can stand alone
run: yarn rimraf --glob 'packages/*/{src,dist}'
- name: Smoke tests
run: yarn dist-standalone:test
- name: E2E tests
run: yarn e2e:test
env:
DATADOG_CI_COMMAND: ./datadog-ci_linux-arm64
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
GITHUB_SHA: ${{ github.sha }}
IS_STANDALONE_BINARY: true
standalone-binary-test-alpine:
name: Test standalone binary in Alpine
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Restore x86_64 apk.static
id: apk-static-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ runner.temp }}/apk
key: apk-static-v2.14.10-x86_64-34bb1a96f0258982377a289392d4ea9f3f4b767a4bb5806b1b87179b79ad8a1c
- name: Download x86_64 apk.static
if: steps.apk-static-cache.outputs.cache-hit != 'true'
run: |
curl -4 -fsSL --retry 5 --retry-all-errors --retry-delay 5 --connect-timeout 30 --max-time 180 \
-o "$RUNNER_TEMP/apk" \
https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.10/x86_64/apk.static
- name: Verify x86_64 apk.static
run: echo "34bb1a96f0258982377a289392d4ea9f3f4b767a4bb5806b1b87179b79ad8a1c $RUNNER_TEMP/apk" | sha256sum -c
- name: Cache x86_64 apk.static
if: steps.apk-static-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ runner.temp }}/apk
key: ${{ steps.apk-static-cache.outputs.cache-primary-key }}
- name: Setup Alpine
uses: jirutka/setup-alpine@ae3b3ddba35054804fc4a3507b519fa7e8152050 # v1.4.1
with:
shell-name: alpine.sh
apk-tools-url: https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.10/x86_64/apk.static#!sha256!34bb1a96f0258982377a289392d4ea9f3f4b767a4bb5806b1b87179b79ad8a1c
- name: Install project dependencies (root)
run: |
apk add npm git
npm install -g corepack
shell: alpine.sh --root {0}
- name: Install project dependencies (workspace)
run: |
yarn install --immutable
yarn build
shell: alpine.sh {0}
- name: Create standalone binary
run: yarn dist-standalone:standard -t node22-alpine-x64 -o datadog-ci_alpine-x64
shell: alpine.sh {0}
- name: Remove src and dist folders to check that binary can stand alone
run: yarn rimraf --glob 'packages/*/{src,dist}'
shell: alpine.sh {0}
- name: Smoke tests
run: yarn dist-standalone:test
shell: alpine.sh {0}
env:
STANDALONE_BINARY_PATH: ./datadog-ci_alpine-x64
- name: E2E tests
run: yarn e2e:test # Requires `git` to be installed
shell: alpine.sh {0}
env:
DATADOG_CI_COMMAND: ./datadog-ci_alpine-x64
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
GITHUB_SHA: ${{ github.sha }}
IS_STANDALONE_BINARY: true
standalone-binary-test-alpine-arm:
name: Test standalone binary in ARM Alpine
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Restore aarch64 apk.static
id: apk-static-cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ runner.temp }}/apk
key: apk-static-v2.14.10-aarch64-e471d35aa221d031abe9b6288aede12a8e9f1a398954e5a2e1d1bce1727b4ef4
- name: Download aarch64 apk.static
if: steps.apk-static-cache.outputs.cache-hit != 'true'
run: |
curl -4 -fsSL --retry 5 --retry-all-errors --retry-delay 5 --connect-timeout 30 --max-time 180 \
-o "$RUNNER_TEMP/apk" \
https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.10/aarch64/apk.static
- name: Verify aarch64 apk.static
run: echo "e471d35aa221d031abe9b6288aede12a8e9f1a398954e5a2e1d1bce1727b4ef4 $RUNNER_TEMP/apk" | sha256sum -c
- name: Cache aarch64 apk.static
if: steps.apk-static-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ${{ runner.temp }}/apk
key: ${{ steps.apk-static-cache.outputs.cache-primary-key }}
- name: Setup Alpine
uses: jirutka/setup-alpine@ae3b3ddba35054804fc4a3507b519fa7e8152050 # v1.4.1
with:
arch: aarch64
shell-name: alpine.sh
# Taken from https://github.com/jirutka/setup-alpine/pull/22
apk-tools-url: https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.10/aarch64/apk.static#!sha256!e471d35aa221d031abe9b6288aede12a8e9f1a398954e5a2e1d1bce1727b4ef4
- name: Install project dependencies (root)
run: |
apk add npm git
npm install -g corepack
shell: alpine.sh --root {0}
- name: Install project dependencies (workspace)
run: |
yarn install --immutable
yarn build
shell: alpine.sh {0}
- name: Create standalone binary
run: yarn dist-standalone:standard -t node22-alpine-arm64 -o datadog-ci_alpine-arm64
shell: alpine.sh {0}
- name: Remove src and dist folders to check that binary can stand alone
run: yarn rimraf --glob 'packages/*/{src,dist}'
shell: alpine.sh {0}
- name: Smoke tests
run: yarn dist-standalone:test
shell: alpine.sh {0}
env:
STANDALONE_BINARY_PATH: ./datadog-ci_alpine-arm64
- name: E2E tests
run: yarn e2e:test # Requires `git` to be installed
shell: alpine.sh {0}
env:
DATADOG_CI_COMMAND: ./datadog-ci_alpine-arm64
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
GITHUB_SHA: ${{ github.sha }}
IS_STANDALONE_BINARY: true
standalone-binary-test-windows:
name: Test standalone binary in windows
runs-on: windows-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 22.19.0
- run: yarn install --immutable
- run: yarn build
- name: Create standalone binary
run: yarn dist-standalone -t node22-win-x64 -o datadog-ci_win-x64
- name: Remove src and dist folders to check that binary can stand alone
run: yarn rimraf --glob 'packages/*/{src,dist}'
- name: Smoke tests
run: yarn dist-standalone:test
- name: E2E tests
run: yarn e2e:test
env:
DATADOG_CI_COMMAND: .\\datadog-ci_win-x64.exe
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
GITHUB_SHA: ${{ github.sha }}
IS_STANDALONE_BINARY: true
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@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 22.19.0
- run: yarn install --immutable
- run: yarn build
- name: Create standalone binary
run: yarn dist-standalone -t node22-macos-x64 -o datadog-ci_darwin-x64
- name: Remove src and dist folders to check that binary can stand alone
run: yarn rimraf --glob 'packages/*/{src,dist}'
- name: Smoke tests
run: yarn dist-standalone:test
- name: E2E tests
run: yarn e2e:test
env:
DATADOG_CI_COMMAND: ./datadog-ci_darwin-x64
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
GITHUB_SHA: ${{ github.sha }}
IS_STANDALONE_BINARY: true
standalone-binary-test-macos-arm:
name: Test standalone binary in ARM macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 22.19.0
- run: yarn install --immutable
- run: yarn build
- name: Create standalone binary
run: yarn dist-standalone -t node22-macos-arm64 -o datadog-ci_darwin-arm64
- name: Remove src and dist folders to check that binary can stand alone
run: yarn rimraf --glob 'packages/*/{src,dist}'
- name: Smoke tests
run: yarn dist-standalone:test
- name: E2E tests
run: yarn e2e:test
env:
DATADOG_CI_COMMAND: ./datadog-ci_darwin-arm64
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY_E2E }}
DATADOG_APP_KEY: ${{ secrets.DATADOG_APP_KEY_E2E }}
DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }}
GITHUB_SHA: ${{ github.sha }}
IS_STANDALONE_BINARY: true
datadog-static-analyzer:
runs-on: ubuntu-latest
name: Static Analyzer - Diff Aware
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Run Datadog static analyzer
id: datadog-static-analysis
uses: DataDog/datadog-static-analyzer-github-action@8340f18875fcefca86844b5f947ce2431387e552 # v3.0.0
with:
dd_app_key: ${{ secrets.DATADOG_APP_KEY_MAIN_ACCOUNT }}
dd_api_key: ${{ secrets.DATADOG_API_KEY_MAIN_ACCOUNT }}
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@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Run Datadog static analyzer
id: datadog-static-analysis
uses: DataDog/datadog-static-analyzer-github-action@8340f18875fcefca86844b5f947ce2431387e552 # v3.0.0
with:
dd_app_key: ${{ secrets.DATADOG_APP_KEY_MAIN_ACCOUNT }}
dd_api_key: ${{ secrets.DATADOG_API_KEY_MAIN_ACCOUNT }}
cpu_count: 2
diff_aware: false
lint-yaml:
name: Lint YAML
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 22.19.0
- run: yarn install --immutable
- run: yarn lint:yaml
check-licenses:
name: Check licenses
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Install node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 22.19.0
# 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