-
Notifications
You must be signed in to change notification settings - Fork 2
103 lines (82 loc) · 3.44 KB
/
Copy pathsmoke-test.yaml
File metadata and controls
103 lines (82 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Package Smoke Test
on:
pull_request:
paths:
- 'packages/*/package.json'
- 'packages/core/src/**'
- 'scripts/test-react-native-package-install.sh'
- 'test-app-react-native/**'
- 'yarn.lock'
- 'lerna.json'
- '.github/workflows/smoke-test.yaml'
jobs:
npm-compatibility:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: '24.x'
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable && yarn allow-scripts
- name: Build packages
run: yarn build
- name: Pack and validate packages
run: |
echo "Packing packages and checking for yarn-specific protocols..."
mkdir -p /tmp/tarballs
for pkg_dir in packages/core packages/browser packages/node-server; do
echo ""
echo "=== Validating $pkg_dir ==="
cd "$pkg_dir"
# Pack the package (creates .tgz)
npm pack --pack-destination /tmp/tarballs
# Extract and inspect the tarball (use package name for deterministic match)
PKG_NAME=$(node -p "require('./package.json').name.replace('@datadog/', 'datadog-')")
PKG_VERSION=$(node -p "require('./package.json').version")
TARBALL="/tmp/tarballs/${PKG_NAME}-${PKG_VERSION}.tgz"
tar -xzf "$TARBALL" -C /tmp
# Check for any yarn-specific protocols in the packed package.json
if grep -E '"(workspace|patch|portal|link):' /tmp/package/package.json; then
echo "❌ Found yarn-specific protocol in $pkg_dir"
cat /tmp/package/package.json
exit 1
fi
echo "✅ No yarn-specific protocols in $pkg_dir"
rm -rf /tmp/package
cd - > /dev/null
done
echo ""
echo "✅ All packages validated"
ls -la /tmp/tarballs
- name: Test npm install from tarballs
run: |
echo "Testing npm installation from packed tarballs..."
# Create isolated test environment
mkdir -p /tmp/npm-test
cd /tmp/npm-test
npm init -y
# Install packages using npm (NOT yarn)
echo "Installing @datadog/flagging-core..."
npm install /tmp/tarballs/datadog-flagging-core-*.tgz
echo "Installing @datadog/openfeature-node-server..."
npm install /tmp/tarballs/datadog-openfeature-node-server-*.tgz
# Verify packages load correctly
echo ""
echo "Verifying packages load..."
node -e "
const core = require('@datadog/flagging-core');
console.log('✅ @datadog/flagging-core loads');
const nodeServer = require('@datadog/openfeature-node-server');
console.log('✅ @datadog/openfeature-node-server loads');
// Verify key exports exist
if (typeof nodeServer.DatadogNodeServerProvider !== 'function') {
throw new Error('DatadogNodeServerProvider not exported');
}
console.log('✅ DatadogNodeServerProvider export verified');
"
echo ""
echo "✅ npm install smoke test passed"
- name: Test React Native Metro compatibility
run: yarn test:react-native-install