Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chores] Make CI 1 minute faster, switch from yarn to bun #1556

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 77 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,38 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [14, 16, 18, 20]
version: [18, 20, 22]

name: Build and test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
- 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: bun install --frozen-lockfile
- run: bun run build
- name: bun run lint:ci
run: |
if ! yarn lint:ci ; then
if ! bun run 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 "You can fix this by running ==> bun run format <=="
echo ""
exit 1
fi
- run: yarn no-only-in-tests
- run: bun run no-only-in-tests

- run: yarn test
- run: bun run test
env:
CI: true
DD_SERVICE: datadog-ci-tests
Expand All @@ -46,7 +50,8 @@ jobs:
DD_ENV: ci
NODE_OPTIONS: -r dd-trace/ci/init
- run: mkdir artifacts
- run: yarn pack --filename artifacts/datadog-ci-${{ matrix.version }}.tgz
- run: bun pm pack --destination datadog-ci-${{ matrix.version }}
- run: bun exec "mv datadog-ci-${{ matrix.version }}/*.tgz artifacts/datadog-ci-${{ matrix.version }}.tgz"
- run: cp -r .github/workflows/e2e artifacts/
- uses: actions/upload-artifact@v4
with:
Expand All @@ -62,7 +67,7 @@ jobs:
e2e-test:
strategy:
matrix:
version: [14, 16, 18, 20]
version: [18, 20, 22]

name: End-to-end test the package
runs-on: ubuntu-latest
Expand All @@ -72,6 +77,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
- name: Install node
uses: actions/setup-node@v4
with:
Expand All @@ -80,51 +89,51 @@ jobs:
with:
name: artifacts-${{ matrix.version }}
path: artifacts/
- run: yarn add ./artifacts/datadog-ci-${{ matrix.version }}.tgz
- run: bun add ./artifacts/datadog-ci-${{ matrix.version }}.tgz
- name: Run synthetics test
run: yarn datadog-ci synthetics run-tests --config artifacts/e2e/global.config.json
run: bun run 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/
run: bun run 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
run: bun run 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
bun add @datadog/datadog-api-client
bun run 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 (measures), passing glob as literal string
run: yarn datadog-ci junit upload --service=datadog-ci-e2e-tests-junit '**/junit-reports/**' --measures testmeasure2:60 --report-measures sessionmeasure2:80
run: bun run datadog-ci junit upload --service=datadog-ci-e2e-tests-junit '**/junit-reports/**' --measures testmeasure2:60 --report-measures sessionmeasure2:80
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
bun add @datadog/datadog-api-client
bun run 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
run: bun run 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
run: bun run 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 }}
Expand All @@ -134,20 +143,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
- 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
- run: bun install --frozen-lockfile
- run: bun run build
- name: Create standalone binary
run: yarn dist-standalone -t node18-linux-x64 -o datadog-ci_linux-x64
run: bun run dist-standalone -t node18-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
run: bun run dist-standalone:test

standalone-binary-test-ubuntu-arm:
name: Test standalone binary in ARM ubuntu
Expand All @@ -156,42 +169,48 @@ jobs:
labels: arm-4core-linux
steps:
- uses: actions/checkout@v4
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
- 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
- run: bun install --frozen-lockfile
- run: bun run build
- name: Create standalone binary
run: yarn dist-standalone -t node18-linux-arm64 -o datadog-ci_linux-arm64
run: bun run dist-standalone -t node18-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
run: bun run dist-standalone:test

standalone-binary-test-windows:
name: Test standalone binary in windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
- 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
- run: bun install --frozen-lockfile
- run: bun run build:win
- name: Create standalone binary
run: yarn dist-standalone -t node18-win-x64 -o datadog-ci_win-x64
run: bun run dist-standalone -t node18-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
run: bun run dist-standalone:test

standalone-binary-test-macos:
name: Test standalone binary in macOS
Expand All @@ -200,40 +219,48 @@ jobs:
runs-on: macos-latest-large
steps:
- uses: actions/checkout@v4
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
- 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
- run: bun install --frozen-lockfile
- run: bun run build
- name: Create standalone binary
run: yarn dist-standalone -t node18-macos-x64 -o datadog-ci_darwin-x64
run: bun run dist-standalone -t node18-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
run: bun run 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 bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
- 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
- run: bun install --frozen-lockfile
- run: bun run build
- name: Create standalone binary
run: yarn dist-standalone -t node18-macos-arm64 -o datadog-ci_darwin-arm64
run: bun run dist-standalone -t node18-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
run: bun run dist-standalone:test

datadog-static-analyzer:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -275,11 +302,13 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Install bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
- 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
node-version: 20.11.0
- run: bun install --frozen-lockfile --ignore-scripts
- run: bun run check-licenses
12 changes: 7 additions & 5 deletions .github/workflows/publish-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
- uses: actions/setup-node@v4
with:
node-version: 14.18.3
node-version: 20.11.0
- run: |
# Isolate the tag and exit if none found
IFS='-' read -ra ARR_TAG <<< $TAG
if ((${#ARR_TAG[@]} <= 1)); then echo "Missing channel in given tag '$TAG'. Should be in the format '<version>-<channel>'" && exit 1; fi
TAG_TO_PUBLISH=${ARR_TAG[${#ARR_TAG[@]} - 1]}

# Publish on npm in the correct channel
yarn
bun install --frozen-lockfile
echo "Publishing on $TAG_TO_PUBLISH channel."
yarn npm publish --tag=$TAG_TO_PUBLISH
bun publish --tag=$TAG_TO_PUBLISH
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.YARN_NPM_AUTH_TOKEN }}
NPM_CONFIG_TOKEN: ${{ secrets.YARN_NPM_AUTH_TOKEN }}
TAG: ${{ github.event.release.tag_name }}
Loading