Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump gtest and benchmark to work w/ latest runners #747

Merged
merged 1 commit into from
Dec 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#

######## Project settings
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.5)
set (PACKAGE_NAME opencc)
project (${PACKAGE_NAME} CXX)
include (CTest)
Expand Down Expand Up @@ -204,7 +204,7 @@ add_subdirectory(test)

if (ENABLE_GTEST)
if(NOT USE_SYSTEM_GTEST)
add_subdirectory(deps/gtest-1.11.0)
add_subdirectory(deps/gtest-1.12.1)
endif()
enable_testing()
endif()
Expand Down
7 changes: 7 additions & 0 deletions deps/google-benchmark/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
Checks: 'clang-analyzer-*,readability-redundant-*,performance-*'
WarningsAsErrors: 'clang-analyzer-*,readability-redundant-*,performance-*'
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: none
User: user
24 changes: 24 additions & 0 deletions deps/google-benchmark/.github/.libcxx-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

# Checkout LLVM sources
git clone --depth=1 https://github.com/llvm/llvm-project.git llvm-project

# Setup libc++ options
if [ -z "$BUILD_32_BITS" ]; then
export BUILD_32_BITS=OFF && echo disabling 32 bit build
fi

# Build and install libc++ (Use unstable ABI for better sanitizer coverage)
cd ./llvm-project
cmake -DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX} \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLIBCXX_ABI_UNSTABLE=OFF \
-DLLVM_USE_SANITIZER=${LIBCXX_SANITIZER} \
-DLLVM_BUILD_32_BITS=${BUILD_32_BITS} \
-DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi' \
-S llvm -B llvm-build -G "Unix Makefiles"
make -C llvm-build -j3 cxx cxxabi
sudo make -C llvm-build install-cxx install-cxxabi
cd ..
13 changes: 13 additions & 0 deletions deps/google-benchmark/.github/install_bazel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if ! bazel version; then
arch=$(uname -m)
if [ "$arch" == "aarch64" ]; then
arch="arm64"
fi
echo "Installing wget and downloading $arch Bazel binary from GitHub releases."
yum install -y wget
wget "https://github.com/bazelbuild/bazel/releases/download/5.2.0/bazel-5.2.0-linux-$arch" -O /usr/local/bin/bazel
chmod +x /usr/local/bin/bazel
else
# bazel is installed for the correct architecture
exit 0
fi
35 changes: 35 additions & 0 deletions deps/google-benchmark/.github/workflows/bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: bazel

on:
push: {}
pull_request: {}

jobs:
job:
name: bazel.${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-2022]

steps:
- uses: actions/checkout@v1

- name: mount bazel cache
uses: actions/cache@v2.0.0
env:
cache-name: bazel-cache
with:
path: "~/.cache/bazel"
key: ${{ env.cache-name }}-${{ matrix.os }}-${{ github.ref }}
restore-keys: |
${{ env.cache-name }}-${{ matrix.os }}-main

- name: build
run: |
bazel build //:benchmark //:benchmark_main //test/...

- name: test
run: |
bazel test --test_output=all //test/...
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: build-and-test-perfcounters

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
job:
# TODO(dominic): Extend this to include compiler and set through env: CC/CXX.
name: ${{ matrix.os }}.${{ matrix.build_type }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# ubuntu-18.04 is deprecated but included for best-effort
os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04]
build_type: ['Release', 'Debug']
steps:
- uses: actions/checkout@v2

- name: install libpfm
run: sudo apt -y install libpfm4-dev

- name: setup cmake
if: matrix.os == 'ubuntu-18.04'
uses: jwlawson/actions-setup-cmake@v1.9
with:
cmake-version: '3.16.3'

- name: create build environment
run: cmake -E make_directory ${{ runner.workspace }}/_build

- name: configure cmake
shell: bash
working-directory: ${{ runner.workspace }}/_build
run: >
cmake $GITHUB_WORKSPACE
-DBENCHMARK_ENABLE_LIBPFM=1
-DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}

- name: build
shell: bash
working-directory: ${{ runner.workspace }}/_build
run: cmake --build . --config ${{ matrix.build_type }}

# Skip testing, for now. It seems perf_event_open does not succeed on the
# hosting machine, very likely a permissions issue.
# TODO(mtrofin): Enable test.
# - name: test
# shell: bash
# working-directory: ${{ runner.workspace }}/_build
# run: ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure

116 changes: 116 additions & 0 deletions deps/google-benchmark/.github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: build-and-test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
# TODO: add 32-bit builds (g++ and clang++) for ubuntu
# (requires g++-multilib and libc6:i386)
# TODO: add coverage build (requires lcov)
# TODO: add clang + libc++ builds for ubuntu
job:
name: ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# ubuntu-18.04 is deprecated but included for best-effort support
os: [ubuntu-22.04, ubuntu-20.04, ubuntu-18.04, macos-latest]
build_type: ['Release', 'Debug']
compiler: [g++, clang++]
lib: ['shared', 'static']

steps:
- uses: actions/checkout@v2

- name: setup cmake
if: matrix.os == 'ubuntu-18.04'
uses: jwlawson/actions-setup-cmake@v1.9
with:
cmake-version: '3.16.3'

- name: create build environment
run: cmake -E make_directory ${{ runner.workspace }}/_build

- name: setup cmake initial cache
run: touch compiler-cache.cmake

- name: configure cmake
env:
CXX: ${{ matrix.compiler }}
shell: bash
working-directory: ${{ runner.workspace }}/_build
run: >
cmake -C ${{ github.workspace }}/compiler-cache.cmake
$GITHUB_WORKSPACE
-DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
-DBUILD_SHARED_LIBS=${{ matrix.lib == 'shared' }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_CXX_VISIBILITY_PRESET=hidden
-DCMAKE_VISIBILITY_INLINES_HIDDEN=ON

- name: build
shell: bash
working-directory: ${{ runner.workspace }}/_build
run: cmake --build . --config ${{ matrix.build_type }}

- name: test
shell: bash
working-directory: ${{ runner.workspace }}/_build
run: ctest -C ${{ matrix.build_type }} -VV

msvc:
name: ${{ matrix.os }}.${{ matrix.build_type }}.${{ matrix.lib }}.${{ matrix.msvc }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: powershell
strategy:
fail-fast: false
matrix:
msvc:
- VS-16-2019
- VS-17-2022
arch:
- x64
build_type:
- Debug
- Release
lib:
- shared
- static
include:
- msvc: VS-16-2019
os: windows-2019
generator: 'Visual Studio 16 2019'
- msvc: VS-17-2022
os: windows-2022
generator: 'Visual Studio 17 2022'

steps:
- uses: actions/checkout@v2

- name: configure cmake
run: >
cmake -S . -B _build/
-A ${{ matrix.arch }}
-G "${{ matrix.generator }}"
-DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
-DBUILD_SHARED_LIBS=${{ matrix.lib == 'shared' }}

- name: build
run: cmake --build _build/ --config ${{ matrix.build_type }}

- name: setup test environment
# Make sure gmock and benchmark DLLs can be found
run: >
echo "$((Get-Item .).FullName)/_build/bin/${{ matrix.build_type }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append;
echo "$((Get-Item .).FullName)/_build/src/${{ matrix.build_type }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append;

- name: test
run: ctest --test-dir _build/ -C ${{ matrix.build_type }} -VV


17 changes: 17 additions & 0 deletions deps/google-benchmark/.github/workflows/clang-format-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: clang-format-lint
on:
push: {}
pull_request: {}

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: DoozyX/clang-format-lint-action@v0.13
with:
source: './include/benchmark ./src ./test'
extensions: 'h,cc'
clangFormatVersion: 12
style: Google
38 changes: 38 additions & 0 deletions deps/google-benchmark/.github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: clang-tidy

on:
push: {}
pull_request: {}

jobs:
job:
name: run-clang-tidy
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2

- name: install clang-tidy
run: sudo apt update && sudo apt -y install clang-tidy

- name: create build environment
run: cmake -E make_directory ${{ runner.workspace }}/_build

- name: configure cmake
shell: bash
working-directory: ${{ runner.workspace }}/_build
run: >
cmake $GITHUB_WORKSPACE
-DBENCHMARK_ENABLE_ASSEMBLY_TESTS=OFF
-DBENCHMARK_ENABLE_LIBPFM=OFF
-DBENCHMARK_DOWNLOAD_DEPENDENCIES=ON
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
-DGTEST_COMPILE_COMMANDS=OFF

- name: run
shell: bash
working-directory: ${{ runner.workspace }}/_build
run: run-clang-tidy
28 changes: 28 additions & 0 deletions deps/google-benchmark/.github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: doxygen

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build-and-deploy:
name: Build HTML documentation
runs-on: ubuntu-latest
steps:
- name: Fetching sources
uses: actions/checkout@v2

- name: Installing build dependencies
run: |
sudo apt update
sudo apt install doxygen gcc git

- name: Creating build directory
run: mkdir build

- name: Building HTML documentation with Doxygen
run: |
cmake -S . -B build -DBENCHMARK_ENABLE_TESTING:BOOL=OFF -DBENCHMARK_ENABLE_DOXYGEN:BOOL=ON -DBENCHMARK_INSTALL_DOCS:BOOL=ON
cmake --build build --target benchmark_doxygen
28 changes: 28 additions & 0 deletions deps/google-benchmark/.github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: pylint

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
pylint:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint pylint-exit conan

- name: Run pylint
run: |
pylint `find . -name '*.py'|xargs` || pylint-exit $?
Loading