<commit_before>#!/bin/bash

set -exu

apt update
apt install -V -y lsb-release wget

code_name=$(lsb_release --codename --short)
architecture=$(dpkg --print-architecture)

wget \
  https://packages.groonga.org/debian/groonga-apt-source-latest-${code_name}.deb
apt install -V -y ./groonga-apt-source-latest-${code_name}.deb
apt update

repositories_dir=/groonga/packages/apt/repositories
apt install -V -y \
  ${repositories_dir}/debian/pool/${code_name}/main/*/*/*_{${architecture},all}.deb

groonga --version
if [ "${architecture}" != "i386" ]; then
  if ! groonga --version | grep -q apache-arrow; then
    echo "Apache Arrow isn't enabled"
    exit 1
  fi
fi

mkdir -p /test
cd /test
cp -a /groonga/test/command ./
if [ "${architecture}" = "i386" ]; then
  rm command/suite/ruby/eval/convert/string_to_time/over_int32.test
  # TODO: debug this
  rm command/suite/select/filter/geo_in_circle/no_index/north_east.test
  # Float32 value format is different.
  rm command/suite/tokenizers/document_vector_tf_idf/alphabet.test
  rm command/suite/tokenizers/document_vector_tf_idf/reindex.test
  rm command/suite/tokenizers/document_vector_tf_idf/token_column.test
  rm command/suite/tokenizers/document_vector_tf_idf/token_column_different_lexicon.test
  rm command/suite/tokenizers/document_vector_bm25/alphabet.test
  rm command/suite/tokenizers/document_vector_bm25/normalize_false.test
  rm command/suite/tokenizers/document_vector_bm25/reindex.test
elif [ "${architecture}" = "arm64" ]; then
  # Float32 value format is different.
  rm command/suite/tokenizers/document_vector_bm25/alphabet.test
  rm command/suite/tokenizers/document_vector_bm25/reindex.test
  rm command/suite/tokenizers/document_vector_bm25/token_column.test
  rm command/suite/tokenizers/document_vector_bm25/token_column_different_lexicon.test
fi

# libxxhash-dev 0.8.0 or later is required.
rm command/suite/select/drilldowns/keys/multiple_large.test

apt install -V -y \
  gcc \
  make \
  ruby-dev
MAKEFLAGS=-j$(nproc) gem install grntest

if groonga --version | grep -q apache-arrow; then
  apt install -V -y \
    g++
  MAKEFLAGS=-j$(nproc) gem install red-arrow
fi

export TZ=Asia/Tokyo

grntest_options=()
grntest_options+=(--base-directory=command)
grntest_options+=(--n-retries=2)
grntest_options+=(--n-workers=$(nproc))
grntest_options+=(--reporter=mark)
grntest_options+=(command/suite)
grntest "${grntest_options[@]}"
if [ "${architecture}" != "arm64" ]; then
  grntest "${grntest_options[@]}" --interface http
  grntest "${grntest_options[@]}" --interface http --testee groonga-httpd
fi<commit_msg>ci packages: don't run tests against arm64 packages<commit_after>#!/bin/bash

set -exu

apt update
apt install -V -y lsb-release wget

code_name=$(lsb_release --codename --short)
architecture=$(dpkg --print-architecture)

wget \
  https://packages.groonga.org/debian/groonga-apt-source-latest-${code_name}.deb
apt install -V -y ./groonga-apt-source-latest-${code_name}.deb
apt update

repositories_dir=/groonga/packages/apt/repositories
apt install -V -y \
  ${repositories_dir}/debian/pool/${code_name}/main/*/*/*_{${architecture},all}.deb

groonga --version
if [ "${architecture}" != "i386" ]; then
  if ! groonga --version | grep -q apache-arrow; then
    echo "Apache Arrow isn't enabled"
    exit 1
  fi
fi

mkdir -p /test
cd /test
cp -a /groonga/test/command ./
if [ "${architecture}" = "i386" ]; then
  rm command/suite/ruby/eval/convert/string_to_time/over_int32.test
  # TODO: debug this
  rm command/suite/select/filter/geo_in_circle/no_index/north_east.test
  # Float32 value format is different.
  rm command/suite/tokenizers/document_vector_tf_idf/alphabet.test
  rm command/suite/tokenizers/document_vector_tf_idf/reindex.test
  rm command/suite/tokenizers/document_vector_tf_idf/token_column.test
  rm command/suite/tokenizers/document_vector_tf_idf/token_column_different_lexicon.test
  rm command/suite/tokenizers/document_vector_bm25/alphabet.test
  rm command/suite/tokenizers/document_vector_bm25/normalize_false.test
  rm command/suite/tokenizers/document_vector_bm25/reindex.test
elif [ "${architecture}" = "arm64" ]; then
  # Float32 value format is different.
  rm command/suite/tokenizers/document_vector_bm25/alphabet.test
  rm command/suite/tokenizers/document_vector_bm25/reindex.test
  rm command/suite/tokenizers/document_vector_bm25/token_column.test
  rm command/suite/tokenizers/document_vector_bm25/token_column_different_lexicon.test
fi

# libxxhash-dev 0.8.0 or later is required.
rm command/suite/select/drilldowns/keys/multiple_large.test

apt install -V -y \
  gcc \
  make \
  ruby-dev
MAKEFLAGS=-j$(nproc) gem install grntest

if groonga --version | grep -q apache-arrow; then
  apt install -V -y \
    g++
  MAKEFLAGS=-j$(nproc) gem install red-arrow
fi

export TZ=Asia/Tokyo

grntest_options=()
grntest_options+=(--base-directory=command)
grntest_options+=(--n-retries=2)
grntest_options+=(--n-workers=$(nproc))
grntest_options+=(--reporter=mark)
grntest_options+=(command/suite)
# There are some problems for running arm64 tests:
#   * Too long test time because of QEMU
#   * Unknown crash with bullseye
if [ "${architecture}" != "arm64" ]; then
  grntest "${grntest_options[@]}"
  grntest "${grntest_options[@]}" --interface http
  grntest "${grntest_options[@]}" --interface http --testee groonga-httpd
fi
{'fraction_non_alphanumeric': 0.129261895841139, 'fraction_numerical': 0.013862869988759834, 'mean_word_length': 4.643763213530655, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6160103', 'n_tokens_mistral': 1979, 'n_tokens_neox': 1870, 'n_words': 365}