<commit_before>#!/bin/bash

set -e

rev=$(git rev-parse --short --default HEAD $rev)
subdir="locker-$rev"
top="$PWD"
out="$PWD/locker-$rev.tar.gz"
builddir="$top/build"
buildlog="$(tempfile build)"

rm -rf "$builddir"
mkdir -p "$builddir/$subdir"

trap "rm -rf \"$builddir\"" EXIT

# fetch a clean copy of the code from git
echo "Fetching code..."
git archive $rev | tar -x -C "$builddir/$subdir"

echo "Building..."
cd "$builddir/$subdir"
npm install 2>&1 | tee -a "$buildlog"

echo "Compressing..."
(cd "$builddir"; tar czf "$out" "$subdir")

# The test suite doesn't clean up after itself, so do this last
#echo "Testing..."
#cd "$builddir/$subdir/tests"
#if ! node runTests.js; then
#    echo "Tests failed!"
#    rm -f "$out"
#    exit 1
#fi

echo "Done."<commit_msg>Use the build number from jenkins if available<commit_after>#!/bin/bash

set -e

rev=$(git rev-parse --short --default HEAD $rev)
build_id=${BUILD_NUMBER:-$rev}
subdir="locker-$rev"
top="$PWD"
out="$PWD/locker-$build_id.tar.gz"
builddir="$top/build"
buildlog="$(tempfile build)"

rm -rf "$builddir"
mkdir -p "$builddir/$subdir"

trap "rm -rf \"$builddir\"" EXIT

# fetch a clean copy of the code from git
echo "Fetching code..."
git archive $rev | tar -x -C "$builddir/$subdir"

echo "Building..."
cd "$builddir/$subdir"
npm install 2>&1 | tee -a "$buildlog"

echo "Compressing..."
(cd "$builddir"; tar czf "$out" "$subdir")

# The test suite doesn't clean up after itself, so do this last
#echo "Testing..."
#cd "$builddir/$subdir/tests"
#if ! node runTests.js; then
#    echo "Tests failed!"
#    rm -f "$out"
#    exit 1
#fi

echo "Done."
{'fraction_non_alphanumeric': 0.18784872907625544, 'fraction_numerical': 0.0037197768133911966, 'mean_word_length': 3.86144578313253, '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': '2506208', 'n_tokens_mistral': 614, 'n_tokens_neox': 591, 'n_words': 195}