<commit_before>#!/bin/sh

# DESCRIPTION #

# Script to run continuous integration on AppVeyor.


# VARIABLES #

# Define a heartbeat interval to periodically print messages to `stdout`:
export HEARTBEAT_INTERVAL=30s

# Define the number of lines of logged output to print upon completion:
export TAIL_LINES=500

# Define an output file to store log output:
export CI_LOG_DIR=./var/log
export CI_LOG_PATH=$CI_OUT_DIR/appveyor.log


# FUNCTIONS #

# Starts a heartbeat.
start_heartbeat() {
	echo 'Starting heartbeat...'

	# Create a heartbeat and send to background:
	heartbeat &

	# Capture the heartbeat pid:
	HEARTBEAT_PID=$!
	echo "Heartbeat pid: $HEARTBEAT_PID"
}

# Runs an infinite print loop in which output is periodically written to `stdout`.
heartbeat() {
	while true; do
		echo "$(date) - heartbeat...";
		sleep $HEARTBEAT_INTERVAL;
	done
}

# Stops the heartbeat print loop.
stop_heartbeat() {
	echo 'Stopping heartbeat...'
	kill $HEARTBEAT_PID
}

# Defines an error handler.
on_error() {
	echo 'ERROR: An error was encountered during execution.'
	cleanup
	exit 1
}

# Tails the log output.
tail_output() {
   echo "Printing the last $TAIL_LINES lines of log output..."
   tail -$TAIL_LINES $CI_LOG_PATH
}

# Runs clean-up tasks.
cleanup() {
	tail_output
	stop_heartbeat
}


# MAIN #

# Run in the top-level project directory:
cd `dirname "$0"`/../..

# Exit immediately if one of the executed commands exits with a non-zero status:
set -e

# Set an error handler to print captured output and perform any clean-up tasks:
trap 'on_error' ERR

# Create an output log file:
mkdir -p $CI_LOG_DIR
touch $CI_LOG_PATH

# Start a heartbeat:
start_heartbeat

# Run CI commands, merging `stderr` into `stdout` and redirecting logged output to file...
# echo 'Running tests...'
# make test >> $CI_LOG_PATH 2>&1

echo 'Generating test coverage report...'
make test-cov >> $CI_LOG_PATH 2>&1

echo 'Success!'

# Run cleanup tasks:
cleanup<commit_msg>Re-enable basic unit tests<commit_after>#!/bin/sh

# DESCRIPTION #

# Script to run continuous integration on AppVeyor.


# VARIABLES #

# Define a heartbeat interval to periodically print messages to `stdout`:
export HEARTBEAT_INTERVAL=30s

# Define the number of lines of logged output to print upon completion:
export TAIL_LINES=500

# Define an output file to store log output:
export CI_LOG_DIR=./var/log
export CI_LOG_PATH=$CI_OUT_DIR/appveyor.log


# FUNCTIONS #

# Starts a heartbeat.
start_heartbeat() {
	echo 'Starting heartbeat...'

	# Create a heartbeat and send to background:
	heartbeat &

	# Capture the heartbeat pid:
	HEARTBEAT_PID=$!
	echo "Heartbeat pid: $HEARTBEAT_PID"
}

# Runs an infinite print loop in which output is periodically written to `stdout`.
heartbeat() {
	while true; do
		echo "$(date) - heartbeat...";
		sleep $HEARTBEAT_INTERVAL;
	done
}

# Stops the heartbeat print loop.
stop_heartbeat() {
	echo 'Stopping heartbeat...'
	kill $HEARTBEAT_PID
}

# Defines an error handler.
on_error() {
	echo 'ERROR: An error was encountered during execution.'
	cleanup
	exit 1
}

# Tails the log output.
tail_output() {
   echo "Printing the last $TAIL_LINES lines of log output..."
   tail -$TAIL_LINES $CI_LOG_PATH
}

# Runs clean-up tasks.
cleanup() {
	tail_output
	stop_heartbeat
}


# MAIN #

# Run in the top-level project directory:
cd `dirname "$0"`/../..

# Exit immediately if one of the executed commands exits with a non-zero status:
set -e

# Set an error handler to print captured output and perform any clean-up tasks:
trap 'on_error' ERR

# Create an output log file:
mkdir -p $CI_LOG_DIR
touch $CI_LOG_PATH

# Start a heartbeat:
start_heartbeat

# Run CI commands, merging `stderr` into `stdout` and redirecting logged output to file...
echo 'Running tests...'
make test >> $CI_LOG_PATH 2>&1

echo 'Generating test coverage report...'
make test-cov >> $CI_LOG_PATH 2>&1

echo 'Success!'

# Run cleanup tasks:
cleanup
{'fraction_non_alphanumeric': 0.09710479118626697, 'fraction_numerical': 0.005636689725851908, 'mean_word_length': 4.06355382619974, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '1418251', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1261, 'n_words': 474}