diff options
author | Cronet Mainline Eng <cronet-mainline-eng+copybara@google.com> | 2024-02-02 09:37:13 +0000 |
---|---|---|
committer | Chidera Olibie <colibie@google.com> | 2024-02-02 09:53:24 +0000 |
commit | 5cfdd35118d5a23349255971e97737e32895ec0f (patch) | |
tree | f6b803e3a8bbddaf4814d1a43930799c3d7f4d8e /third_party/re2/src/.github | |
parent | abce8a39488511c10b95ac52d1a3fdd2e886da83 (diff) | |
download | cronet-5cfdd35118d5a23349255971e97737e32895ec0f.tar.gz |
Cronet 121.0.6167.71: import third_party/re2
Bug: b/322154153
FolderOrigin-RevId: /tmp/copybara-origin/src
Change-Id: Ic5f3b7c7578bf4e12b03944d863325abfc88853a
Diffstat (limited to 'third_party/re2/src/.github')
-rwxr-xr-x | third_party/re2/src/.github/bazel.sh | 24 | ||||
-rwxr-xr-x | third_party/re2/src/.github/cmake.sh | 12 | ||||
-rw-r--r-- | third_party/re2/src/.github/workflows/ci-bazel.yml | 19 | ||||
-rw-r--r-- | third_party/re2/src/.github/workflows/ci-cmake.yml | 60 | ||||
-rw-r--r-- | third_party/re2/src/.github/workflows/ci.yml | 73 | ||||
-rw-r--r-- | third_party/re2/src/.github/workflows/pr.yml | 26 | ||||
-rw-r--r-- | third_party/re2/src/.github/workflows/python.yml | 222 |
7 files changed, 436 insertions, 0 deletions
diff --git a/third_party/re2/src/.github/bazel.sh b/third_party/re2/src/.github/bazel.sh new file mode 100755 index 000000000..7295ec6a8 --- /dev/null +++ b/third_party/re2/src/.github/bazel.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -eux + +bazel clean +bazel build --compilation_mode=dbg -- //:all +bazel test --compilation_mode=dbg -- //:all \ + -//:dfa_test \ + -//:exhaustive1_test \ + -//:exhaustive2_test \ + -//:exhaustive3_test \ + -//:exhaustive_test \ + -//:random_test + +bazel clean +bazel build --compilation_mode=opt -- //:all +bazel test --compilation_mode=opt -- //:all \ + -//:dfa_test \ + -//:exhaustive1_test \ + -//:exhaustive2_test \ + -//:exhaustive3_test \ + -//:exhaustive_test \ + -//:random_test + +exit 0 diff --git a/third_party/re2/src/.github/cmake.sh b/third_party/re2/src/.github/cmake.sh new file mode 100755 index 000000000..782334e81 --- /dev/null +++ b/third_party/re2/src/.github/cmake.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -eux + +cmake . -D CMAKE_BUILD_TYPE=Debug -D RE2_BUILD_TESTING=ON "$@" +cmake --build . --config Debug --clean-first +ctest -C Debug --output-on-failure -E 'dfa|exhaustive|random' + +cmake . -D CMAKE_BUILD_TYPE=Release -D RE2_BUILD_TESTING=ON "$@" +cmake --build . --config Release --clean-first +ctest -C Release --output-on-failure -E 'dfa|exhaustive|random' + +exit 0 diff --git a/third_party/re2/src/.github/workflows/ci-bazel.yml b/third_party/re2/src/.github/workflows/ci-bazel.yml new file mode 100644 index 000000000..013b52ca4 --- /dev/null +++ b/third_party/re2/src/.github/workflows/ci-bazel.yml @@ -0,0 +1,19 @@ +name: CI (Bazel) +on: + push: + branches: [main] +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + env: + BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + # TODO(junyer): Use `v2` whenever a new release is tagged. + - uses: bazelbuild/setup-bazelisk@6244971d4f7ba9aca943c2f3ede2bbd813fcca51 + - run: .github/bazel.sh + shell: bash diff --git a/third_party/re2/src/.github/workflows/ci-cmake.yml b/third_party/re2/src/.github/workflows/ci-cmake.yml new file mode 100644 index 000000000..d2d03afab --- /dev/null +++ b/third_party/re2/src/.github/workflows/ci-cmake.yml @@ -0,0 +1,60 @@ +name: CI (CMake) +on: + push: + branches: [main] +jobs: + build-linux: + runs-on: ubuntu-latest + # The Benchmark package on Ubuntu 22.04 LTS is problematic whereas this + # Docker container is based on Debian bookworm and has a newer version. + container: gcc:13 + strategy: + fail-fast: false + matrix: + build_shared_libs: [OFF, ON] + steps: + - uses: actions/checkout@v3 + - name: Install CMake + run: | + apt update -y + apt install -y cmake + shell: bash + - name: Install Abseil, GoogleTest and Benchmark + run: | + apt update -y + apt install -y libabsl-dev libgtest-dev libbenchmark-dev + shell: bash + - run: .github/cmake.sh -D BUILD_SHARED_LIBS=${{ matrix.build_shared_libs }} + shell: bash + build-macos: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + build_shared_libs: [OFF, ON] + steps: + - uses: actions/checkout@v3 + - name: Install Abseil, GoogleTest and Benchmark + run: | + brew update + brew install abseil googletest google-benchmark + shell: bash + - run: .github/cmake.sh -D BUILD_SHARED_LIBS=${{ matrix.build_shared_libs }} + shell: bash + build-windows: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + build_shared_libs: [OFF, ON] + steps: + - uses: actions/checkout@v3 + - name: Install Abseil, GoogleTest and Benchmark + run: | + vcpkg update + vcpkg install abseil gtest benchmark + shell: bash + - run: | + .github/cmake.sh -D BUILD_SHARED_LIBS=${{ matrix.build_shared_libs }} \ + -D CMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake + shell: bash diff --git a/third_party/re2/src/.github/workflows/ci.yml b/third_party/re2/src/.github/workflows/ci.yml new file mode 100644 index 000000000..44ac9dc29 --- /dev/null +++ b/third_party/re2/src/.github/workflows/ci.yml @@ -0,0 +1,73 @@ +name: CI +on: + push: + branches: [main] +jobs: + build-appleclang: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + ver: [17, 20] + env: + CC: clang + CXX: clang++ + # Unlike GCC and upstream Clang, AppleClang still defaults to `-std=c++98` + # for some reason. Also, the macOS image on GitHub Actions provides wildly + # numbered Xcode versions. Thus, rather than varying the compiler version, + # we set the `-std` flag explicitly in order to vary the language version. + # (The other two flags are the default provided for CXXFLAGS in Makefile.) + CXXFLAGS: -O3 -g -std=c++${{ matrix.ver }} + steps: + - uses: actions/checkout@v3 + - name: Install Abseil, GoogleTest and Benchmark + run: | + brew update + brew install abseil googletest google-benchmark + shell: bash + - run: make && make test + shell: bash + build-clang: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ver: [15, 16, 17] + env: + CC: clang-${{ matrix.ver }} + CXX: clang++-${{ matrix.ver }} + steps: + - uses: actions/checkout@v3 + - name: Install Clang ${{ matrix.ver }} + run: | + # Avoid `Conflicts: python3-lldb-x.y` between packages. + sudo apt purge -y python3-lldb-14 + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh ${{ matrix.ver }} + shell: bash + - name: Install Abseil, GoogleTest and Benchmark + run: | + sudo apt update -y + sudo apt install -y libabsl-dev libgtest-dev libbenchmark-dev + shell: bash + - run: make && make test + shell: bash + build-gcc: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ver: [11, 12, 13] + env: + CC: gcc-${{ matrix.ver }} + CXX: g++-${{ matrix.ver }} + steps: + - uses: actions/checkout@v3 + - name: Install Abseil, GoogleTest and Benchmark + run: | + sudo apt update -y + sudo apt install -y libabsl-dev libgtest-dev libbenchmark-dev + shell: bash + - run: make && make test + shell: bash diff --git a/third_party/re2/src/.github/workflows/pr.yml b/third_party/re2/src/.github/workflows/pr.yml new file mode 100644 index 000000000..860da6236 --- /dev/null +++ b/third_party/re2/src/.github/workflows/pr.yml @@ -0,0 +1,26 @@ +name: PR +on: + pull_request_target: + branches: [main] + types: [opened] +jobs: + close: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/github-script@v6 + with: + script: | + const fs = require('fs'); + console.log(await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: fs.readFileSync('CONTRIBUTING.md', { encoding: 'utf8', }), + })); + console.log(await github.rest.pulls.update({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + state: 'closed', + })); diff --git a/third_party/re2/src/.github/workflows/python.yml b/third_party/re2/src/.github/workflows/python.yml new file mode 100644 index 000000000..2680db24c --- /dev/null +++ b/third_party/re2/src/.github/workflows/python.yml @@ -0,0 +1,222 @@ +name: Python +on: + workflow_dispatch: + inputs: + build: + required: true + type: number +jobs: + wheel-linux: + name: Linux ${{ matrix.os }}, ${{ matrix.arch.name }}, Python ${{ matrix.ver }} + runs-on: ${{ matrix.arch.runs-on }} + container: + image: quay.io/pypa/${{ matrix.os }}_${{ matrix.arch.python-name }} + # Don't run as root within the container. + # Neither Git nor Bazel appreciates that. + # 1001 is the GitHub Actions runner user. + options: --init --user 1001 + strategy: + fail-fast: false + matrix: + arch: + - { name: X64, python-name: x86_64, runs-on: [ubuntu-latest] } + - { name: ARM64, python-name: aarch64, runs-on: [self-hosted, linux, arm64] } + os: [manylinux2014, manylinux_2_28] + ver: ['3.8', '3.9', '3.10', '3.11', '3.12'] + env: + BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PYTHON: /usr/local/bin/python${{ matrix.ver }} + # Bazel fails if the username is unknown. + USER: runner + steps: + - uses: actions/checkout@v3 + # Stash the timestamp for the commit SHA that triggered the workflow. + - run: echo "timestamp=$(git log -1 --pretty=%ct)" >> "${GITHUB_ENV}" + shell: bash + # TODO(junyer): Use `v2` whenever a new release is tagged. + - uses: bazelbuild/setup-bazelisk@6244971d4f7ba9aca943c2f3ede2bbd813fcca51 + - name: Prepare Python ${{ matrix.ver }} environment + run: | + "${PYTHON}" -m pip install --upgrade pip + "${PYTHON}" -m pip install --upgrade build wheel auditwheel + "${PYTHON}" -m pip install --upgrade absl-py + shell: bash + - name: Build wheel + env: + SOURCE_DATE_EPOCH: ${{ env.timestamp }} + run: | + "${PYTHON}" -m build --wheel + "${PYTHON}" -m auditwheel repair --wheel-dir=. dist/* + shell: bash + working-directory: python + - name: Test wheel + run: | + "${PYTHON}" -m pip install google_re2-*.whl + "${PYTHON}" re2_test.py + shell: bash + working-directory: python + - uses: actions/upload-artifact@v3 + with: + name: ${{ hashFiles('python/google_re2-*.whl') }} + path: python/google_re2-*.whl + retention-days: 1 + wheel-macos: + name: macOS ${{ matrix.os }}, ${{ matrix.arch.name }}, Python ${{ matrix.ver }} + runs-on: macos-${{ matrix.os }} + strategy: + fail-fast: false + matrix: + arch: + - { name: X64, bazel-name: x86_64, python-name: x86_64 } + - { name: ARM64, bazel-name: arm64, python-name: arm64 } + os: [11, 12, 13] + ver: ['3.8', '3.9', '3.10', '3.11', '3.12'] + env: + BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BAZEL_CPU: darwin_${{ matrix.arch.bazel-name }} + PLAT_NAME: macosx-${{ matrix.os }}.0-${{ matrix.arch.python-name }} + # Stop macOS from reporting the system version as 10.x. + # Otherwise, Python refuses to install the built wheel! + SYSTEM_VERSION_COMPAT: 0 + steps: + - uses: actions/checkout@v3 + # Stash the timestamp for the commit SHA that triggered the workflow. + - run: echo "timestamp=$(git log -1 --pretty=%ct)" >> "${GITHUB_ENV}" + shell: bash + # TODO(junyer): Use `v2` whenever a new release is tagged. + - uses: bazelbuild/setup-bazelisk@6244971d4f7ba9aca943c2f3ede2bbd813fcca51 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.ver }} + - name: Prepare Python ${{ matrix.ver }} environment + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade build wheel delocate + python -m pip install --upgrade absl-py + shell: bash + - name: Build wheel + env: + SOURCE_DATE_EPOCH: ${{ env.timestamp }} + run: | + python -m build --wheel + python -m delocate.cmd.delocate_wheel --wheel-dir=. dist/* + shell: bash + working-directory: python + - if: matrix.arch.name == runner.arch + name: Test wheel + run: | + python -m pip install google_re2-*.whl + python re2_test.py + shell: bash + working-directory: python + - uses: actions/upload-artifact@v3 + with: + name: ${{ hashFiles('python/google_re2-*.whl') }} + path: python/google_re2-*.whl + retention-days: 1 + wheel-windows: + name: Windows, ${{ matrix.arch.name }}, Python ${{ matrix.ver }} + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + arch: + - { name: X86, bazel-name: x64_x86, python-name: win32 } + - { name: X64, bazel-name: x64, python-name: win_amd64 } + ver: ['3.8', '3.9', '3.10', '3.11', '3.12'] + env: + BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BAZEL_CPU: ${{ matrix.arch.bazel-name }}_windows + PLAT_NAME: ${{ matrix.arch.python-name }} + steps: + - uses: actions/checkout@v3 + # Stash the timestamp for the commit SHA that triggered the workflow. + - run: echo "timestamp=$(git log -1 --pretty=%ct)" >> "${GITHUB_ENV}" + shell: bash + # Avoid the Chocolatey install of Bazel getting in the way; + # `bazelbuild/setup-bazelisk` doesn't work for some reason. + - run: | + choco uninstall -y bazel + choco install -y bazelisk + shell: bash + # Lowercase the architecture name for `actions/setup-python`. + - run: | + ARCHITECTURE=${{ matrix.arch.name }} + echo "architecture=${ARCHITECTURE,,}" >> "${GITHUB_ENV}" + shell: bash + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.ver }} + architecture: ${{ env.architecture }} + - name: Prepare Python ${{ matrix.ver }} environment + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade build wheel delvewheel + python -m pip install --upgrade absl-py + shell: bash + - name: Build wheel + env: + SOURCE_DATE_EPOCH: ${{ env.timestamp }} + run: | + python -m build --wheel + python -m delvewheel repair --wheel-dir=. dist/* + shell: bash + working-directory: python + - name: Test wheel + run: | + python -m pip install google_re2-*.whl + python re2_test.py + shell: bash + working-directory: python + - uses: actions/upload-artifact@v3 + with: + name: ${{ hashFiles('python/google_re2-*.whl') }} + path: python/google_re2-*.whl + retention-days: 1 + publish: + needs: + - wheel-linux + - wheel-macos + - wheel-windows + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + # Stash the timestamp for the commit SHA that triggered the workflow. + - run: echo "timestamp=$(git log -1 --pretty=%ct)" >> "${GITHUB_ENV}" + shell: bash + - uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Prepare Python 3.x environment + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade build wheel + shell: bash + - if: inputs.build == 1 + name: Build source + env: + SOURCE_DATE_EPOCH: ${{ env.timestamp }} + run: | + python -m build --sdist + shell: bash + working-directory: python + - uses: actions/download-artifact@v3 + with: + path: python + - name: Set build number to ${{ inputs.build }} + env: + SOURCE_DATE_EPOCH: ${{ env.timestamp }} + run: | + mkdir -p dist + for WHL in */google_re2-*.whl; do + python -m wheel unpack "${WHL}" + python -m wheel pack --dest-dir=dist --build-number=${{ inputs.build }} google_re2-* + rm -rf google_re2-* + done + shell: bash + working-directory: python + - if: inputs.build >= 1 + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + packages_dir: python/dist |