<commit_before>#!/bin/bash

# Read here: https://coderwall.com/p/fkfaqq/safer-bash-scripts-with-set-euxo-pipefail
set -euo pipefail

function on_error {
    echo "Something failed..."
    sleep 5
}
trap on_error ERR

# Read arguments
CONFIG="${1:-Release}"
ARCH="${2:-x86}"

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Install dependencies
$CURRENT_DIR/install-dependencies.sh $CONFIG $ARCH

echo "Building config '$CONFIG'..."
cmake -E make_directory build
# Generate
cmake -E chdir build \
    cmake .. -DCMAKE_BUILD_TYPE=$CONFIG -DCMAKE_INSTALL_PREFIX=output -DDOWNLOAD_ENABLED=FALSE

# Build
cmake -E chdir build \
    cmake --build . --config $CONFIG

# Run unit tests
cmake -E chdir build \
    ctest --build-config $CONFIG --parallel 2 --label-regex "unit" --output-on-failure

# Install
cmake -E chdir build \
    cmake --build . --target install --config $CONFIG

sleep 3<commit_msg>Fixed build.sh to use cmake toolchains to setup environment. Toolchain is determined from current environment (OS, ARCH & COMPILER), and are setup t properly match conan dependencies.<commit_after>#!/bin/bash

# Read here: https://coderwall.com/p/fkfaqq/safer-bash-scripts-with-set-euxo-pipefail
set -euo pipefail

function on_error {
    echo "Something failed..."
    sleep 5
}
trap on_error ERR

# Read arguments
CONFIG="${1:-Release}"
ARCH="${2:-x86_64}"

CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TOOLCHAIN=$($CURRENT_DIR/determine-toolchain.sh 2>&1 >/dev/null)
TOOLCHAIN_DIR="$CURRENT_DIR/../cmake/toolchain"
BUILD_DIR="$CURRENT_DIR/../build"

# Install dependencies
$CURRENT_DIR/install-dependencies.sh $CONFIG $ARCH

echo "Building for '$CONFIG $ARCH'..."
cmake -E make_directory $BUILD_DIR
# Generate
cmake -E chdir $BUILD_DIR \
    cmake .. -DCMAKE_BUILD_TYPE=$CONFIG -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_DIR/$TOOLCHAIN.cmake" -DCMAKE_INSTALL_PREFIX=output -DDOWNLOAD_ENABLED=FALSE

# Build
cmake -E chdir $BUILD_DIR \
    cmake --build . --config $CONFIG

# Run unit tests
cmake -E chdir $BUILD_DIR \
    ctest --build-config $CONFIG --parallel 2 --label-regex "unit" --output-on-failure

# Install
cmake -E chdir $BUILD_DIR \
    cmake --build . --target install --config $CONFIG

sleep 3
{'fraction_non_alphanumeric': 0.14228187919463087, 'fraction_numerical': 0.008948545861297539, 'mean_word_length': 3.8820960698689957, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1951292', 'n_tokens_mistral': 793, 'n_tokens_neox': 755, 'n_words': 201}