Skip to content

Commit 976cf60

Browse files
committed
Ensure that dmlab2d can still build wheels
- add required blaze flags to keep build working in bazel 8 - ensure reproducible builds by pinning version numbers - stop supporting deprecated macos-12 - support new macos-14 (amd64)
1 parent 0947443 commit 976cf60

File tree

5 files changed

+96
-65
lines changed

5 files changed

+96
-65
lines changed

.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
build --cxxopt=-std=c++17
22
build --cxxopt=-Wno-sign-compare --cxxopt=-Wno-attributes
33
build --enable_platform_specific_config
4+
build --enable_workspace --noenable_bzlmod
45
build --flag_alias=lua_version=//dmlab2d/lib/lua:lua_version
56
build --flag_alias=macos_target_arch=@luajit_archive//:target_arch
67
build --flag_alias=luajit_external_unwinder=@luajit_archive//:use_external_unwinder
8+
build --incompatible_disallow_empty_glob=false
79

810
build:libc++ --repo_env=CXXFLAGS=-stdlib=libc++
911
build:libc++ --repo_env=LDFLAGS=-stdlib=libc++

.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.x

.github/workflows/make_wheel.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,30 @@ jobs:
3232
prerelease: false
3333

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

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

3939
needs: create-release
4040

4141
strategy:
42+
fail-fast: false
4243
matrix:
4344
cfg:
4445
- { name: 'ManyLinux 2.35 LLVM+libstdc++', os: 'ubuntu-22.04', cc: clang, cxx: clang++, config: --linkopt=-fuse-ld=lld }
4546
- { name: 'ManyLinux 2.31 LLVM+libstdc++', os: 'ubuntu-20.04', cc: clang, cxx: clang++, config: --linkopt=-fuse-ld=lld }
46-
- { name: 'MacOS 11 x86_64 LLVM+libc++', os: 'macos-11', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
47-
- { name: 'MacOS 12 x86_64 LLVM+libc++', os: 'macos-12', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
4847
- { name: 'MacOS 13 x86_64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
49-
- { name: 'MacOS 12 ARM64 LLVM+libc++', os: 'macos-12', cc: clang, cxx: clang++,
50-
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_12_0_arm64 }
5148
- { name: 'MacOS 13 ARM64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++,
5249
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_13_0_arm64 }
50+
- { name: 'MacOS 14 ARM64 LLVM+libc++', os: 'macos-14', cc: clang, cxx: clang++,
51+
config: --config=libc++ --config=macos_arm64 --repo_env=PY_PLATFORM_OVERRIDE=macosx_14_0_arm64 }
5352
python-version:
5453
- '3.8'
5554
- '3.9'
5655
- '3.10'
5756
- '3.11'
57+
- '3.12'
58+
- '3.13'
5859

5960
env:
6061
CC: ${{ matrix.cfg.cc }}
@@ -69,7 +70,12 @@ jobs:
6970
python-version: ${{ matrix.python-version }}
7071

7172
- name: Install Python Dependencies
72-
run: pip3 install --upgrade pip packaging check-wheel-contents
73+
run: |
74+
pip3 install --upgrade setuptools packaging
75+
which python3
76+
python3 --version
77+
pip3 list
78+
bazel --version
7379
7480
- name: Build for Python ${{ matrix.python-version }}
7581
run: bazel --bazelrc=.bazelrc build --compilation_mode=opt --dynamic_mode=off --config=luajit ${{ matrix.cfg.config }} //dmlab2d:dmlab2d_wheel
@@ -81,10 +87,12 @@ jobs:
8187
echo WHEEL_NAME="${WHEEL_NAME}" >> "${GITHUB_ENV}"
8288
8389
- name: Check wheel contents
84-
run: check-wheel-contents bazel-bin/dmlab2d/${{ env.WHEEL_NAME }}
90+
run: |
91+
pip3 install check-wheel-contents
92+
check-wheel-contents bazel-bin/dmlab2d/${{ env.WHEEL_NAME }}
8593
86-
- name: Test wheel
87-
if: (!contains(env.WHEEL_NAME, 'arm64'))
94+
- name: Test wheel ${{ env.WHEEL_NAME }}
95+
if: matrix.cfg.os != 'macos-13' && matrix.cfg.config != 'macos_arm64'
8896
run: |
8997
pip install bazel-bin/dmlab2d/${{ env.WHEEL_NAME }}
9098
python -I - <<'____HERE'

.github/workflows/precommit.yml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,69 +16,79 @@ concurrency:
1616

1717
jobs:
1818
build-and-test:
19-
name: Build+test ${{ matrix.name }}
19+
name: Build+test ${{ matrix.cfg.name }}
2020

21-
runs-on: ${{ matrix.os }}
21+
runs-on: ${{ matrix.cfg.os }}
2222

2323
timeout-minutes: 30
2424

2525
strategy:
26-
fail-fast: ${{ github.event_name != 'workflow_dispatch' }}
26+
fail-fast: false
2727
matrix:
28-
include:
28+
cfg:
2929
- { name: 'Linux GCC', os: 'ubuntu-22.04', cc: gcc-12, cxx: g++-12, config: }
3030
- { name: 'Linux LLVM+libstdc++', os: 'ubuntu-22.04', cc: clang, cxx: clang++, config: --linkopt=-fuse-ld=lld }
3131
- { name: 'Linux LLVM+libc++', os: 'ubuntu-22.04', cc: clang, cxx: clang++, config: --config=libc++ --linkopt=-fuse-ld=lld }
32-
- { name: 'MacOS 12 x86_64 LLVM+libc++', os: 'macos-12', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
3332
- { name: 'MacOS 13 x86_64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++, config: --config=libc++ --config=macos }
34-
- { name: 'MacOS 12 ARM64 LLVM+libc++', os: 'macos-12', cc: clang, cxx: clang++, config: --config=libc++ --config=macos_arm64 }
3533
- { name: 'MacOS 13 ARM64 LLVM+libc++', os: 'macos-13', cc: clang, cxx: clang++, config: --config=libc++ --config=macos_arm64 }
34+
- { name: 'MacOS 14 ARM64 LLVM+libc++', os: 'macos-14', cc: clang, cxx: clang++, config: --config=libc++ --config=macos_arm64 }
35+
python-version:
36+
- '3.10'
3637

3738
env:
38-
CC: ${{ matrix.cc }}
39-
CXX: ${{ matrix.cxx }}
39+
CC: ${{ matrix.cfg.cc }}
40+
CXX: ${{ matrix.cfg.cxx }}
4041

4142
steps:
4243
- uses: actions/checkout@v3
4344

4445
- name: install infrastructure (Linux)
45-
if: matrix.os == 'ubuntu-22.04'
46+
if: startsWith( matrix.cfg.os, 'ubuntu-' )
4647
run: |
47-
sudo apt-get install python3-dev python3-numpy python3-packaging
4848
sudo ln -s /usr/lib/llvm-10/include/c++/v1 /usr/include/c++/v1
4949
50-
- name: install infrastructure (MacOS)
51-
if: matrix.os == 'macos-12' || matrix.os == 'macos-13'
52-
run: sudo -H pip3 install numpy packaging
50+
- name: Set up Python ${{ matrix.python-version }}
51+
id: setup-python
52+
uses: actions/setup-python@v3
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
56+
- name: Install Python dependencies
57+
run: |
58+
pip3 install numpy packaging
59+
which python3
60+
python3 --version
61+
pip3 list
62+
bazel --version
5363
5464
- name: build-lua5.1
5565
run: |
5666
bazel --bazelrc=.bazelrc build --config=lua5_1 ${{ matrix.config }} //...
5767
- name: test-lua5.1
58-
if: (!contains(matrix.config, 'arm64'))
68+
if: matrix.cfg.os != 'macos-13' && matrix.cfg.config != 'macos_arm64'
5969
run: |
6070
bazel --bazelrc=.bazelrc test --config=lua5_1 ${{ matrix.config }} --test_output=errors //...
6171
6272
- name: build-lua5.2
6373
run: |
6474
bazel --bazelrc=.bazelrc build --config=lua5_2 ${{ matrix.config }} //...
6575
- name: test-lua5.2
66-
if: (!contains(matrix.config, 'arm64'))
76+
if: matrix.cfg.os != 'macos-13' && matrix.cfg.config != 'macos_arm64'
6777
run: |
6878
bazel --bazelrc=.bazelrc test --config=lua5_2 ${{ matrix.config }} --test_output=errors //...
6979
7080
- name: build-luajit
7181
run: |
7282
bazel --bazelrc=.bazelrc build --config=luajit ${{ matrix.config }} //...
7383
- name: test-luajit
74-
if: (!contains(matrix.config, 'arm64'))
84+
if: matrix.cfg.os != 'macos-13' && matrix.cfg.config != 'macos_arm64'
7585
run: |
7686
bazel --bazelrc=.bazelrc test --config=luajit ${{ matrix.config }} --test_output=errors //...
7787
7888
- name: build-luajit-internal_unwind
7989
run: |
8090
bazel --bazelrc=.bazelrc build --config=luajit ${{ matrix.config }} --copt=-fno-asynchronous-unwind-tables --luajit_external_unwinder=False //...
8191
- name: test-luajit-internal_unwind
82-
if: (!contains(matrix.config, 'arm64'))
92+
if: matrix.cfg.os != 'macos-13' && matrix.cfg.config != 'macos_arm64'
8393
run: |
8494
bazel --bazelrc=.bazelrc test --config=luajit ${{ matrix.config }} --copt=-fno-asynchronous-unwind-tables --luajit_external_unwinder=False --test_output=errors //...

WORKSPACE

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,76 +5,83 @@ load("@//:python_system.bzl", "python_repo")
55

66
http_archive(
77
name = "com_google_googletest",
8-
strip_prefix = "googletest-main",
9-
urls = ["https://github.com/google/googletest/archive/main.zip"],
8+
sha256 = "f179ec217f9b3b3f3c6e8b02d3e7eda997b49e4ce26d6b235c9053bec9c0bf9f",
9+
strip_prefix = "googletest-1.15.2",
10+
urls = ["https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip"],
1011
)
1112

1213
http_archive(
1314
name = "com_google_benchmark",
14-
strip_prefix = "benchmark-main",
15-
urls = ["https://github.com/google/benchmark/archive/main.zip"],
15+
sha256 = "8a63c9c6adf9e7ce8d0d81f251c47de83efb5e077e147d109fa2045daac8368b",
16+
strip_prefix = "benchmark-1.9.1",
17+
urls = ["https://github.com/google/benchmark/archive/refs/tags/v1.9.1.zip"],
1618
)
1719

1820
http_archive(
1921
name = "rules_cc",
20-
strip_prefix = "rules_cc-main",
21-
urls = ["https://github.com/bazelbuild/rules_cc/archive/main.zip"],
22+
sha256 = "e7c1639aa227d2cd335825d37caa2a234b40373be3ef8f87c25724ed01cab5e8",
23+
strip_prefix = "rules_cc-0.0.17",
24+
urls = ["https://github.com/bazelbuild/rules_cc/archive/refs/tags/0.0.17.zip"],
2225
)
2326

2427
http_archive(
2528
name = "rules_python",
26-
strip_prefix = "rules_python-main",
27-
url = "https://github.com/bazelbuild/rules_python/archive/main.zip",
29+
sha256 = "7149fff45f7925bb6d45543ed99bfd3544ec63df82ef70cf0ce38b669c9d3bd6",
30+
strip_prefix = "rules_python-1.0.0",
31+
urls = ["https://github.com/bazelbuild/rules_python/archive/refs/tags/1.0.0.zip"],
2832
)
2933

3034
http_archive(
3135
name = "bazel_skylib",
32-
strip_prefix = "bazel-skylib-main",
33-
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/main.zip"],
36+
sha256 = "23ef380aa62e2f1b631d02d0c9d163e43be03e880953dafe133d754fb8d96f0a",
37+
strip_prefix = "bazel-skylib-1.7.1",
38+
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/refs/tags/1.7.1.zip"],
3439
)
3540

3641
http_archive(
3742
name = "com_google_absl",
38-
strip_prefix = "abseil-cpp-master",
39-
urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
43+
sha256 = "95e90be7c3643e658670e0dd3c1b27092349c34b632c6e795686355f67eca89f",
44+
strip_prefix = "abseil-cpp-20240722.0",
45+
urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/20240722.0.zip"],
4046
)
4147

4248
http_archive(
4349
name = "com_google_absl_py",
44-
strip_prefix = "abseil-py-main",
45-
urls = ["https://github.com/abseil/abseil-py/archive/main.zip"],
50+
sha256 = "e11083ee5a69afe5c82321ec2505061407ec315789b9b886cbfaf46560431c0b",
51+
strip_prefix = "abseil-py-2.1.0",
52+
urls = ["https://github.com/abseil/abseil-py/archive/refs/tags/v2.1.0.zip"],
4653
)
4754

4855
http_archive(
4956
name = "eigen_archive",
5057
build_file = "@//bazel:eigen.BUILD",
51-
sha256 = "515b3c266d798f3a112efe781dda0cf1aef7bd73f6864d8f4f16129310ae1fdf",
52-
strip_prefix = "eigen-b02c384ef4e8eba7b8bdef16f9dc6f8f4d6a6b2b",
58+
sha256 = "8586084f71f9bde545ee7fa6d00288b264a2b7ac3607b974e54d13e7162c1c72",
59+
strip_prefix = "eigen-3.4.0",
5360
urls = [
54-
"https://gitlab.com/libeigen/eigen/-/archive/b02c384ef4e8eba7b8bdef16f9dc6f8f4d6a6b2b/eigen-b02c384ef4e8eba7b8bdef16f9dc6f8f4d6a6b2b.tar.gz",
55-
"https://storage.googleapis.com/mirror.tensorflow.org/gitlab.com/libeigen/eigen/-/archive/b02c384ef4e8eba7b8bdef16f9dc6f8f4d6a6b2b/eigen-b02c384ef4e8eba7b8bdef16f9dc6f8f4d6a6b2b.tar.gz",
61+
"https://mirror.bazel.build/gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz",
62+
"https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.tar.gz",
5663
],
5764
)
5865

5966
http_archive(
6067
name = "png_archive",
6168
build_file = "@//bazel:png.BUILD",
62-
sha256 = "c2c50c13a727af73ecd3fc0167d78592cf5e0bca9611058ca414b6493339c784",
63-
strip_prefix = "libpng-1.6.37",
69+
sha256 = "0b35b4bbdf454d589bf8195bc281fefecc4b2529b42ddfbe8b6c108b986841f9",
70+
strip_prefix = "libpng-1.6.44",
6471
urls = [
65-
"https://mirror.bazel.build/github.com/glennrp/libpng/archive/v1.6.37.zip",
66-
"https://github.com/glennrp/libpng/archive/v1.6.37.zip",
72+
"https://mirror.bazel.build/github.com/pnggroup/libpng/archive/v1.6.44.zip",
73+
"https://github.com/pnggroup/libpng/archive/refs/tags/v1.6.44.zip",
6774
],
6875
)
6976

7077
http_archive(
7178
name = "zlib_archive",
7279
build_file = "@//bazel:zlib.BUILD",
73-
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
74-
strip_prefix = "zlib-1.2.11",
80+
sha256 = "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23",
81+
strip_prefix = "zlib-1.3.1",
7582
urls = [
76-
"https://mirror.bazel.build/zlib.net/zlib-1.2.11.tar.gz",
77-
"https://zlib.net/zlib-1.2.11.tar.gz",
83+
"https://mirror.bazel.build/zlib.net/zlib-1.3.1.tar.gz",
84+
"https://zlib.net/zlib-1.3.1.tar.gz",
7885
],
7986
)
8087

@@ -92,54 +99,57 @@ http_archive(
9299
http_archive(
93100
name = "lua5_2_archive",
94101
build_file = "@//bazel:lua5_2.BUILD",
102+
sha256 = "b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b",
95103
strip_prefix = "lua-5.2.4/src",
96104
urls = [
97105
"https://mirror.bazel.build/www.lua.org/ftp/lua-5.2.4.tar.gz",
98106
"https://www.lua.org/ftp/lua-5.2.4.tar.gz",
99107
],
100108
)
101109

102-
LJ_VER="f0ff869bc2fffa17bb765c4c773457578da125a9"
103-
104110
http_archive(
105111
name = "luajit_archive",
106112
build_file = "@//bazel:luajit.BUILD",
107-
strip_prefix = "LuaJIT-{}".format(LJ_VER),
108-
urls = ["https://github.com/LuaJIT/LuaJIT/archive/{}.tar.gz".format(LJ_VER)],
113+
sha256 = "4af5d94608a7ab72c9a7f72833a9222a7e0a298255e058902c4a59012c53bbfc",
114+
strip_prefix = "LuaJIT-f0ff869bc2fffa17bb765c4c773457578da125a9",
115+
urls = ["https://github.com/LuaJIT/LuaJIT/archive/f0ff869bc2fffa17bb765c4c773457578da125a9.tar.gz"],
109116
)
110117

111118
http_archive(
112119
name = "dm_env_archive",
113120
build_file = "@//bazel:dm_env.BUILD",
114-
strip_prefix = "dm_env-3c6844db2aa4ed5994b2c45dbfd9f31ad948fbb8",
115-
urls = ["https://github.com/deepmind/dm_env/archive/3c6844db2aa4ed5994b2c45dbfd9f31ad948fbb8.zip"],
121+
sha256 = "ed832e301bfddb6e98812567ee0217f6016c862357a0af2a94088ac6e6224af6",
122+
strip_prefix = "dm_env-ea2a17bed7a60c82f637891c53f3a37f70d91486",
123+
urls = ["https://github.com/deepmind/dm_env/archive/ea2a17bed7a60c82f637891c53f3a37f70d91486.zip"],
116124
)
117125

118126
http_archive(
119127
name = "tree_archive",
120128
build_file = "@//bazel:tree.BUILD",
121-
strip_prefix = "tree-master",
122-
urls = ["https://github.com/deepmind/tree/archive/master.zip"],
129+
sha256 = "407606263ee3f049da5c49071522cf5d37142c2de04ba52c9d599da948f4ee08",
130+
strip_prefix = "tree-0.1.8",
131+
urls = ["https://github.com/google-deepmind/tree/archive/refs/tags/0.1.8.zip"],
123132
)
124133

125134
http_archive(
126135
name = "pybind11_archive",
127136
build_file = "@//bazel:pybind11.BUILD",
128-
strip_prefix = "pybind11-master",
129-
urls = ["https://github.com/pybind/pybind11/archive/master.zip"],
137+
sha256 = "d0a116e91f64a4a2d8fb7590c34242df92258a61ec644b79127951e821b47be6",
138+
strip_prefix = "pybind11-2.13.6",
139+
urls = ["https://github.com/pybind/pybind11/archive/refs/tags/v2.13.6.zip"],
130140
)
131141

132142
http_archive(
133143
name = "build_bazel_apple_support",
134-
sha256 = "9f7bb62c3ae889e0eae8c18458fd8764e2e537687d9a1d85885d6af980e4fc31",
135-
url = "https://github.com/bazelbuild/apple_support/releases/download/1.6.0/apple_support.1.6.0.tar.gz",
144+
sha256 = "b53f6491e742549f13866628ddffcc75d1f3b2d6987dc4f14a16b242113c890b",
145+
urls = ["https://github.com/bazelbuild/apple_support/releases/download/1.17.1/apple_support.1.17.1.tar.gz"],
136146
)
137147

138148
load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies")
139149

140150
apple_support_dependencies()
141151

142-
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
152+
load("@rules_python//python:repositories.bzl", "py_repositories")
143153

144154
py_repositories()
145155

0 commit comments

Comments
 (0)