Skip to content

Commit 0dde98b

Browse files
Harness ideas
1 parent 315e1f4 commit 0dde98b

32 files changed

Lines changed: 7397 additions & 443 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ dist/
99
.idea/
1010
plan.md
1111
coverage/
12+
tests/integration/resources/sonar-secrets
1213
.eslintcache
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
# Setup script for integration test resources.
3+
# Downloads and places the sonar-secrets binary required by integration tests.
4+
#
5+
# Usage:
6+
# bash build-scripts/setup-integration-resources.sh
7+
#
8+
# Prerequisites:
9+
# - sonarqube-cli must be installed (run: npm install -g .)
10+
# - Run once before running integration tests on a new machine
11+
12+
set -euo pipefail
13+
14+
RESOURCES_DIR="tests/integration/resources"
15+
BINARY_PATH="$RESOURCES_DIR/sonar-secrets"
16+
17+
if [ -f "$BINARY_PATH" ] && [ -x "$BINARY_PATH" ] && file "$BINARY_PATH" | grep -q "executable"; then
18+
echo "sonar-secrets binary already present at $BINARY_PATH"
19+
"$BINARY_PATH" --version
20+
exit 0
21+
fi
22+
23+
echo "Installing sonar-secrets binary for integration tests..."
24+
sonar install secrets
25+
26+
# Determine platform binary name
27+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
28+
ARCH=$(uname -m)
29+
if [[ "$ARCH" == "x86_64" ]]; then ARCH="x64"; fi
30+
if [[ "$ARCH" == "arm64" || "$ARCH" == "aarch64" ]]; then ARCH="arm64"; fi
31+
32+
INSTALLED_BINARY="$HOME/.sonar/sonarqube-cli/bin/sonar-secrets"
33+
34+
if [ ! -f "$INSTALLED_BINARY" ]; then
35+
echo "Error: sonar-secrets was not found at $INSTALLED_BINARY after install" >&2
36+
exit 1
37+
fi
38+
39+
cp "$INSTALLED_BINARY" "$BINARY_PATH"
40+
chmod +x "$BINARY_PATH"
41+
42+
echo "sonar-secrets binary copied to $BINARY_PATH"
43+
"$BINARY_PATH" --version

build-scripts/update-version.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ fi
4242

4343
echo "🔄 Updating version to $NEW_VERSION..."
4444

45-
# Update package.json (single source of truth)
45+
# Update package.json (single source of truth — only top-level version field)
4646
echo " 📝 Updating package.json..."
47-
sed -i '' "s/\"version\": \"[^\"]*\"/\"version\": \"$NEW_VERSION\"/" package.json
47+
npm pkg set version="$NEW_VERSION" --no-git-tag-version 2>/dev/null || \
48+
node -e "const fs=require('fs'),p='package.json',j=JSON.parse(fs.readFileSync(p,'utf8'));j.version='$NEW_VERSION';fs.writeFileSync(p,JSON.stringify(j,null,2)+'\n');"
4849

49-
# Update VERSION in src/version.ts (preserve license header)
50+
# Update src/version.ts (single-line export, safe to replace)
5051
echo " 📝 Updating src/version.ts..."
5152
sed -i '' "s/export const VERSION = '[^']*';/export const VERSION = '$NEW_VERSION';/" src/version.ts
5253

0 commit comments

Comments
 (0)