Executing automated changes #9679
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| env: | |
| FORCE_COLOR: 1 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| sparse-checkout: | | |
| e2e/ | |
| jest.config-e2e.mjs | |
| 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-base": "file:./artifacts/@datadog-datadog-ci-base-${{ matrix.version }}.tgz", | |
| "@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-base": "./artifacts/@datadog-datadog-ci-base-${{ 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-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 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' | |
| 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: Run e2e tests | |
| run: yarn jest --config jest.config-e2e.mjs --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: ${{ needs.check-container-app-changes.outputs.should_run != 'true' }} | |
| SKIP_AAS_TESTS: ${{ needs.check-aas-changes.outputs.should_run != 'true' }} | |
| 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_AAS_LINUX_PLAN: ${{ vars.AZURE_AAS_LINUX_PLAN_E2E }} | |
| AZURE_AAS_WINDOWS_PLAN: ${{ vars.AZURE_AAS_WINDOWS_PLAN_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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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/fixtures/container-app/**' | |
| - 'e2e/container-app.test.ts' | |
| - 'e2e/helpers/container-app-verifier.ts' | |
| - '.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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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/aas-linux.test.ts' | |
| - 'e2e/aas-windows.test.ts' | |
| - 'e2e/helpers/aas-verifier.ts' | |
| - '.github/workflows/ci.yml' | |
| 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| sparse-checkout: | | |
| e2e/ | |
| jest.config-e2e.mjs | |
| 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-base": "file:./artifacts/@datadog-datadog-ci-base-${{ matrix.version }}.tgz", | |
| "@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-base": "./artifacts/@datadog-datadog-ci-base-${{ 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-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 install --no-immutable | |
| - name: Run e2e tests | |
| run: yarn jest --config jest.config-e2e.mjs --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' | |
| # 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-base-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_AUTO_INSTALL_BASE_VERSION_OVERRIDE: file:./artifacts/@datadog-datadog-ci-base-20.tgz | |
| PLUGIN_AUTO_INSTALL_PLUGIN_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-base": "$@datadog/datadog-ci-base", | |
| "@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", | |
| "@datadog/datadog-ci-base": "file:./artifacts/@datadog-datadog-ci-base-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_AUTO_INSTALL_BASE_VERSION_OVERRIDE: file:./artifacts/@datadog-datadog-ci-base-20.tgz | |
| PLUGIN_AUTO_INSTALL_PLUGIN_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_AUTO_INSTALL_BASE_VERSION_OVERRIDE: file:./artifacts/@datadog-datadog-ci-base-20.tgz | |
| PLUGIN_AUTO_INSTALL_PLUGIN_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-base": "file:./artifacts/@datadog-datadog-ci-base-20.tgz", | |
| "@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_AUTO_INSTALL_BASE_VERSION_OVERRIDE: file:./artifacts/@datadog-datadog-ci-base-20.tgz | |
| PLUGIN_AUTO_INSTALL_PLUGIN_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_AUTO_INSTALL_BASE_VERSION_OVERRIDE: file:./artifacts/@datadog-datadog-ci-base-20.tgz | |
| PLUGIN_AUTO_INSTALL_PLUGIN_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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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: Test generated standalone binary | |
| run: yarn dist-standalone:test | |
| - name: Compare binary sizes | |
| run: yarn compare-binary-size datadog-ci_linux-x64 | |
| 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install node | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: 22.19.0 | |
| - 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 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: Test generated standalone binary | |
| run: yarn dist-standalone:test | |
| - name: Compare binary sizes | |
| run: yarn compare-binary-size datadog-ci_linux-arm64 | |
| standalone-binary-test-windows: | |
| name: Test standalone binary in windows | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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: Test generated standalone binary | |
| run: yarn dist-standalone:test | |
| - name: Compare binary sizes | |
| run: yarn compare-binary-size datadog-ci_win-x64.exe | |
| 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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: Test generated standalone binary | |
| run: yarn dist-standalone:test | |
| - name: Compare binary sizes | |
| run: yarn compare-binary-size datadog-ci_darwin-x64 | |
| standalone-binary-test-macos-arm: | |
| name: Test standalone binary in ARM macOS | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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: Test generated standalone binary | |
| run: yarn dist-standalone:test | |
| - name: Compare binary sizes | |
| run: yarn compare-binary-size datadog-ci_darwin-arm64 | |
| datadog-static-analyzer: | |
| runs-on: ubuntu-latest | |
| name: Static Analyzer - Diff Aware | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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 | |
| check-licenses: | |
| name: Check licenses | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - 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 |