Skip to content

Commit

Permalink
Ensure that dmlab2d can still build wheels
Browse files Browse the repository at this point in the history
- Pin version numbers in WORKSPACE to July 2023 versions (the time the
  wheels were built).
- Fix bazel-version to 7.4.1 to avoid migrating to MODULE.bzl
- stop supporting deprecated macos-12
- support new macos-14 (amd64)
  • Loading branch information
jagapiou committed Dec 17, 2024
1 parent 0947443 commit 6b995d4
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 45 deletions.
29 changes: 20 additions & 9 deletions .github/workflows/make_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,33 +32,37 @@ jobs:
prerelease: false

build-wheel:
name: Build-wheel ${{ matrix.cfg.name }} for Python ${{ matrix.py.version }}
name: Build-wheel ${{ matrix.cfg.name }} for Python ${{ matrix.python-version }}

runs-on: ${{ matrix.cfg.os }}

needs: create-release

strategy:
fail-fast: false
matrix:
cfg:
- { name: 'ManyLinux 2.35 LLVM+libstdc++', os: 'ubuntu-22.04', cc: clang, cxx: clang++, config: --linkopt=-fuse-ld=lld }
- { name: 'ManyLinux 2.31 LLVM+libstdc++', os: 'ubuntu-20.04', cc: clang, cxx: clang++, config: --linkopt=-fuse-ld=lld }
- { name: 'MacOS 11 x86_64 LLVM+libc++', os: 'macos-11', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
- { name: 'MacOS 12 x86_64 LLVM+libc++', os: 'macos-12', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
- { name: 'MacOS 13 x86_64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
- { name: 'MacOS 12 ARM64 LLVM+libc++', os: 'macos-12', cc: clang, cxx: clang++,
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_12_0_arm64 }
- { name: 'MacOS 13 ARM64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++,
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_13_0_arm64 }
- { name: 'MacOS 14 ARM64 LLVM+libc++', os: 'macos-14', cc: clang, cxx: clang++,
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_14_0_arm64 }
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
bazel-version:
- '7.4.1'

env:
CC: ${{ matrix.cfg.cc }}
CXX: ${{ matrix.cfg.cxx }}
USE_BAZEL_VERSION: ${{ matrix.bazel-version }}
WHEEL_NAME: ''

steps:
Expand All @@ -69,7 +73,12 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install Python Dependencies
run: pip3 install --upgrade pip packaging check-wheel-contents
run: |
pip3 install --upgrade setuptools packaging
which python3
python3 --version
pip3 list
bazel --version
- name: Build for Python ${{ matrix.python-version }}
run: bazel --bazelrc=.bazelrc build --compilation_mode=opt --dynamic_mode=off --config=luajit ${{ matrix.cfg.config }} //dmlab2d:dmlab2d_wheel
Expand All @@ -81,10 +90,12 @@ jobs:
echo WHEEL_NAME="${WHEEL_NAME}" >> "${GITHUB_ENV}"
- name: Check wheel contents
run: check-wheel-contents bazel-bin/dmlab2d/${{ env.WHEEL_NAME }}
run: |
pip3 install check-wheel-contents
check-wheel-contents bazel-bin/dmlab2d/${{ env.WHEEL_NAME }}
- name: Test wheel
if: (!contains(env.WHEEL_NAME, 'arm64'))
- name: Test wheel ${{ env.WHEEL_NAME }}
if: matrix.cfg.os != 'macos-13' && matrix.cfg.config != 'macos_arm64'
run: |
pip install bazel-bin/dmlab2d/${{ env.WHEEL_NAME }}
python -I - <<'____HERE'
Expand Down
47 changes: 30 additions & 17 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,69 +16,82 @@ concurrency:

jobs:
build-and-test:
name: Build+test ${{ matrix.name }}
name: Build+test ${{ matrix.cfg.name }}

runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.cfg.os }}

timeout-minutes: 30

strategy:
fail-fast: ${{ github.event_name != 'workflow_dispatch' }}
fail-fast: false
matrix:
include:
cfg:
- { name: 'Linux GCC', os: 'ubuntu-22.04', cc: gcc-12, cxx: g++-12, config: }
- { name: 'Linux LLVM+libstdc++', os: 'ubuntu-22.04', cc: clang, cxx: clang++, config: --linkopt=-fuse-ld=lld }
- { name: 'Linux LLVM+libc++', os: 'ubuntu-22.04', cc: clang, cxx: clang++, config: --config=libc++ --linkopt=-fuse-ld=lld }
- { name: 'MacOS 12 x86_64 LLVM+libc++', os: 'macos-12', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
- { name: 'MacOS 13 x86_64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
- { name: 'MacOS 12 ARM64 LLVM+libc++', os: 'macos-12', cc: clang, cxx: clang++, config: --config=libc++ --config=macos_arm64 }
- { name: 'MacOS 13 ARM64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++, config: --config=libc++ --config=macos_arm64 }
- { name: 'MacOS 14 ARM64 LLVM+libc++', os: 'macos-14', cc: clang, cxx: clang++, config: --config=libc++ --config=macos_arm64 }
bazel-version:
- '7.4.1'
python-version:
- '3.10'

env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CC: ${{ matrix.cfg.cc }}
CXX: ${{ matrix.cfg.cxx }}
USE_BAZEL_VERSION: ${{ matrix.bazel-version }}

steps:
- uses: actions/checkout@v3

- name: install infrastructure (Linux)
if: matrix.os == 'ubuntu-22.04'
if: startsWith( matrix.cfg.os, 'ubuntu-' )
run: |
sudo apt-get install python3-dev python3-numpy python3-packaging
sudo ln -s /usr/lib/llvm-10/include/c++/v1 /usr/include/c++/v1
- name: install infrastructure (MacOS)
if: matrix.os == 'macos-12' || matrix.os == 'macos-13'
run: sudo -H pip3 install numpy packaging
- name: Set up Python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Install Python dependencies
run: |
pip3 install numpy packaging
which python3
python3 --version
pip3 list
bazel --version
- name: build-lua5.1
run: |
bazel --bazelrc=.bazelrc build --config=lua5_1 ${{ matrix.config }} //...
- name: test-lua5.1
if: (!contains(matrix.config, 'arm64'))
if: matrix.cfg.os != 'macos-13' && matrix.cfg.config != 'macos_arm64'
run: |
bazel --bazelrc=.bazelrc test --config=lua5_1 ${{ matrix.config }} --test_output=errors //...
- name: build-lua5.2
run: |
bazel --bazelrc=.bazelrc build --config=lua5_2 ${{ matrix.config }} //...
- name: test-lua5.2
if: (!contains(matrix.config, 'arm64'))
if: matrix.cfg.os != 'macos-13' && matrix.cfg.config != 'macos_arm64'
run: |
bazel --bazelrc=.bazelrc test --config=lua5_2 ${{ matrix.config }} --test_output=errors //...
- name: build-luajit
run: |
bazel --bazelrc=.bazelrc build --config=luajit ${{ matrix.config }} //...
- name: test-luajit
if: (!contains(matrix.config, 'arm64'))
if: matrix.cfg.os != 'macos-13' && matrix.cfg.config != 'macos_arm64'
run: |
bazel --bazelrc=.bazelrc test --config=luajit ${{ matrix.config }} --test_output=errors //...
- name: build-luajit-internal_unwind
run: |
bazel --bazelrc=.bazelrc build --config=luajit ${{ matrix.config }} --copt=-fno-asynchronous-unwind-tables --luajit_external_unwinder=False //...
- name: test-luajit-internal_unwind
if: (!contains(matrix.config, 'arm64'))
if: matrix.cfg.os != 'macos-13' && matrix.cfg.config != 'macos_arm64'
run: |
bazel --bazelrc=.bazelrc test --config=luajit ${{ matrix.config }} --copt=-fno-asynchronous-unwind-tables --luajit_external_unwinder=False --test_output=errors //...
36 changes: 18 additions & 18 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,44 @@ load("@//:python_system.bzl", "python_repo")

http_archive(
name = "com_google_googletest",
strip_prefix = "googletest-main",
urls = ["https://github.com/google/googletest/archive/main.zip"],
strip_prefix = "googletest-1.13.0",
urls = ["https://github.com/google/googletest/archive/refs/tags/v1.13.0.zip"],
)

http_archive(
name = "com_google_benchmark",
strip_prefix = "benchmark-main",
urls = ["https://github.com/google/benchmark/archive/main.zip"],
strip_prefix = "benchmark-1.8.2",
urls = ["https://github.com/google/benchmark/archive/refs/tags/v1.8.2.zip"],
)

http_archive(
name = "rules_cc",
strip_prefix = "rules_cc-main",
urls = ["https://github.com/bazelbuild/rules_cc/archive/main.zip"],
strip_prefix = "rules_cc-0.0.8",
urls = ["https://github.com/bazelbuild/rules_cc/archive/refs/tags/0.0.8.zip"],
)

http_archive(
name = "rules_python",
strip_prefix = "rules_python-main",
url = "https://github.com/bazelbuild/rules_python/archive/main.zip",
strip_prefix = "rules_python-0.24.0",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.24.0.zip",
)

http_archive(
name = "bazel_skylib",
strip_prefix = "bazel-skylib-main",
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/main.zip"],
strip_prefix = "bazel-skylib-1.4.2",
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/refs/tags/1.4.2.zip"],
)

http_archive(
name = "com_google_absl",
strip_prefix = "abseil-cpp-master",
urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
strip_prefix = "abseil-cpp-20230125.3",
urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/20230125.3.zip"],
)

http_archive(
name = "com_google_absl_py",
strip_prefix = "abseil-py-main",
urls = ["https://github.com/abseil/abseil-py/archive/main.zip"],
strip_prefix = "abseil-py-1.4.0",
urls = ["https://github.com/abseil/abseil-py/archive/refs/tags/v1.4.0.zip"],
)

http_archive(
Expand Down Expand Up @@ -118,15 +118,15 @@ http_archive(
http_archive(
name = "tree_archive",
build_file = "@//bazel:tree.BUILD",
strip_prefix = "tree-master",
urls = ["https://github.com/deepmind/tree/archive/master.zip"],
strip_prefix = "tree-0.1.8",
urls = ["https://github.com/google-deepmind/tree/archive/refs/tags/0.1.8.zip"],
)

http_archive(
name = "pybind11_archive",
build_file = "@//bazel:pybind11.BUILD",
strip_prefix = "pybind11-master",
urls = ["https://github.com/pybind/pybind11/archive/master.zip"],
strip_prefix = "pybind11-2.11.1",
urls = ["https://github.com/pybind/pybind11/archive/refs/tags/v2.11.1.zip"],
)

http_archive(
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function install_dmlab2d() {
exit 1
;;
esac
C=clang CXX=clang++ bazel --bazelrc=.bazelrc build \
USE_BAZEL_VERSION=7.4.1 C=clang CXX=clang++ bazel --bazelrc=.bazelrc build \
--compilation_mode=opt \
--dynamic_mode=off \
--config=luajit \
Expand Down

0 comments on commit 6b995d4

Please sign in to comment.