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

Deep CI rework with few fix #188

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
11 changes: 8 additions & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ common --announce_rc
# Enable verbose failures for testing only.
build --verbose_failures

# Compiler options.
build --cxxopt=-std=c++17
build --host_cxxopt=-std=c++17
# Abseil requires C++14 at minimum.
build --enable_platform_specific_config
build:linux --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
build:macos --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
build:windows --cxxopt=/std:c++17 --host_cxxopt=/std:c++17

# Enable logging error output.
test --test_output=errors
test --test_summary=detailed

# https://bazel.build/configure/best-practices#bazelrc-file
try-import %workspace%/user.bazelrc
73 changes: 73 additions & 0 deletions .github/workflows/amd64_linux_bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# ref: https://github.com/actions/runner-images
name: amd64 Linux Bazel

on: [push, pull_request, workflow_dispatch]

# Building using the github runner environement directly.
jobs:
native:
strategy:
matrix:
bazel: [
{compilation_mode: opt},
{compilation_mode: dbg},
]
cpp: [
{version: 14, flags: "-std=c++14"},
{version: 17, flags: "-std=c++17"},
{version: 20, flags: "-std=c++20"},
]
python: [
#{version: '3.11'},
{version: '3.12'},
]
exclude:
# only test `-c dbg` build with C++17
- cpp: {version: 14}
bazel: {compilation_mode: dbg}
- cpp: {version: 20}
bazel: {compilation_mode: dbg}
fail-fast: false
name: Linux•Bazel(${{ matrix.bazel.compilation_mode }})•C++${{ matrix.cpp.version }}•Python${{ matrix.python.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check Java
run: java -version
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Check Python
run: |
python --version
python -m platform
- uses: bazel-contrib/[email protected]
with:
bazelisk-cache: true
disk-cache: ${{ github.workflow }}
repository-cache: true
- name: Check Bazel
run: bazel version
- name: Build
run: >
bazel build
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...
- name: Test
run: >
bazel test
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...

amd64_linux_bazel:
runs-on: ubuntu-latest
needs: native
steps:
- uses: actions/checkout@v4
74 changes: 74 additions & 0 deletions .github/workflows/amd64_linux_cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# ref: https://github.com/actions/runner-images
name: amd64 Linux CMake

on: [push, pull_request, workflow_dispatch]

# Building using the github runner environement directly.
jobs:
native:
strategy:
matrix:
python: [
{version: '3.9'},
{version: '3.10'},
{version: '3.11'},
{version: '3.12'},
#{version: '3.13'},
]
cmake: [
{generator: "Unix Makefiles", config: "Release"},
{generator: "Ninja", config: "Release"},
#{generator: "Ninja Multi-Config", config: "Release"},
]
fail-fast: false
name: Linux•CMake(${{ matrix.cmake.generator }})•Python${{ matrix.python.version }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Check Python
run: |
python --version
python -m platform
- name: Install Python requirements
run: python -m pip install --upgrade -r $(python -c 'import sys; print("./pybind11_protobuf/requirements/requirements_lock_%d_%d.txt" % (sys.version_info[:2]))')
- name: Install Ninja
run: |
sudo apt-get update
sudo apt-get install ninja-build
- name: Check CMake
run: cmake --version
- name: Configure
run: >
cmake -S. -Bbuild
-G "${{ matrix.cmake.generator }}"
-DCMAKE_BUILD_TYPE=${{ matrix.cmake.config }}
-DCMAKE_INSTALL_PREFIX=install
- name: Build
run: >
cmake --build build
--config ${{ matrix.cmake.config }}
--target all
-v -j2
- name: Test
run: >
CTEST_OUTPUT_ON_FAILURE=1
cmake --build build
--config ${{ matrix.cmake.config }}
--target test
-v
- name: Install
run: >
cmake --build build
--config ${{ matrix.cmake.config }}
--target install
-v

amd64_linux_cmake:
runs-on: ubuntu-latest
needs: native
steps:
- uses: actions/checkout@v4
75 changes: 75 additions & 0 deletions .github/workflows/amd64_macos_bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# ref: https://github.com/actions/runner-images
name: amd64 MacOS Bazel

on: [push, pull_request, workflow_dispatch]

# Building using the github runner environement directly.
jobs:
native:
strategy:
matrix:
bazel: [
{compilation_mode: opt},
{compilation_mode: dbg},
]
cpp: [
#{version: 14, flags: "-std=c++14"},
{version: 17, flags: "-std=c++17"},
#{version: 20, flags: "-std=c++20"},
]
python: [
#{version: '3.11'},
{version: '3.12'},
]
exclude:
# only test `-c dbg` build with C++17
- cpp: {version: 14}
bazel: {compilation_mode: dbg}
- cpp: {version: 20}
bazel: {compilation_mode: dbg}
fail-fast: false
name: MacOS•Bazel(${{ matrix.bazel.compilation_mode }})•C++${{ matrix.cpp.version }}•Python${{ matrix.python.version }}
runs-on: macos-13 # last macos intel based runner
steps:
- uses: actions/checkout@v4
- name: Set Java to OpenJDK 17 (Temurin)
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Check Python
run: |
python --version
python -m platform
- name: Check Bazel
run: bazel version
- name: Change Python in MODULE.bazel
run: |
sed -i '' -e 's/\(DEFAULT_PYTHON =\) "3.[0-9]*"/\1 "${{ matrix.python.version }}"/g' MODULE.bazel
cat MODULE.bazel
- name: Build
run: >
bazel build
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...
- name: Test
run: >
bazel test
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...

amd64_macos_bazel:
runs-on: ubuntu-latest
needs: native
steps:
- uses: actions/checkout@v4
71 changes: 71 additions & 0 deletions .github/workflows/amd64_macos_cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# ref: https://github.com/actions/runner-images
name: amd64 MacOS CMake

on: [push, pull_request, workflow_dispatch]

# Building using the github runner environement directly.
jobs:
native:
strategy:
matrix:
python: [
{version: '3.9'},
{version: '3.10'},
{version: '3.11'},
{version: '3.12'},
#{version: '3.13'},
]
cmake: [
{generator: "Xcode", config: Release, build_target: ALL_BUILD, test_target: RUN_TESTS, install_target: install},
{generator: "Unix Makefiles", config: Release, build_target: all, test_target: test, install_target: install},
]
fail-fast: false
name: MacOS•CMake(${{ matrix.cmake.generator }})•Python${{ matrix.python.version }}
runs-on: macos-13 # last macos intel based runner
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Update Path
run: |
echo "$HOME/Library/Python/${{ matrix.python.version }}/bin" >> $GITHUB_PATH
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Check Python
run: python --version
- name: Install Python requirements
run: python -m pip install --upgrade -r $(python -c 'import sys; print("./pybind11_protobuf/requirements/requirements_lock_%d_%d.txt" % (sys.version_info[:2]))')
- name: Check CMake
run: cmake --version
- name: Configure
run: >
cmake -S. -Bbuild
-G "${{ matrix.cmake.generator }}"
-DCMAKE_BUILD_TYPE=${{ matrix.cmake.config }}
-DCMAKE_INSTALL_PREFIX=install
- name: Build
run: >
cmake --build build
--config ${{ matrix.cmake.config }}
--target ${{ matrix.cmake.build_target }}
-v -j2
- name: Test
run: >
CTEST_OUTPUT_ON_FAILURE=1
cmake --build build
--config ${{ matrix.cmake.config }}
--target ${{ matrix.cmake.test_target }}
-v
- name: Install
run: >
cmake --build build
--config ${{ matrix.cmake.config }}
--target ${{ matrix.cmake.install_target }}
-v

amd64_macos_cmake:
runs-on: ubuntu-latest
needs: native
steps:
- uses: actions/checkout@v4
76 changes: 76 additions & 0 deletions .github/workflows/amd64_windows_bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# ref: https://github.com/actions/runner-images
name: amd64 Windows Bazel

on: [push, pull_request, workflow_dispatch]

# Building using the github runner environement directly.
jobs:
native:
strategy:
matrix:
runner: [
windows-2022,
#windows-2019,
]
bazel: [
{compilation_mode: opt},
{compilation_mode: dbg},
]
cpp: [
#{version: 14, flags: "/std:c++14"},
{version: 17, flags: "/std:c++17"},
#{version: 20, flags: "/std:c++20"},
]
python: [
#{version: '3.11'},
{version: '3.12'},
]
exclude:
- runner: windows-2019
cpp: {version: 20}
# only test -c dbg with VS 2022 version 17 to save compute time
- runner: windows-2019
bazel: {compilation_mode: dbg}
- cpp: {version: 14}
bazel: {compilation_mode: dbg}
- cpp: {version: 20}
bazel: {compilation_mode: dbg}
fail-fast: false # Don't cancel all jobs if one fails.
name: ${{ matrix.runner }}•Bazel(${{ matrix.bazel.compilation_mode }})•C++${{ matrix.cpp.version }}•Python${{ matrix.python.version }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Check Python
run: |
python --version
python -m platform
- name: Install Bazel
run: choco install bazel
- name: Check Bazel
run: bazel version
- name: Build
run: >
bazel build
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...
- name: Test
run: >
bazel test
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...

amd64_windows_bazel:
runs-on: ubuntu-latest
needs: native
steps:
- uses: actions/checkout@v4
Loading
Loading