db: return a value of grn_rc type instead of void #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
on: | |
push: | |
branches: | |
- main | |
- 'maintenance/**' | |
tags: | |
- '*' | |
paths: | |
- '**/*.cmake' | |
- '**/*.cmake.in' | |
- '**/CMakeLists.txt' | |
- '.github/workflows/cmake.yml' | |
- 'Brewfile' | |
- 'ci/**' | |
- 'cmake/**' | |
- 'include/**/*.h' | |
- 'include/**/*.h.in' | |
- 'include/**/*.hpp' | |
- 'lib/**/*.c' | |
- 'lib/**/*.cpp' | |
- 'lib/**/*.h' | |
- 'lib/**/*.hpp' | |
- 'lib/**/*.rb' | |
- 'plugins/**/*.c' | |
- 'plugins/**/*.cpp' | |
- 'plugins/**/*.h' | |
- 'plugins/**/*.rb' | |
- 'src/**/*.c' | |
- 'src/**/*.h' | |
- 'test/command/**' | |
- 'test/command_line/**' | |
- 'test/mruby/**' | |
- 'vendor/mruby/**' | |
pull_request: | |
paths: | |
- '**/*.cmake' | |
- '**/*.cmake.in' | |
- '**/CMakeLists.txt' | |
- '.github/workflows/cmake.yml' | |
- 'Brewfile' | |
- 'ci/**' | |
- 'cmake/**' | |
- 'include/**/*.h' | |
- 'include/**/*.h.in' | |
- 'include/**/*.hpp' | |
- 'lib/**/*.c' | |
- 'lib/**/*.cpp' | |
- 'lib/**/*.h' | |
- 'lib/**/*.rb' | |
- 'lib/**/*.rb' | |
- 'plugins/**/*.c' | |
- 'plugins/**/*.cpp' | |
- 'plugins/**/*.h' | |
- 'plugins/**/*.rb' | |
- 'src/**/*.c' | |
- 'src/**/*.h' | |
- 'test/command/**' | |
- 'test/command_line/**' | |
- 'test/mruby/**' | |
- 'vendor/mruby/**' | |
concurrency: | |
group: ${{ github.head_ref || github.sha }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
linux: | |
name: Linux | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- cc: gcc | |
cxx: g++ | |
- cc: gcc | |
cxx: g++ | |
mruby: "OFF" | |
- cc: clang | |
cxx: clang++ | |
runs-on: ubuntu-latest | |
timeout-minutes: 90 | |
env: | |
CC: ${{ matrix.cc }} | |
CXX: ${{ matrix.cxx }} | |
GRN_WITH_MRUBY: ${{ matrix.mruby }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Prepare ccache | |
run: | | |
echo "CCACHE_DIR=${PWD}/ccache" >> ${GITHUB_ENV} | |
- name: Cache ccache | |
uses: actions/cache@v4 | |
with: | |
path: ccache | |
key: cmake-linux-${{ matrix.cc }}-ccache-${{ hashFiles('lib/**', 'src/**', 'plugins/**', 'include/**') }} | |
restore-keys: cmake-linux-${{ matrix.cc }}-ccache- | |
- name: Enable Apache Arrow repository | |
run: | | |
sudo apt update -o="APT::Acquire::Retries=3" | |
sudo apt install -y -V -o="APT::Acquire::Retries=3" \ | |
lsb-release \ | |
wget | |
# Always use RC version to detect Apache Arrow related | |
# problems as fast as possible. Released Apache Arrow is | |
# tested in package related jobs. | |
wget https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')-rc/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb | |
sudo apt install -y -V ./apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb | |
sudo sed \ | |
-i"" \ | |
-e "s,^URIs: \\(.*\\)/,URIs: \\1-rc/,g" \ | |
/etc/apt/sources.list.d/apache-arrow.sources | |
- name: Install packages | |
run: | | |
sudo apt update -o="APT::Acquire::Retries=3" | |
sudo apt install -y -V -o="APT::Acquire::Retries=3" \ | |
ccache \ | |
cmake \ | |
gdb \ | |
gettext \ | |
libarrow-dev \ | |
libedit-dev \ | |
libevent-dev \ | |
libluajit-5.1-dev \ | |
liblz4-dev \ | |
libmecab-dev \ | |
libmsgpack-dev \ | |
libsimdjson-dev \ | |
libstemmer-dev \ | |
libxxhash-dev \ | |
libzstd-dev \ | |
mecab-naist-jdic \ | |
ninja-build \ | |
rapidjson-dev \ | |
ruby-dev \ | |
zlib1g-dev | |
- name: CMake | |
run: | | |
ccache --show-stats --verbose --version || : | |
cmake \ | |
-B ../groonga.build \ | |
-S . \ | |
-GNinja \ | |
-DCMAKE_INSTALL_PREFIX=$PWD/install \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DGRN_ALLOW_WARNING=OFF \ | |
-DGRN_WITH_APACHE_ARROW=ON \ | |
-DGRN_WITH_BLOSC=auto \ | |
-DGRN_WITH_MRUBY=${GRN_WITH_MRUBY:-ON} | |
- name: Build | |
run: | | |
ninja -C ../groonga.build | |
ccache --show-stats --verbose --version || : | |
- name: Install | |
run: | | |
ninja -C ../groonga.build install | |
- name: Set environment variables | |
run: | | |
echo "COLUMNS=79" >> ${GITHUB_ENV} | |
echo "LD_LIBRARY_PATH=$PWD/install/lib" >> ${GITHUB_ENV} | |
echo "PKG_CONFIG_PATH=$PWD/lib/pkgconfig" >> ${GITHUB_ENV} | |
echo "TZ=Asia/Tokyo" >> ${GITHUB_ENV} | |
if [ "${{ matrix.cc }}" == "gcc" -a \ | |
"${{ matrix.mruby }}" == "" ]; then | |
echo "GRN_TEST_RUN_ALL=yes" >> ${GITHUB_ENV} | |
fi | |
if [ -e "install/bin/grndb" ] ; then | |
echo "GRN_TEST_RUN_COMMAND_LINE=yes" >> ${GITHUB_ENV} | |
fi | |
echo "$PWD/install/bin" >> ${GITHUB_PATH} | |
- name: Install test dependencies | |
run: | | |
sudo env MAKEFLAGS=-j$(nproc) gem install \ | |
grntest \ | |
pkg-config \ | |
red-arrow \ | |
rroonga | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/red-datasets | |
key: red-datasets-ubuntu | |
- name: "Test: command line" | |
if: env.GRN_TEST_RUN_COMMAND_LINE == 'yes' | |
run: | | |
test/command_line/run-test.rb --groonga-install-prefix=$PWD/install | |
- name: "Test: mruby" | |
if: env.GRN_TEST_RUN_ALL == 'yes' | |
run: | | |
USE_SYSTEM=yes test/mruby/run-test.rb | |
- name: "Test: stdio" | |
run: | | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
test/command/suite | |
- name: "Test: stdio: optimize" | |
if: env.GRN_TEST_RUN_ALL == 'yes' | |
run: | | |
export GRN_EXPR_OPTIMIZE=yes | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
test/command/suite | |
- name: "Test: stdio: NFKC121" | |
if: env.GRN_TEST_RUN_ALL == 'yes' | |
run: | | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
test/command/suite/normalizers/nfkc/ | |
env: | |
NFKC: "121" | |
- name: "Test: stdio: NFKC130" | |
if: env.GRN_TEST_RUN_ALL == 'yes' | |
run: | | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
test/command/suite/normalizers/nfkc/ | |
env: | |
NFKC: "130" | |
- name: "Test: stdio: NFKC150" | |
if: env.GRN_TEST_RUN_ALL == 'yes' | |
run: | | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
test/command/suite/normalizers/nfkc/ | |
env: | |
NFKC: "150" | |
- name: "Test: stdio: n_workers" | |
if: env.GRN_TEST_RUN_ALL == 'yes' | |
run: | | |
export GRN_N_WORKERS_DEFAULT=-1 | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
test/command/suite | |
- name: "Test: HTTP: load: Apache Arrow" | |
if: env.GRN_TEST_RUN_ALL == 'yes' | |
run: | | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
--input-type=apache-arrow \ | |
--interface=http \ | |
test/command/suite | |
- name: "Test: HTTP: load: Apache Arrow: n_workers" | |
if: env.GRN_TEST_RUN_ALL == 'yes' | |
run: | | |
export GRN_N_WORKERS_DEFAULT=-1 | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
--input-type=apache-arrow \ | |
--interface=http \ | |
test/command/suite/load | |
- name: "Test: HTTP: command: POST" | |
if: env.GRN_TEST_RUN_ALL == 'yes' | |
run: | | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
--input-type=apache-arrow \ | |
--interface=http \ | |
--use-http-post \ | |
test/command/suite | |
- name: "Test: HTTP: command: chunked" | |
if: env.GRN_TEST_RUN_ALL == 'yes' | |
run: | | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--timeout=10 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
--input-type=apache-arrow \ | |
--interface=http \ | |
--use-http-chunked \ | |
test/command/suite | |
- name: "Test: HTTP: reference count" | |
if: env.GRN_TEST_RUN_ALL == 'yes' | |
run: | | |
export GRN_ENABLE_REFERENCE_COUNT=yes | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
--interface=http \ | |
test/command/suite | |
docker: | |
name: Docker | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- "alpine-3.20" | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Login to GitHub Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Pull | |
continue-on-error: true | |
run: | | |
docker compose pull ${{ matrix.target }} | |
- name: Build | |
run: | | |
docker compose build ${{ matrix.target }} | |
- name: Run | |
run: | | |
docker compose run ${{ matrix.target }} | |
- name: Push | |
if: github.ref_name == 'main' | |
continue-on-error: true | |
run: | | |
docker compose push ${{ matrix.target }} | |
macos: | |
name: macOS | |
runs-on: macos-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install packages | |
run: | | |
brew bundle | |
- name: Prepare ccache | |
run: | | |
echo "CCACHE_DIR=${PWD}/ccache" >> ${GITHUB_ENV} | |
- name: Cache ccache | |
uses: actions/cache@v4 | |
with: | |
path: ccache | |
key: cmake-macos-ccache-${{ hashFiles('lib/**', 'src/**', 'plugins/**', 'include/**') }} | |
restore-keys: cmake-macos-ccache- | |
- name: Run CMake | |
run: | | |
ccache --show-stats --verbose --version || : | |
export SDKROOT="$(xcrun --show-sdk-path)" | |
cmake \ | |
-B ../groonga.build \ | |
-S . \ | |
-GNinja \ | |
-DCMAKE_INSTALL_PREFIX=/usr/local \ | |
-DCMAKE_BUILD_TYPE=Debug \ | |
-DGRN_ALLOW_WARNING=OFF \ | |
-DGRN_WITH_APACHE_ARROW=ON \ | |
-DGRN_WITH_BLOSC=auto \ | |
-DGRN_WITH_MRUBY=ON \ | |
-DRUBY=$(which ruby) | |
- name: Build | |
run: | | |
ninja -C ../groonga.build | |
ccache --show-stats --verbose --version || : | |
- name: Install | |
run: | | |
sudo ninja -C ../groonga.build install | |
- name: Install test dependencies | |
run: | | |
MAKEFLAGS=-j$(nproc) gem install \ | |
grntest \ | |
pkg-config \ | |
rroonga | |
brew install apache-arrow-glib | |
MAKEFLAGS=-j$(nproc) gem install \ | |
--version $(pkg-config --modversion arrow-glib) \ | |
red-arrow | |
- name: Set environment variables | |
run: | | |
echo "COLUMNS=79" >> ${GITHUB_ENV} | |
echo "TZ=Asia/Tokyo" >> ${GITHUB_ENV} | |
- name: "Test: command line" | |
# TODO: I don't know why but this is too slow on macOS... | |
if: false | |
run: | | |
test/command_line/run-test.rb \ | |
--groonga-install-prefix=/usr/local \ | |
-v | |
- name: "Test: mruby" | |
# TODO: Disabled temporarily as a workaround for the rpath issue in Rroonga. | |
if: false | |
run: | | |
USE_SYSTEM=yes test/mruby/run-test.rb | |
- name: "Test: stdio" | |
run: | | |
DYLD_LIBRARY_PATH=/usr/local/lib \ | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
test/command/suite | |
- name: "Test: HTTP: load: Apache Arrow" | |
run: | | |
DYLD_LIBRARY_PATH=/usr/local/lib \ | |
grntest \ | |
--base-dir test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
--input-type=apache-arrow \ | |
--interface=http \ | |
test/command/suite | |
windows-mingw: | |
name: Windows MinGW | |
runs-on: windows-latest | |
timeout-minutes: 45 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- msystem: MINGW64 | |
package-prefix: mingw-w64-x86_64 | |
- msystem: UCRT64 | |
package-prefix: mingw-w64-ucrt-x86_64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/checkout@v4 | |
with: | |
repository: msys2/MINGW-packages | |
path: ci/msys2/MINGW-packages | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.msystem }} | |
update: true | |
install: >- | |
${{ matrix.package-prefix }}-ccache | |
${{ matrix.package-prefix }}-toolchain | |
${{ matrix.package-prefix }}-ruby | |
${{ matrix.package-prefix }}-xsimd | |
base-devel | |
binutils | |
git | |
msys2-devel | |
pactoys | |
- name: Prepare | |
shell: msys2 {0} | |
run: | | |
set -ex | |
cd ci/msys2 | |
sed -i'' -e 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf | |
MINGW-packages/.ci/fetch-validpgpkeys.sh | |
- name: Prepare ccache | |
shell: msys2 {0} | |
run: | | |
echo "CCACHE_DIR=${PWD}/ccache" >> ${GITHUB_ENV} | |
- name: Cache ccache | |
uses: actions/cache@v4 | |
with: | |
path: ccache | |
key: cmake-windows-mingw-${{ matrix.msystem }}-ccache-${{ hashFiles('lib/**', 'src/**', 'plugins/**', 'include/**') }} | |
restore-keys: cmake-windows-mingw-${{ matrix.msystem }}-ccache- | |
- name: Build | |
shell: msys2 {0} | |
run: | | |
set -ex | |
version=$(cat base_version) | |
rake dist | |
mv groonga-${version}.tar.gz ci/msys2/ | |
cd ci/msys2 | |
sed -i'' -e "s/^pkgver=/pkgver=${version}/" PKGBUILD | |
MINGW_ARCH=${{ matrix.msystem }} \ | |
makepkg-mingw \ | |
--cleanbuild \ | |
--nocheck \ | |
--noconfirm \ | |
--noprogressbar \ | |
--rmdeps \ | |
--syncdeps | |
ccache --show-stats --verbose --version || : | |
- name: Install | |
shell: msys2 {0} | |
run: | | |
set -ex | |
cd ci/msys2 | |
pacman \ | |
--noconfirm \ | |
--noprogressbar \ | |
--upgrade \ | |
*.pkg.tar.* | |
cp -a *.pkg.tar.* ../../ | |
# Artifact | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.msystem }} | |
path: "*.pkg.tar.*" | |
# Test | |
- name: Use JST | |
run: | | |
Set-TimeZone -Id "Tokyo Standard Time" | |
- name: Install test dependencies | |
shell: msys2 {0} | |
run: | | |
# "fiddle" is for ensuring using the installed system libffi | |
MAKEFLAGS=-j$(nproc) gem install \ | |
fiddle \ | |
grntest \ | |
pkg-config \ | |
red-arrow | |
ruby -e "require 'arrow'" | |
- name: Prepare setup-extpp.rb | |
shell: msys2 {0} | |
run: | | |
cat <<RUBY > setup-extpp.rb | |
["extpp"].each do |gem| | |
spec = Gem::Specification.find_by_name(gem) | |
ENV["PATH"] = [ | |
File.join(spec.full_gem_path, "lib"), | |
ENV["PATH"], | |
].join(File::PATH_SEPARATOR) | |
end | |
RUBY | |
- name: "Test: command line" | |
shell: msys2 {0} | |
run: | | |
ruby test/command_line/run-test.rb | |
- name: "Test: stdio" | |
shell: msys2 {0} | |
run: | | |
ruby \ | |
-r./setup-extpp \ | |
-S \ | |
grntest \ | |
--base-directory=test/command \ | |
--n-retries=2 \ | |
--read-timeout=30 \ | |
--reporter=mark \ | |
--timeout=60 \ | |
test/command/suite | |
windows-msvc: | |
name: Windows MSVC | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runs-on: windows-2022 | |
vc-toolset-version: 143 | |
vs-version: 2022 | |
- runs-on: windows-2019 | |
vc-toolset-version: 142 | |
vs-version: 2019 | |
env: | |
VC_ARCHITECTURE: x64 | |
runs-on: ${{ matrix.runs-on }} | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/checkout@v4 | |
with: | |
path: apache-arrow | |
ref: apache-arrow-16.1.0 | |
repository: apache/arrow | |
submodules: recursive | |
# Use CMake 3.27 not 3.26. | |
# Workaround: https://github.com/actions/runner-images/issues/8598 | |
- name: Remove Strawberry Perl | |
run: | | |
Remove-Item C:\Strawberry -Force -Recurse | |
- name: Disable crash dialog | |
run: | | |
reg add "HKCU\SOFTWARE\Microsoft\Windows\Windows Error Reporting" ` | |
/v DontShowUI ` | |
/t REG_DWORD ` | |
/d 1 ` | |
/f | |
- name: Use JST | |
run: | | |
Set-TimeZone -Id "Tokyo Standard Time" | |
- name: Download bundled packages | |
run: | | |
cd vendor | |
ruby download_groonga_normalizer_mysql.rb | |
ruby download_lz4.rb | |
ruby download_mecab.rb | |
ruby download_rapidjson.rb | |
ruby download_xxhash.rb | |
ruby download.rb | |
- name: Set environments | |
run: | | |
Write-Output "CMAKE_BUILD_PARALLEL_LEVEL=${Env:NUMBER_OF_PROCESSORS}" | ` | |
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
$GROONGA_VERSION = (Get-Content base_version) | |
if (!("${Env:GITHUB_REF}".StartsWith("refs/tags/"))) { | |
$GROONGA_VERSION += "-$(${Env:GITHUB_SHA}.Substring(0, 7))" | |
} | |
Write-Output "GROONGA_VERSION=${GROONGA_VERSION}" | ` | |
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
$INSTALL_FOLDER = "groonga-${GROONGA_VERSION}-${Env:VC_ARCHITECTURE}-vs${{ matrix.vs-version }}" | |
$INSTALL_FOLDER_WITH_VCRUNTIME = "${INSTALL_FOLDER}-with-vcruntime" | |
$INSTALL_PARENT_FOLDER = "install" | |
$INSTALL_PARENT_FOLDER_WITH_VCRUNTIME = ` | |
"${INSTALL_PARENT_FOLDER}-with-vcruntime" | |
$RELATIVE_INSTALL_FOLDER = "${INSTALL_PARENT_FOLDER}\${INSTALL_FOLDER}" | |
$RELATIVE_INSTALL_FOLDER_WITH_VCRUNTIME = ` | |
"${INSTALL_PARENT_FOLDER_WITH_VCRUNTIME}\${INSTALL_FOLDER_WITH_VCRUNTIME}" | |
$FULL_INSTALL_FOLDER = ` | |
"${Env:GITHUB_WORKSPACE}\${RELATIVE_INSTALL_FOLDER}" | |
$FULL_INSTALL_FOLDER_WITH_VCRUNTIME = ` | |
"${Env:GITHUB_WORKSPACE}\${RELATIVE_INSTALL_FOLDER_WITH_VCRUNTIME}" | |
Write-Output "INSTALL_FOLDER=${INSTALL_FOLDER}" | ` | |
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "INSTALL_FOLDER_WITH_VCRUNTIME=${INSTALL_FOLDER_WITH_VCRUNTIME}" | ` | |
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "FULL_INSTALL_FOLDER=${FULL_INSTALL_FOLDER}" | ` | |
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "FULL_INSTALL_FOLDER_WITH_VCRUNTIME=${FULL_INSTALL_FOLDER_WITH_VCRUNTIME}" | ` | |
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
if (${{ matrix.vs-version }} -ge 2022) { | |
$VC_PREFIX = "C:\Program Files\Microsoft Visual Studio\${{ matrix.vs-version }}\Enterprise\VC" | |
} | |
else { | |
$VC_PREFIX = "C:\Program Files (x86)\Microsoft Visual Studio\${{ matrix.vs-version }}\Enterprise\VC" | |
} | |
Write-Output "VC_PREFIX=${VC_PREFIX}" | ` | |
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
Write-Output "CCACHE_DIR=${{ github.workspace }}\ccache" | ` | |
Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Cache ccache | |
uses: actions/cache@v4 | |
with: | |
path: ccache | |
key: cmake-windows-msvc-${{ matrix.vs-version }}-ccache-${{ hashFiles('lib/**', 'src/**', 'plugins/**', 'include/**') }} | |
restore-keys: cmake-windows-msvc-${{ matrix.vs-version }}-ccache- | |
- name: Prepare ccache | |
run: | | |
choco install ccache | |
Get-Command ccache | |
(Get-Command ccache).Source | |
ccache --show-stats --verbose --version | |
- name: Set version | |
run: | | |
"GRN_VERSION=${Env:GROONGA_VERSION}" | Set-Content version.sh | |
- name: Install Apache Arrow | |
shell: cmd | |
run: | | |
call "%VC_PREFIX%\Auxiliary\Build\vcvarsall.bat" %VC_ARCHITECTURE% | |
set CMAKE_ARGS=-S apache-arrow\cpp | |
set CMAKE_ARGS=%CMAKE_ARGS% -B ..\apache-arrow-build | |
set CMAKE_ARGS=%CMAKE_ARGS% -G Ninja | |
set CMAKE_ARGS=%CMAKE_ARGS% -DARROW_BUILD_STATIC=OFF | |
set CMAKE_ARGS=%CMAKE_ARGS% -DARROW_COMPUTE=ON | |
set CMAKE_ARGS=%CMAKE_ARGS% -DBoost_SOURCE=BUNDLED | |
set CMAKE_ARGS=%CMAKE_ARGS% -DCMAKE_BUILD_TYPE=RelWithDebInfo | |
set CMAKE_ARGS=%CMAKE_ARGS% -DCMAKE_INSTALL_PREFIX=%FULL_INSTALL_FOLDER% | |
set CMAKE_ARGS=%CMAKE_ARGS% -DCMAKE_UNITY_BUILD=ON | |
cmake %CMAKE_ARGS% || (type ..\apache-arrow-build\CMakeFiles\CMakeError.log & exit /B) | |
cmake --build ..\apache-arrow-build || exit /B | |
cmake --install ..\apache-arrow-build || exit /B | |
ccache --show-stats --verbose --version | |
- name: Install Groonga | |
shell: cmd | |
run: | | |
call "%VC_PREFIX%\Auxiliary\Build\vcvarsall.bat" %VC_ARCHITECTURE% | |
set CMAKE_ARGS=-S . | |
set CMAKE_ARGS=%CMAKE_ARGS% -B ..\groonga-build | |
set CMAKE_ARGS=%CMAKE_ARGS% -G "Ninja" | |
set CMAKE_ARGS=%CMAKE_ARGS% "-DCMAKE_INSTALL_PREFIX=%FULL_INSTALL_FOLDER%" | |
set CMAKE_ARGS=%CMAKE_ARGS% -DCMAKE_BUILD_TYPE=RelWithDebInfo | |
set CMAKE_ARGS=%CMAKE_ARGS% -DGRN_ALLOW_WARNING=ON | |
set CMAKE_ARGS=%CMAKE_ARGS% -DGRN_WITH_APACHE_ARROW=ON | |
set CMAKE_ARGS=%CMAKE_ARGS% -DGRN_WITH_BLOSC=auto | |
set CMAKE_ARGS=%CMAKE_ARGS% -DGRN_WITH_MRUBY=ON | |
set CMAKE_ARGS=%CMAKE_ARGS% -DGRN_WITH_XXHASH=bundled | |
set CMAKE_ARGS=%CMAKE_ARGS% -DGRN_WITH_ZLIB=no | |
set CMAKE_ARGS=%CMAKE_ARGS% -DGRN_WITH_ZSTD=bundled | |
set CMAKE_ARGS=%CMAKE_ARGS% -DGROONGA_NORMALIZER_MYSQL_DOC_DIR=share/groonga-normalizer-mysql | |
cmake %CMAKE_ARGS% || (type ..\groonga-build\CMakeFiles\CMakeError.log & exit /B) | |
cmake --build ..\groonga-build || exit /B | |
cmake --install ..\groonga-build || exit /B | |
ccache --show-stats --verbose --version | |
- name: Install Groonga Admin | |
run: | | |
cd "${Env:FULL_INSTALL_FOLDER}\share\groonga\html" | |
Move-Item admin admin.old | |
Invoke-WebRequest ` | |
-Uri "https://packages.groonga.org/source/groonga-admin/groonga-admin.tar.gz" ` | |
-OutFile "groonga-admin.tar.gz" | |
tar xf groonga-admin.tar.gz | |
Remove-Item groonga-admin.tar.gz -Force | |
Move-Item groonga-admin-*\html admin | |
Remove-Item groonga-admin-*\source -Force -Recurse | |
Move-Item groonga-admin-* ..\groonga-admin | |
# Artifact | |
- name: Compress the artifact without VC++ runtime | |
run: | | |
pushd "${Env:FULL_INSTALL_FOLDER}\.." | |
Compress-Archive ` | |
-Path ${Env:INSTALL_FOLDER} ` | |
-DestinationPath "${Env:FULL_INSTALL_FOLDER}.zip" | |
popd | |
Copy-Item ` | |
"${Env:FULL_INSTALL_FOLDER}.zip" ` | |
"${Env:INSTALL_FOLDER}.zip" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.INSTALL_FOLDER }} | |
path: ${{ env.INSTALL_FOLDER }}.zip | |
- name: Prepare artifacts with VC++ runtime | |
run: | | |
Set-PSDebug -Trace 2 | |
New-Item ` | |
-Path "${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}\.." ` | |
-ItemType Directory | |
Copy-Item -Recurse ` | |
"${Env:FULL_INSTALL_FOLDER}" ` | |
"${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}" | |
$GROONGA_VC_REDIST_LICENSE_DIR = ` | |
"${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}\share\groonga\vcruntime" | |
New-Item ` | |
-Path "${GROONGA_VC_REDIST_LICENSE_DIR}" ` | |
-ItemType Directory | |
$VC_REDIST_VERSION = (Get-Content "${Env:VC_PREFIX}\Auxiliary\Build\Microsoft.VCRedistVersion.default.txt") | |
$VC_REDIST_DIR = "${Env:VC_PREFIX}\Redist\MSVC\${VC_REDIST_VERSION}\${Env:VC_ARCHITECTURE}\Microsoft.VC${{ matrix.vc-toolset-version }}.CRT" | |
$VC_REDIST_DIR_OPEN_MP = "${Env:VC_PREFIX}\Redist\MSVC\${VC_REDIST_VERSION}\${Env:VC_ARCHITECTURE}\Microsoft.VC${{ matrix.vc-toolset-version }}.OpenMP" | |
$VC_REDIST_VCRUNTIME = "${VC_REDIST_DIR}\vcruntime140.dll" | |
$VC_REDIST_VCRUNTIME_1 = "${VC_REDIST_DIR}\vcruntime140_1.dll" | |
$VC_REDIST_MSVCP = "${VC_REDIST_DIR}\msvcp140.dll" | |
$VC_REDIST_VCOMP = "${VC_REDIST_DIR_OPEN_MP}\vcomp140.dll" | |
Copy-Item ` | |
${VC_REDIST_VCRUNTIME} ` | |
"${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}\bin" | |
if (Test-Path ${VC_REDIST_VCRUNTIME_1}) { | |
Copy-Item ` | |
${VC_REDIST_VCRUNTIME_1} ` | |
"${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}\bin" | |
} | |
Copy-Item ` | |
${VC_REDIST_MSVCP} ` | |
"${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}\bin" | |
Copy-Item ` | |
${VC_REDIST_VCOMP} ` | |
"${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}\bin" | |
Copy-Item ` | |
"${Env:GITHUB_WORKSPACE}\packages\windows\vcruntime\vs${{ matrix.vs-version }}\readme.txt" ` | |
${GROONGA_VC_REDIST_LICENSE_DIR} | |
$UCRT_REDIST_DIR = "C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\${Env:VC_ARCHITECTURE}" | |
Copy-Item ` | |
"${UCRT_REDIST_DIR}\*.dll" ` | |
"${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}\bin" | |
Copy-Item ` | |
"${Env:GITHUB_WORKSPACE}\packages\windows\vcruntime\ucrt-readme.txt" ` | |
${GROONGA_VC_REDIST_LICENSE_DIR} | |
- name: Compress the artifact with VC++ runtime | |
run: | | |
pushd "${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}\.." | |
Compress-Archive ` | |
-Path ${Env:INSTALL_FOLDER_WITH_VCRUNTIME} ` | |
-DestinationPath "${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}.zip" | |
popd | |
Copy-Item ` | |
"${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}.zip" ` | |
"${Env:INSTALL_FOLDER_WITH_VCRUNTIME}.zip" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.INSTALL_FOLDER_WITH_VCRUNTIME }} | |
path: ${{ env.INSTALL_FOLDER_WITH_VCRUNTIME }}.zip | |
# Release | |
- name: Upload the artifacts to release | |
if: | | |
startsWith(github.ref, 'refs/tags/') | |
run: | | |
gh release upload ${Env:GITHUB_REF_NAME} ` | |
"${Env:INSTALL_FOLDER}.zip" ` | |
"${Env:INSTALL_FOLDER_WITH_VCRUNTIME}.zip" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
# Test | |
- uses: ruby/setup-ruby@v1 | |
with: | |
# We can't use "ruby" here because json-stream still uses | |
# Fixnum that is removed in recent Ruby. :< | |
# | |
# We can use "ruby" here when we remove json-stream | |
# dependency from groonga-command-parser. | |
ruby-version: "3.1" | |
- name: Update MSYS2 | |
run: | | |
ridk exec pacman --sync --refresh --sysupgrade --sysupgrade --noconfirm | |
taskkill /F /FI "MODULES eq msys-2.0.dll" | |
ridk exec pacman --sync --refresh | |
- name: Update GCC | |
run: | | |
ridk exec pacman --sync --noconfirm mingw-w64-ucrt-x86_64-gcc | |
- name: Install test dependencies | |
run: | | |
$Env:MAKEFLAGS = "-j${Env:NUMBER_OF_PROCESSORS}" | |
ridk exec pacman ` | |
--sync ` | |
--noconfirm ` | |
mingw-w64-ucrt-x86_64-arrow ` | |
mingw-w64-ucrt-x86_64-xsimd | |
gem install ` | |
grntest ` | |
pkg-config ` | |
red-arrow | |
- name: "Test: command line" | |
run: | | |
ruby test\command_line\run-test.rb ` | |
--groonga-install-prefix="${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}" | |
- name: "Test: HTTP: reference count: Apache Arrow: chunked" | |
run: | | |
$Env:GRN_ENABLE_REFERENCE_COUNT = "yes" | |
grntest ` | |
--base-directory test\command ` | |
--groonga "${Env:FULL_INSTALL_FOLDER_WITH_VCRUNTIME}\bin\groonga.exe" ` | |
--input-type apache-arrow ` | |
--interface http ` | |
--n-retries 2 ` | |
--read-timeout=30 ` | |
--reporter mark ` | |
--timeout 360 ` | |
--use-http-chunked ` | |
test\command\suite |