-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Split CMake and Bazel workflows to get independent badges * Split MacOS (amd64 and M1) and Windows (amd64) and Linux (amd64) jobs * import ubuntu-build.yml from pybind11_protobuf ## Bazel * Add C++14, c++17 and c++20 flavours * Add `-c opt` and `-c dbg` variants * only test against the default python3.11 ## CMake * Test Python 3.9, 3.10. 3.11, 3.12 * cmake(linux): Test Unix Makefile and Ninja Build generators * cmake(macOS): Test XCode and Makefile generators * cmake(windows): Test MSVC (VC 2022) generator PiperOrigin-RevId: 715743424
- Loading branch information
1 parent
2420efd
commit 4090172
Showing
12 changed files
with
652 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
# ref: https://github.com/actions/runner-images | ||
name: build_and_test | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the master branch | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
on: [push, pull_request, workflow_dispatch] | ||
|
||
env: | ||
PIP_BREAK_SYSTEM_PACKAGES: 1 | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
|
||
unix: | ||
strategy: | ||
fail-fast: false | ||
|
@@ -30,28 +23,21 @@ jobs: | |
steps: | ||
- name: Show env | ||
run: env | ||
|
||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install bazel | ||
- name: Setup bazel | ||
if: matrix.build_tool == 'bazel' | ||
# Install Bazel, see https://docs.bazel.build/versions/master/install-ubuntu.html#step-1-install-required-packages | ||
run: | | ||
sudo apt install curl gnupg | ||
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg | ||
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/ | ||
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list | ||
sudo apt update && sudo apt install bazel -y | ||
uses: bazel-contrib/[email protected] | ||
with: | ||
bazelisk-cache: true | ||
disk-cache: ${{ github.workflow }} | ||
repository-cache: true | ||
|
||
- name: Show bazel version | ||
if: matrix.build_tool == 'bazel' | ||
run: bazel --version | ||
|
||
- name: Update cmake | ||
if: matrix.build_tool == 'cmake' | ||
uses: jwlawson/[email protected] | ||
|
||
- name: Show cmake version | ||
if: matrix.build_tool == 'cmake' | ||
run: cmake --version | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# 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'}, | ||
] | ||
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 | ||
//... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# 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_abseil/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# 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'}, | ||
] | ||
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 | ||
//... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# 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_abseil/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# 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'}, | ||
] | ||
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 | ||
//... |
Oops, something went wrong.