<commit_before>#!/bin/bash

die () {
    local message=$1
    [ -z "$message" ] && message="Failed, aborting..."
    echo "${BASH_SOURCE[1]}: line ${BASH_LINENO[0]}: ${FUNCNAME[1]}: $message" >&2
    exit 1
}

echo "Running tests..."

echo "Git version"
git --version || die

echo "Node version"
node --version || die

echo "Npm version"
npm --version || die

echo "Changing to /srv/http/apitry"
cd /srv/http/apitry/

echo "Stopping apitry service"
systemctl stop apitry.service || die

echo "Updating from git"
git pull || die

echo "Changing to /srv/http/apitry/src"
cd ./src/ || die

echo "Installing npm dependencies"
npm install || die

echo "Start apitry service"
systemctl start apitry.service || die

echo "Running tests"
npm test || die

echo "Done."<commit_msg>Added sudo commands where appropriate [skip ci]<commit_after>#!/bin/bash

die () {
    local message=$1
    [ -z "$message" ] && message="Failed, aborting..."
    echo "${BASH_SOURCE[1]}: line ${BASH_LINENO[0]}: ${FUNCNAME[1]}: $message" >&2
    exit 1
}

echo "Running tests..."

echo "Git version"
git --version || die

echo "Node version"
node --version || die

echo "Npm version"
npm --version || die

echo "Changing to /srv/http/apitry"
cd /srv/http/apitry/

echo "Stopping apitry service"
sudo systemctl stop apitry.service || die

echo "Updating from git"
sudo git pull || die

echo "Changing to /srv/http/apitry/src"
cd ./src/ || die

echo "Installing npm dependencies"
sudo npm install || die

echo "Start apitry service"
sudo systemctl start apitry.service || die

echo "Running tests"
npm test || die

echo "Done."
{'fraction_non_alphanumeric': 0.15037593984962405, 'fraction_numerical': 0.007518796992481203, 'mean_word_length': 3.7109144542772863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7673932', 'n_tokens_mistral': 581, 'n_tokens_neox': 559, 'n_words': 187}