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

Update node 20, add codecov #1195

Merged
merged 20 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 19 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
54 changes: 2 additions & 52 deletions .buildkite/Dockerfile.agent
Original file line number Diff line number Diff line change
@@ -1,55 +1,5 @@
FROM 528451384384.dkr.ecr.us-west-2.amazonaws.com/buildkite-agent-node16:node-16.16
FROM 528451384384.dkr.ecr.us-west-2.amazonaws.com/buildkite-agent-node20

# 2. Install WebKit dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libwoff1 \
libopus0 \
libwebp6 \
libwebpdemux2 \
libenchant1c2a \
libgudev-1.0-0 \
libsecret-1-0 \
libhyphen0 \
libgdk-pixbuf2.0-0 \
libegl1 \
libnotify4 \
libxslt1.1 \
libevent-2.1-6 \
libgles2 \
libvpx5 \
libxcomposite1 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libepoxy0 \
libgtk-3-0 \
libharfbuzz-icu0

# 3. Install gstreamer and plugins to support video playback in WebKit.
RUN apt-get update && apt-get install -y --no-install-recommends \
libgstreamer-gl1.0-0 \
libgstreamer-plugins-bad1.0-0 \
gstreamer1.0-plugins-good \
gstreamer1.0-libav

# 4. Install Chromium dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libnss3 \
libxss1 \
libasound2 \
fonts-noto-color-emoji \
libxtst6

# 5. Install Firefox dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libdbus-glib-1-2 \
libxt6

# 6. Install ffmpeg to bring in audio and video codecs necessary for playing videos in Firefox.
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg

# 7. (Optional) Install XVFB if there's a need to run browsers in headful mode
RUN apt-get update && apt-get install -y --no-install-recommends \
xvfb
RUN npx playwright install-deps

ENTRYPOINT []
17 changes: 7 additions & 10 deletions .buildkite/Readme.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# Buildkite setup

## Dockerfile.agent

Builds the base image that is used by analytics-next in CI.
# Buildkite

## How to update the buildkite docker agent
1. Make your changes to `Dockerfile.agent`.
2. Push the changes to ecr
(will need `Ops Write` permission).
```bash
$ robo docker.login-privileged
$ cd .buildkite
$ robo-tooling.docker.login-privileged
$ make agent
```

## .pipeline

Full buildkite configuration.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- uses: browser-actions/setup-chrome@v1
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 20
cache: 'yarn'
- run: yarn install --immutable
- name: Turbo cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/create-github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js 16.x
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20.x
cache: "yarn"
- name: Install Dependencies
run: HUSKY=0 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install --immutable
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-creator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js 16.x
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 20.x
cache: "yarn"

- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.16
20.9.0
7 changes: 7 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
coverage:
status:
project:
default:
target: auto
threshold: 0%
base: auto
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts"
],
"engines": {
"node": "^16.16.0"
"node": "^20"
},
"scripts": {
"test": "jest",
Expand Down
8 changes: 4 additions & 4 deletions packages/browser/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ module.exports = createJestTSConfig(__dirname, {
testEnvironment: 'jsdom',
coverageThreshold: {
global: {
branches: 80.91,
functions: 87.25,
lines: 91.03,
statements: 87.25,
branches: 74,
functions: 80,
lines: 87,
statements: 82,
},
},
})
2 changes: 1 addition & 1 deletion packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@types/js-cookie": "3.0.1",
"@types/jsdom": "^16.2.14",
"@types/mime": "^2.0.3",
"@types/node": "^16",
"@types/node": "^20",
"@types/serve-handler": "^6.1.0",
"aws-sdk": "^2.814.0",
"circular-dependency-plugin": "^5.2.2",
Expand Down
13 changes: 13 additions & 0 deletions packages/config/src/jest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@ const createJestTSConfig = (
* No need to manually run yarn build all the time.
* This resolve packages for ts-jest so typescript compilation happens in-memory.
*/
...(process.env.COVERAGE === 'true'
? {
collectCoverage: true,
coverageReporters: ['json'],
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'!src/**/*.test.{js,jsx,ts,tsx}',
// Exclude test files "!src/**/index.{js,ts}",
// Exclude index files
],
coverageDirectory: '<rootDir>/coverage',
}
: {}),
moduleNameMapper: moduleMap,
preset: 'ts-jest',
modulePathIgnorePatterns: [
Expand Down
2 changes: 1 addition & 1 deletion packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"devDependencies": {
"@internal/config": "0.0.0",
"@types/node": "^16",
"@types/node": "^18",
"axios": "^1.6.2"
},
"packageManager": "[email protected]"
Expand Down
6 changes: 5 additions & 1 deletion packages/signals/signals/src/core/client/redact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { Signal } from '@segment/analytics-signals-runtime'
export const redactSignalData = (signalArg: Signal): Signal => {
const signal = structuredClone(signalArg)
if (signal.type === 'interaction') {
if ('target' in signal.data) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typescript error that didn't appear until updating nodejs

if (
'target' in signal.data &&
signal.data.target &&
typeof signal.data.target === 'object'
) {
if ('value' in signal.data.target) {
signal.data.target.value = redactJsonValues(signal.data.target.value)
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/clean.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
# Clear build artifacts and build cache

find . \( -name ".turbo" -o -name "dist" -o -name ".next" -o -name "tsconfig.tsbuildinfo" \) ! -path "*/node_modules/*" -print0 | xargs -0 rm -rf
find . \( -name ".turbo" -o -name "dist" -o -name ".next" -o -name "tsconfig.tsbuildinfo" -o -name "coverage" \) ! -path "*/node_modules/*" -print0 | xargs -0 rm -rf
rm -rf node_modules/.cache

echo "Build files and cache deleted."
2 changes: 1 addition & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"packageManager": "[email protected]",
"devDependencies": {
"@node-kit/yarn-workspace-root": "^3.2.0",
"@types/node": "^16",
"@types/node": "^20",
"ts-node": "^10.8.0"
}
}
38 changes: 35 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2984,7 +2984,7 @@ __metadata:
resolution: "@internal/scripts@workspace:scripts"
dependencies:
"@node-kit/yarn-workspace-root": ^3.2.0
"@types/node": ^16
"@types/node": ^20
ts-node: ^10.8.0
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -4273,7 +4273,7 @@ __metadata:
"@types/js-cookie": 3.0.1
"@types/jsdom": ^16.2.14
"@types/mime": ^2.0.3
"@types/node": ^16
"@types/node": ^20
"@types/serve-handler": ^6.1.0
aws-sdk: ^2.814.0
circular-dependency-plugin: ^5.2.2
Expand Down Expand Up @@ -4315,7 +4315,7 @@ __metadata:
"@lukeed/uuid": ^2.0.0
"@segment/analytics-core": 1.8.0
"@segment/analytics-generic-utils": 1.2.0
"@types/node": ^16
"@types/node": ^18
axios: ^1.6.2
buffer: ^6.0.3
jose: ^5.1.0
Expand Down Expand Up @@ -6463,13 +6463,31 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:^18":
version: 18.19.64
resolution: "@types/node@npm:18.19.64"
dependencies:
undici-types: ~5.26.4
checksum: e7680215b03c9bee8a33947f03d06048e8e460f23b1b7b29c45350cf437faa5f8fcb7d8c3eb8dfec8427923e7a184df42bc710c1b6252b4852e3ed7064c6228f
languageName: node
linkType: hard

"@types/node@npm:^18.11.15":
version: 18.17.5
resolution: "@types/node@npm:18.17.5"
checksum: b8c658a99234b99425243c324b641ed7b9ceb6bee6b06421fdc9bb7c58f9a5552e353225cc549e6982462ac384abe1985022ed76e2e4728797f59b21f659ca2b
languageName: node
linkType: hard

"@types/node@npm:^20":
version: 20.17.6
resolution: "@types/node@npm:20.17.6"
dependencies:
undici-types: ~6.19.2
checksum: d51dbb9881c94d0310b32b5fd8013e3261595c61bc888fa27258469c93c3dc0b3c4d20a9f28f3f5f79562f6737e28e7f3dd04940dc8b4d966d34aaf318f7f69b
languageName: node
linkType: hard

"@types/node@npm:^20.1.0, @types/node@npm:^20.1.1":
version: 20.3.1
resolution: "@types/node@npm:20.3.1"
Expand Down Expand Up @@ -22393,6 +22411,20 @@ __metadata:
languageName: node
linkType: hard

"undici-types@npm:~5.26.4":
version: 5.26.5
resolution: "undici-types@npm:5.26.5"
checksum: 3192ef6f3fd5df652f2dc1cd782b49d6ff14dc98e5dced492aa8a8c65425227da5da6aafe22523c67f035a272c599bb89cfe803c1db6311e44bed3042fc25487
languageName: node
linkType: hard

"undici-types@npm:~6.19.2":
version: 6.19.8
resolution: "undici-types@npm:6.19.8"
checksum: de51f1b447d22571cf155dfe14ff6d12c5bdaec237c765085b439c38ca8518fc360e88c70f99469162bf2e14188a7b0bcb06e1ed2dc031042b984b0bb9544017
languageName: node
linkType: hard

"undici@npm:^5.22.1":
version: 5.28.4
resolution: "undici@npm:5.28.4"
Expand Down
Loading