Skip to content

Add support for searching #1935

Add support for searching

Add support for searching #1935

Workflow file for this run

name: try
on:
pull_request:
paths-ignore:
- "**.md"
- ".vscode/**"
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
# MSVC is broken: https://github.com/chromium/subspace/issues/267
#- {
# name: "Windows MSVC",
# artifact: "Windows-MSVC.tar.xz",
# os: windows-latest,
# build_type: "Release",
# cc: "cl",
# cxx: "cl",
# environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat",
# }
#- {
# name: "Windows MinGW", artifact: "Windows-MinGW.tar.xz",
# os: windows-latest,
# build_type: "Release", cc: "gcc", cxx: "g++"
# }
- {
name: "Ubuntu Clang-16 Debug",
os: ubuntu-latest,
build_type: "Debug",
cc: "clang-16",
cxx: "clang++-16",
clang_version: 16,
installed_clang_version: 14
}
- {
name: "Ubuntu Clang-16 Sanitizer",
os: ubuntu-latest,
build_type: "Release",
cc: "clang-16",
cxx: "clang++-16",
clang_version: 16,
installed_clang_version: 14
}
- {
name: "Ubuntu Clang-17 Debug",
os: ubuntu-latest,
build_type: "Debug",
cc: "clang-17",
cxx: "clang++-17",
clang_version: 17,
installed_clang_version: 14
}
- {
name: "Ubuntu Clang-17 Sanitizer",
os: ubuntu-latest,
build_type: "Release",
cc: "clang-17",
cxx: "clang++-17",
clang_version: 17,
installed_clang_version: 14
}
- {
name: "Ubuntu Clang-18 Debug",
os: ubuntu-latest,
build_type: "Debug",
cc: "clang-18",
cxx: "clang++-18",
clang_version: 18,
installed_clang_version: 14
}
- {
name: "Ubuntu GCC",
os: ubuntu-latest,
build_type: "Release",
cc: "gcc-13",
cxx: "g++-13",
clang_version: 16,
installed_clang_version: 14
}
# Clang doesn't have good enough C++20 support to compile this library
# yet.
#- {
# name: "macOS Latest Clang",
# artifact: "macOS.tar.xz",
# os: macos-latest,
# build_type: "Release",
# cc: "clang",
# cxx: "clang++",
# }
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Install LLVM+Clang
if: startsWith(matrix.config.os, 'ubuntu-')
run: |
sudo apt-get remove clang-${{matrix.config.installed_clang_version}} \
lldb-${{matrix.config.installed_clang_version}} \
lld-${{matrix.config.installed_clang_version}} \
clangd-${{matrix.config.installed_clang_version}} \
clang-tidy-${{matrix.config.installed_clang_version}} \
clang-format-${{matrix.config.installed_clang_version}} \
clang-tools-${{matrix.config.installed_clang_version}} \
llvm-${{matrix.config.installed_clang_version}}-dev \
lld-${{matrix.config.installed_clang_version}} \
lldb-${{matrix.config.installed_clang_version}} \
llvm-${{matrix.config.installed_clang_version}}-tools \
libomp-${{matrix.config.installed_clang_version}}-dev \
libc++-${{matrix.config.installed_clang_version}}-dev \
libc++abi-${{matrix.config.installed_clang_version}}-dev \
libclang-common-${{matrix.config.installed_clang_version}}-dev \
libclang-${{matrix.config.installed_clang_version}}-dev \
libclang-cpp${{matrix.config.installed_clang_version}}-dev \
libunwind-${{matrix.config.installed_clang_version}}-dev
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{matrix.config.clang_version}} all
- name: Install GCC 13
if: matrix.config.name == 'Ubuntu GCC'
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt update
sudo apt-get install g++-13
echo "CXXFLAGS=$CXXFLAGS" >> $GITHUB_ENV
# vptr is incompatible with no-rtti. We turn off rtti to match the LLVM libraries.
- name: Set Sanitizer Flags
if: endsWith(matrix.config.name, 'Sanitizer')
run: |
echo "CFLAGS=$CFLAGS -fsanitize=address -fsanitize=undefined -fno-sanitize=vptr -O0" >> $GITHUB_ENV
echo "CXXFLAGS=$CXXFLAGS -fsanitize=address -fsanitize=undefined -fno-sanitize=vptr -O0" >> $GITHUB_ENV
# GCC has a warning on the LLVM 18 codebase now.
# https://github.com/llvm/llvm-project/issues/67942
- name: Disable GCC Warning
if: matrix.config.name == 'Ubuntu GCC'
run: |
echo "CFLAGS=$CFLAGS -Wno-non-template-friend" >> $GITHUB_ENV
echo "CXXFLAGS=$CXXFLAGS -Wno-non-template-friend" >> $GITHUB_ENV
- name: Download Ninja
id: ninja
shell: cmake -P {0}
run: |
set(ninja_version "1.11.1")
if ("${{ runner.os }}" STREQUAL "Windows")
set(ninja_suffix "win.zip")
elseif ("${{ runner.os }}" STREQUAL "Linux")
set(ninja_suffix "linux.zip")
elseif ("${{ runner.os }}" STREQUAL "macOS")
set(ninja_suffix "mac.zip")
endif()
set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}")
file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip)
if (NOT "${{ runner.os }}" STREQUAL "Windows")
execute_process(
COMMAND chmod +x ninja
)
endif()
- name: Configure
shell: cmake -P {0}
run: |
set(ENV{CC} ${{ matrix.config.cc }})
set(ENV{CXX} ${{ matrix.config.cxx }})
set(HAS_LLVM ON)
if (NOT "${{ runner.os }}" STREQUAL "Windows")
# Path to LLVM+Clang nightly that we have installed.
set(ENV{LLVM_DIR} "/usr/lib/llvm-${{matrix.config.clang_version}}/lib/cmake/llvm")
set(ENV{Clang_DIR} "/usr/lib/llvm-${{matrix.config.clang_version}}/lib/cmake/clang")
else()
# We don't have a copy of LLVM+Clang on the Windows bot.
set(HAS_LLVM OFF)
endif()
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
execute_process(
COMMAND "${{ matrix.config.environment_script }}" && set
OUTPUT_FILE environment_script_output.txt
)
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/ninja" ninja_program)
execute_process(
COMMAND cmake
-S .
-B build
-D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
-G Ninja
-D CMAKE_MAKE_PROGRAM=${ninja_program}
-D SUBSPACE_BUILD_TESTS=ON
-D SUBSPACE_BUILD_SUBDOC=${HAS_LLVM}
-D SUBSPACE_BUILD_BENCHMARKS=ON
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x")
file(STRINGS environment_script_output.txt output_lines)
foreach(line IN LISTS output_lines)
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$")
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}")
endif()
endforeach()
endif()
execute_process(
COMMAND cmake --build build -j 10
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Run tests
shell: cmake -P {0}
run: |
include(ProcessorCount)
ProcessorCount(N)
execute_process(
COMMAND ctest -j ${N} --rerun-failed --output-on-failure
WORKING_DIRECTORY build
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Running tests failed!")
endif()
docs:
name: Generate Subdoc
runs-on: ubuntu-latest
env:
clang_version: 18
installed_clang_version: 14
source_url: "https://github.com/chromium/subspace/blob/main"
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Install LLVM+Clang
run: |
sudo apt-get remove clang-${installed_clang_version} \
lldb-${installed_clang_version} \
lld-${installed_clang_version} \
clangd-${installed_clang_version} \
clang-tidy-${installed_clang_version} \
clang-format-${installed_clang_version} \
clang-tools-${installed_clang_version} \
llvm-${installed_clang_version}-dev \
lld-${installed_clang_version} \
lldb-${installed_clang_version} \
llvm-${installed_clang_version}-tools \
libomp-${installed_clang_version}-dev \
libc++-${installed_clang_version}-dev \
libc++abi-${installed_clang_version}-dev \
libclang-common-${installed_clang_version}-dev \
libclang-${installed_clang_version}-dev \
libclang-cpp${installed_clang_version}-dev \
libunwind-${installed_clang_version}-dev
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${clang_version} all
- name: Download Ninja
id: ninja
shell: cmake -P {0}
run: |
set(ninja_version "1.11.1")
set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-linux.zip")
file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip)
if (NOT "${{ runner.os }}" STREQUAL "Windows")
execute_process(
COMMAND chmod +x ninja
)
endif()
- name: Configure
shell: cmake -P {0}
run: |
set(ENV{CC} clang-$ENV{clang_version})
set(ENV{CXX} clang++-$ENV{clang_version})
# Path to LLVM+Clang nightly that we have installed.
set(ENV{LLVM_DIR} "/usr/lib/llvm-$ENV{clang_version}/lib/cmake/llvm")
set(ENV{Clang_DIR} "/usr/lib/llvm-$ENV{clang_version}/lib/cmake/clang")
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/ninja" ninja_program)
execute_process(
COMMAND cmake
-S .
-B out
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_EXPORT_COMPILE_COMMANDS=1
-G Ninja
-D CMAKE_MAKE_PROGRAM=${ninja_program}
-D SUBSPACE_BUILD_TESTS=OFF
-D SUBSPACE_BUILD_SUBDOC=ON
-D SUBSPACE_BUILD_BENCHMARKS=OFF
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
COMMAND cmake --build out -j 10
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
# Reconfigure with tests enabled so that we generate docs through them
# to find all headers, and all static assertions.
- name: Reconfigure with tests
shell: cmake -P {0}
run: |
set(ENV{CC} clang-$ENV{clang_version})
set(ENV{CXX} clang++-$ENV{clang_version})
# Path to LLVM+Clang nightly that we have installed.
set(ENV{LLVM_DIR} "/usr/lib/llvm-$ENV{clang_version}/lib/cmake/llvm")
set(ENV{Clang_DIR} "/usr/lib/llvm-$ENV{clang_version}/lib/cmake/clang")
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/ninja" ninja_program)
execute_process(
COMMAND cmake
-S .
-B out
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_EXPORT_COMPILE_COMMANDS=1
-G Ninja
-D CMAKE_MAKE_PROGRAM=${ninja_program}
-D SUBSPACE_BUILD_TESTS=ON
-D SUBSPACE_BUILD_SUBDOC=ON
-D SUBSPACE_BUILD_BENCHMARKS=OFF
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
# Generate for files in subspace. We execute the tool on all files in
# the subspace library dir, and we limit generation to things defined
# in that directory (there's no other /sus/ directory it may include).
- name: Generate
run: |
# For crash dumps.
export LLVM_SYMBOLIZER_PATH="/usr/lib/llvm-${clang_version}/bin/llvm-symbolizer"
out/subdoc/subdoc \
-p out \
--out docs \
--include-file-pattern /sus/ \
--exclude-file-pattern /third_party/ \
--exclude-file-pattern /test/ \
--exclude-file-pattern test.cc \
--include-macro-prefix sus_ \
--include-macro-prefix SUS_ \
--copy-file subdoc/gen_tests/subdoc-test-style.css \
--copy-file web/logo.png \
--copy-file web/logo32.png \
--copy-file web/logo16.png \
--favicon "logo.png;image/png" \
--favicon "logo32.png;image/png" \
--favicon "logo16.png;image/png" \
--css subdoc-test-style.css \
--project-logo logo.png \
--project-md sus/project.md \
--project-name Subspace \
--project-version 0.0.0 \
--remove-source-path-prefix $PWD \
--add-source-path-prefix ${source_url} \
--source-path-line-prefix L \
/home/runner/work/subspace/subspace/sus
bench:
name: Benchmarks
runs-on: ubuntu-latest
env:
clang_version: 17
installed_clang_version: 14
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Install LLVM+Clang
run: |
sudo apt-get remove clang-${installed_clang_version} \
lldb-${installed_clang_version} \
lld-${installed_clang_version} \
clangd-${installed_clang_version} \
clang-tidy-${installed_clang_version} \
clang-format-${installed_clang_version} \
clang-tools-${installed_clang_version} \
llvm-${installed_clang_version}-dev \
lld-${installed_clang_version} \
lldb-${installed_clang_version} \
llvm-${installed_clang_version}-tools \
libomp-${installed_clang_version}-dev \
libc++-${installed_clang_version}-dev \
libc++abi-${installed_clang_version}-dev \
libclang-common-${installed_clang_version}-dev \
libclang-${installed_clang_version}-dev \
libclang-cpp${installed_clang_version}-dev \
libunwind-${installed_clang_version}-dev
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${clang_version} all
- name: Download Ninja
id: ninja
shell: cmake -P {0}
run: |
set(ninja_version "1.11.1")
set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-linux.zip")
file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS)
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip)
if (NOT "${{ runner.os }}" STREQUAL "Windows")
execute_process(
COMMAND chmod +x ninja
)
endif()
- name: Configure
shell: cmake -P {0}
run: |
set(ENV{CC} clang-$ENV{clang_version})
set(ENV{CXX} clang++-$ENV{clang_version})
# Path to LLVM+Clang nightly that we have installed.
set(ENV{LLVM_DIR} "/usr/lib/llvm-$ENV{clang_version}/lib/cmake/llvm")
set(ENV{Clang_DIR} "/usr/lib/llvm-$ENV{clang_version}/lib/cmake/clang")
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/ninja" ninja_program)
execute_process(
COMMAND cmake
-S .
-B out
-D CMAKE_BUILD_TYPE=Release
-D CMAKE_EXPORT_COMPILE_COMMANDS=1
-G Ninja
-D CMAKE_MAKE_PROGRAM=${ninja_program}
-D SUBSPACE_BUILD_TESTS=OFF
-D SUBSPACE_BUILD_SUBDOC=OFF
-D SUBSPACE_BUILD_BENCHMARKS=ON
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Build
shell: cmake -P {0}
run: |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ")
execute_process(
COMMAND cmake --build out -j 10
RESULT_VARIABLE result
)
if (NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
- name: Run
run: |
# For crash dumps.
export LLVM_SYMBOLIZER_PATH="/usr/lib/llvm-${clang_version}/bin/llvm-symbolizer"
out/bench/bench