Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 18 additions & 22 deletions .github/workflows/amd64_linux_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,27 @@ name: amd64 Linux Bazel

on: [push, pull_request, workflow_dispatch]

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

# Building using the github runner environement directly.
jobs:
native:
strategy:
matrix:
bazel: [
{compilation_mode: opt},
{compilation_mode: dbg},
]
examples: [{name: basic}, {name: embed}]
cpp: [
{version: 14, flags: "-std=c++14"},
#{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 }}
name: Linux•Bzl•C++${{matrix.cpp.version}}•Py${{matrix.python.version}}•${{matrix.examples.name}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
Expand All @@ -36,35 +32,35 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python.version }}
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 }}
disk-cache: ${{github.workflow}}
repository-cache: true
- name: Check Bazel
run: bazel version
- name: Build
run: >
cd examples/basic &&
cd examples/${{matrix.examples.name}} &&
bazel build
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--config=ci
--@rules_python//python/config_settings:python_version=${{matrix.python.version}}
--cxxopt=${{matrix.cpp.flags}} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...
- name: Test
run: >
cd examples/basic &&
cd examples/${{matrix.examples.name}} &&
bazel test
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--config=ci
--@rules_python//python/config_settings:python_version=${{matrix.python.version}}
--cxxopt=${{matrix.cpp.flags}} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...

amd64_linux_bazel:
Expand Down
39 changes: 19 additions & 20 deletions .github/workflows/amd64_macos_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,30 @@ name: amd64 MacOS Bazel

on: [push, pull_request, workflow_dispatch]

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

# Building using the github runner environement directly.
jobs:
native:
strategy:
matrix:
bazel: [
{compilation_mode: opt},
{compilation_mode: dbg},
examples: [
{name: basic},
# {name: embed}, # see: https://github.com/pybind/pybind11_bazel/issues/76
]
cpp: [
#{version: 14, flags: "-std=c++14"},
{version: 17, flags: "-std=c++17"},
#{version: 20, flags: "-std=c++20"},
{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 }}
name: MacOS•Bzl•C++${{matrix.cpp.version}}•Py${{matrix.python.version}}•${{matrix.examples.name}}
runs-on: macos-13 # last macos intel based runner
steps:
- uses: actions/checkout@v5
Expand All @@ -39,7 +38,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python.version }}
python-version: ${{matrix.python.version}}
- name: Check Python
run: |
python --version
Expand All @@ -48,21 +47,21 @@ jobs:
run: bazel version
- name: Build
run: >
cd examples/basic &&
cd examples/${{matrix.examples.name}} &&
bazel build
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--config=ci
--@rules_python//python/config_settings:python_version=${{matrix.python.version}}
--cxxopt=${{matrix.cpp.flags}} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...
- name: Test
run: >
cd examples/basic &&
cd examples/${{matrix.examples.name}} &&
bazel test
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--config=ci
--@rules_python//python/config_settings:python_version=${{matrix.python.version}}
--cxxopt=${{matrix.cpp.flags}} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...

amd64_macos_bazel:
Expand Down
52 changes: 20 additions & 32 deletions .github/workflows/amd64_windows_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,34 @@ name: amd64 Windows Bazel

on: [push, pull_request, workflow_dispatch]

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

# Building using the github runner environement directly.
jobs:
native:
strategy:
matrix:
runner: [
windows-2022,
#windows-2019,
]
bazel: [
{compilation_mode: opt},
{compilation_mode: dbg},
]
examples: [{name: basic}, {name: embed}]
cpp: [
{version: 14, flags: "/std:c++14"},
#{version: 14, flags: "/std:c++14"},
{version: 17, flags: "/std:c++17"},
#{version: 20, flags: "/std:c++20"},
{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 }}
fail-fast: false
name: Windows•Bzl•C++${{matrix.cpp.version}}•Py${{matrix.python.version}}•${{matrix.examples.name}}
runs-on: windows-2022
steps:
- uses: actions/checkout@v5
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python.version }}
python-version: ${{matrix.python.version}}
- name: Check Python
run: |
python --version
Expand All @@ -53,21 +41,21 @@ jobs:
run: bazel version
- name: Build
run: >
cd examples/basic &&
cd examples/${{matrix.examples.name}} &&
bazel build
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--config=ci
--@rules_python//python/config_settings:python_version=${{matrix.python.version}}
--cxxopt=${{matrix.cpp.flags}} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...
- name: Test
run: >
cd examples/basic &&
cd examples/${{matrix.examples.name}} &&
bazel test
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--config=ci
--@rules_python//python/config_settings:python_version=${{matrix.python.version}}
--cxxopt=${{matrix.cpp.flags}} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...

amd64_windows_bazel:
Expand Down
39 changes: 19 additions & 20 deletions .github/workflows/arm64_macos_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,30 @@ name: arm64 MacOS Bazel

on: [push, pull_request, workflow_dispatch]

concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true

# Building using the github runner environement directly.
jobs:
native:
strategy:
matrix:
bazel: [
{compilation_mode: opt},
{compilation_mode: dbg},
examples: [
{name: basic},
# {name: embed}, # see: https://github.com/pybind/pybind11_bazel/issues/76
]
cpp: [
#{version: 14, flags: "-std=c++14"},
{version: 17, flags: "-std=c++17"},
#{version: 20, flags: "-std=c++20"},
{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 }}
name: MacOS•Bzl•C++${{matrix.cpp.version}}•Py${{matrix.python.version}}•${{matrix.examples.name}}
runs-on: macos-latest
steps:
- uses: actions/checkout@v5
Expand All @@ -39,7 +38,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python.version }}
python-version: ${{matrix.python.version}}
- name: Check Python
run: |
python --version
Expand All @@ -48,21 +47,21 @@ jobs:
run: bazel version
- name: Build
run: >
cd examples/basic &&
cd examples/${{matrix.examples.name}} &&
bazel build
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--config=ci
--@rules_python//python/config_settings:python_version=${{matrix.python.version}}
--cxxopt=${{matrix.cpp.flags}} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...
- name: Test
run: >
cd examples/basic &&
cd examples/${{matrix.examples.name}} &&
bazel test
-c ${{ matrix.bazel.compilation_mode }}
--cxxopt=${{ matrix.cpp.flags }} --host_cxxopt=${{ matrix.cpp.flags }}
--config=ci
--@rules_python//python/config_settings:python_version=${{matrix.python.version}}
--cxxopt=${{matrix.cpp.flags}} --host_cxxopt=${{ matrix.cpp.flags }}
--subcommands=pretty_print
--enable_bzlmod
//...

arm64_macos_bazel:
Expand Down
32 changes: 32 additions & 0 deletions examples/basic/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Enable logging rc options.
common --announce_rc

# Enable Bzlmod for every Bazel command
common --enable_bzlmod

###############################################################################
# Options for continuous integration.
###############################################################################

# All build options also apply to test as described by the "Option precedence"
# section in https://bazel.build/run/bazelrc#bazelrc-syntax-semantics.

# Note for anybody considering using --compilation_mode=opt in CI, it builds
# most files twice, one PIC version for shared libraries in tests, and one
# non-PIC version for binaries.
build:ci --copt=-O1

# Show as many errors as possible.
build:ci --keep_going

# Show test errors.
test:ci --test_output=all

# Only show failing tests to reduce output
#test:ci --test_summary=terse

###############################################################################
# Put user-specific options in user.bazelrc
# See https://bazel.build/configure/best-practices#bazelrc-file
################################################################################
try-import %workspace%/user.bazelrc
1 change: 1 addition & 0 deletions examples/basic/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ py_wheel(

py_test(
name = "basic_test",
size="small",
srcs = ["basic_test.py"],
deps = [":basic_lib"],
)
Loading