Skip to content

Commit

Permalink
Merge branch 'main' into sentry-integration
Browse files Browse the repository at this point in the history
Signed-off-by: Yash Khare <[email protected]>
  • Loading branch information
khareyash05 authored Sep 30, 2024
2 parents a709e30 + 26b3312 commit 122f140
Show file tree
Hide file tree
Showing 19 changed files with 749 additions and 258 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/testarch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Nodejs Build Test

on:
pull_request:
branches:
- main

jobs:
package:
name: Package
runs-on: ubuntu-latest
strategy:
matrix:
os: [linux, darwin, win32] # Define the platforms
arch: [x64, arm64] # Define the architectures
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'

# Install npm dependencies based on the architecture
- name: Install dependencies
run: |
if [ "${{ matrix.arch }}" == "arm64" ]; then
npm_config_arch=arm64 npm install --build-from-source
else
npm_config_arch=x64 npm install --build-from-source
fi
# Run Rollup for compilation
- name: Run Rollup
run: npm run rollupci

- name: List contents of out/compiled directory (for debugging)
run: ls -R out/compiled

- name: Install vsce
run: npm install -g @vscode/vsce

- name: Package VSIX for the target platform
run: |
case "${{ matrix.os }}" in
linux) vsce package --target linux-${{ matrix.arch }} ;;
darwin) vsce package --target darwin-${{ matrix.arch }} ;;
win32) vsce package --target win32-${{ matrix.arch }} ;;
esac
- name: Capture VSIX filename
id: capture_vsix_file
run: |
VSIX_FILE=$(ls *.vsix)
echo "VSIX_FILE=$VSIX_FILE" >> $GITHUB_ENV
shell: bash

- name: Print VSIX filename
id: print_vsix_file # Renamed to be unique
run: |
echo "Generated package for platform ${{ matrix.os }} and architecture ${{ matrix.arch }}:"
ls *.vsix
2 changes: 1 addition & 1 deletion .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from '@vscode/test-cli';

export default defineConfig({
files: 'out/test/**/*.test.js',
files: 'out/*.test.js',
});
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,15 @@ First Release for Vs Code Extension.
## [1.0.12]

- Fixing wrong file test generation in express mongoose

## [1.0.13]

- Separate release for arm and amd user

## [1.0.14]

- Back button refactored for better User Experience

## [1.0.15]

- Reverting to universal release
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "keployio",
"displayName": "Keploy",
"description": "Streamline testing with the power of Keploy, directly in your favorite IDE.",
"version": "1.0.12",
"version": "1.0.15",
"publisher": "Keploy",
"icon": "media/logo.png",
"pricing": "Free",
Expand Down
35 changes: 13 additions & 22 deletions scripts/bash/keploy_record_script.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash -i

# folderpath="$2"
log_file_path="$1"

# Extract command from keploy.yml
Expand All @@ -11,9 +10,7 @@ if [[ ! -f "$keploy_config" ]]; then
fi

command=$(awk '/command:/ { $1=""; sub(/^ /, ""); print }' "$keploy_config")
# echo "Command in yml file: $command"

# Check if command is empty
if [[ -z "$command" ]]; then
echo "Command is not specified in keploy.yml."
exit 1
Expand All @@ -31,22 +28,14 @@ if [[ "$command" =~ .*"go".* ]]; then
go build -o application

elif [[ "$command" =~ .*"python3".* ]]; then
# echo "Python3 command found"
python3 -m venv venv
# echo "venv created"
source venv/bin/activate
# echo "venv activated"
pip install -r requirements.txt
# echo "requirements installed"

elif [[ "$command" =~ .*"python".* ]] ; then
# echo "Python command found"
python -m venv venv
# echo "venv created"
source venv/bin/activate
# echo "venv activated"
pip install -r requirements.txt
# echo "requirements installed"

elif [[ "$command" =~ .*"node".* ]]; then
npm install
Expand All @@ -58,7 +47,7 @@ fi
# Check if running on WSL
if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null ; then
export PATH=$(echo "$PATH" | tr ' ' '\n' | grep -v " " | tr '\n' ':')
keploycmd="sudo -E keploy"
keploycmd="sudo -E env PATH=\"$PATH\" keploy"
else
keploycmd="sudo -E env PATH=\"$PATH\" keploy"
fi
Expand All @@ -75,15 +64,17 @@ cat_pid=$!
(while true; do sleep 1; done) &
dummy_pid=$!

# Execute the keploy command, redirecting output to the named pipe
sudo -E $keploycmd record > "$fifo" 2>&1
# Function to Terminate the dummy process and the logging process
kill_all() {
kill $dummy_pid
rm -f "$fifo"
}

# Execute the keploy command with the trap, redirecting output to the named pipe
(
trap 'kill_all' SIGINT SIGTERM EXIT
$keploycmd record > "$fifo" 2>&1
)

# Clean up: Wait for keploy command to finish
wait $!
touch ./log_file.txt


# Terminate the dummy process and the logging process
kill $dummy_pid
wait $cat_pid
rm "$fifo"
wait $!
49 changes: 25 additions & 24 deletions scripts/bash/keploy_test_script.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash -i

# folderpath="$2"
log_file_path="$1"

# Create log file if it doesn't exist
Expand All @@ -12,57 +11,59 @@ chmod 666 "$log_file_path"

# Extract the command from keploy.yml
command=$(awk -F: '/command:/ {gsub(/^[ \t]+|[ \t]+$/, "", $2); print $2}' keploy.yml)
# echo "Command in yml file: $command"

# echo "Command in yml file: $command"
if [[ "$command" =~ .*"go".* ]]; then
# echo "Go is present."
go mod download
go build -o application

elif [[ "$command" =~ .*"python3".* ]]; then
# echo "Python 3 is present, Activating Virtual Environment 🐍"
python3 -m venv venv
source venv/bin/activate
# echo 'Installing requirements 📦'
pip install -r requirements.txt
# echo 'Test Mode Starting 🎉'

elif [[ "$command" =~ .*"python".* ]] ; then
# echo "Python is present, Activating Virtual Environment 🐍"
python -m venv venv
source venv/bin/activate
# echo 'Installing requirements 📦'
pip install -r requirements.txt
# echo 'Test Mode Starting 🎉'

elif [[ "$command" =~ .*"node".* ]]; then
# echo "Node is present."
npm install

elif [[ "$command" =~ .*"java".* ]] || [[ "$command" =~ .*"mvn".* ]]; then
# echo "Java is present."
mvn clean install

fi

# Check if running on WSL
if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null ; then
# echo "Running on WSL"
# Temporarily modify PATH
export PATH=$(echo "$PATH" | tr ' ' '\n' | grep -v " " | tr '\n' ':')
keploycmd="sudo -E keploy"
keploycmd="sudo -E env PATH=\"$PATH\" keploy"
else
# echo "Not running on WSL"
# Original PATH handling
keploycmd="sudo -E env PATH=\"$PATH\" keploy"
fi

# echo "Keploy command: $keploycmd"
# Create a named pipe
fifo=$(mktemp -u)
mkfifo "$fifo"

# Background process to read from the named pipe and write to the log file
cat "$fifo" | tee -a "$log_file_path" &
cat_pid=$!

# Dummy background process to keep the parent script running
(while true; do sleep 1; done) &
dummy_pid=$!

# Function to Terminate the dummy process and the logging process
kill_all() {
kill $dummy_pid
rm -f "$fifo"
}

# cd "$folderpath"
# Execute the keploy command with the trap, redirecting output to the named pipe
(
trap 'kill_all' SIGINT SIGTERM EXIT
$keploycmd test > "$fifo" 2>&1
)

# Execute the keploy command and append the output to the log file
sudo $keploycmd test | tee -a "$log_file_path"
touch ./log_file.txt

# Clean up: Wait for keploy command to finish
wait $!
83 changes: 83 additions & 0 deletions scripts/zsh/keploy_record_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/zsh -i

log_file_path="$1"

# Extract command from keploy.yml
keploy_config="keploy.yml"
if [[ ! -f "$keploy_config" ]]; then
echo "keploy.yml file not found in the current directory."
exit 1
fi

command=$(awk '/command:/ { $1=""; sub(/^ /, ""); print }' "$keploy_config")

# Check if command is empty
if [[ -z "$command" ]]; then
echo "Command is not specified in keploy.yml."
exit 1
fi

# Create log file if it doesn't exist
touch "$log_file_path"
: > "$log_file_path" # Clear the log file

# Set permissions of the log file
chmod 666 "$log_file_path"

if [[ "$command" =~ .*"go".* ]]; then
go mod download
go build -o application

elif [[ "$command" =~ .*"python3".* ]]; then
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

elif [[ "$command" =~ .*"python".* ]] ; then
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

elif [[ "$command" =~ .*"node".* ]]; then
npm install

elif [[ "$command" =~ .*"java".* ]] || [[ "$command" =~ .*"mvn".* ]]; then
mvn clean install
fi

# Create a named pipe
fifo=$(mktemp -u)
mkfifo "$fifo"

# Disable job control messages
set +m

# Background process to read from the named pipe and write to the log file
cat "$fifo" | tee -a "$log_file_path" &
cat_pid=$!

# Dummy background process to keep the parent script running
(while true; do sleep 1; done) &
dummy_pid=$!

kill_all() {
kill $dummy_pid 2>/dev/null
rm -f "$fifo"
}

# Check if running on WSL
if grep -qEi "(Microsoft|WSL)" /proc/version &> /dev/null ; then
(
trap 'kill_all' SIGINT SIGTERM EXIT
sudo -E env "PATH=$PATH" keploy record > "$fifo" 2>&1
)
else
keploycmd="sudo -E env PATH=\"$PATH\" keploy"
(
trap 'kill_all' SIGINT SIGTERM EXIT
eval $keploycmd record > "$fifo" 2>&1
)
fi

# Clean up: Wait for keploy command to finish
wait $!
Loading

0 comments on commit 122f140

Please sign in to comment.