Skip to content

Commit 44277d2

Browse files
committed
Try using bazelbuild/setup-bazelisk everywhere.
This should hopefully mean that the `bazel` command found first in the path is actually Bazelisk. Revert various previous attempts to get all this working... Change-Id: I9a6267aff334de3dc55c7333d83e67ad2ad4ef05 Reviewed-on: https://code-review.googlesource.com/c/re2/+/61610 Reviewed-by: Perry Lorier <perryl@google.com> Reviewed-by: Paul Wankadia <junyer@google.com>
1 parent c20f76e commit 44277d2

5 files changed

Lines changed: 23 additions & 17 deletions

File tree

.github/bazel.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#!/bin/bash
22
set -eux
33

4-
bazelisk clean
5-
bazelisk build --compilation_mode=dbg -- //:all
6-
bazelisk test --compilation_mode=dbg -- //:all \
4+
bazel clean
5+
bazel build --compilation_mode=dbg -- //:all
6+
bazel test --compilation_mode=dbg -- //:all \
77
-//:dfa_test \
88
-//:exhaustive1_test \
99
-//:exhaustive2_test \
1010
-//:exhaustive3_test \
1111
-//:exhaustive_test \
1212
-//:random_test
1313

14-
bazelisk clean
15-
bazelisk build --compilation_mode=opt -- //:all
16-
bazelisk test --compilation_mode=opt -- //:all \
14+
bazel clean
15+
bazel build --compilation_mode=opt -- //:all
16+
bazel test --compilation_mode=opt -- //:all \
1717
-//:dfa_test \
1818
-//:exhaustive1_test \
1919
-//:exhaustive2_test \

.github/workflows/ci-bazel.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ jobs:
1313
BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1414
steps:
1515
- uses: actions/checkout@v3
16+
# TODO(junyer): Use `v2` whenever a new release is tagged.
17+
- uses: bazelbuild/setup-bazelisk@6244971d4f7ba9aca943c2f3ede2bbd813fcca51
1618
- run: .github/bazel.sh
1719
shell: bash

.github/workflows/python.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
shell: bash
3737
- name: Build wheel
3838
run: |
39-
BAZELISK="$(which bazelisk)" python setup.py bdist_wheel
39+
python setup.py bdist_wheel
4040
python -m auditwheel repair --wheel-dir=. dist/*
4141
shell: bash
4242
working-directory: python
@@ -70,6 +70,8 @@ jobs:
7070
SYSTEM_VERSION_COMPAT: 0
7171
steps:
7272
- uses: actions/checkout@v3
73+
# TODO(junyer): Use `v2` whenever a new release is tagged.
74+
- uses: bazelbuild/setup-bazelisk@6244971d4f7ba9aca943c2f3ede2bbd813fcca51
7375
- uses: actions/setup-python@v4
7476
with:
7577
python-version: ${{ matrix.ver }}
@@ -81,7 +83,7 @@ jobs:
8183
shell: bash
8284
- name: Build wheel
8385
run: |
84-
BAZELISK="$(which bazelisk)" python setup.py bdist_wheel \
86+
python setup.py bdist_wheel \
8587
--plat-name=macosx-${{ matrix.os }}.0-${{ matrix.arch.python-name }}
8688
python -m delocate.cmd.delocate_wheel --wheel-dir=. dist/*
8789
shell: bash
@@ -117,6 +119,8 @@ jobs:
117119
BAZEL_CPU: ${{ matrix.arch.bazel-name }}_windows
118120
steps:
119121
- uses: actions/checkout@v3
122+
# TODO(junyer): Use `v2` whenever a new release is tagged.
123+
- uses: bazelbuild/setup-bazelisk@6244971d4f7ba9aca943c2f3ede2bbd813fcca51
120124
- uses: actions/setup-python@v4
121125
with:
122126
python-version: ${{ matrix.ver }}
@@ -128,7 +132,7 @@ jobs:
128132
shell: bash
129133
- name: Build wheel
130134
run: |
131-
BAZELISK="$(which bazelisk)" python setup.py bdist_wheel \
135+
python setup.py bdist_wheel \
132136
--plat-name=${{ matrix.arch.python-name }}
133137
python -m delvewheel --wheel-dir=. dist/*
134138
shell: bash

app/build.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eux
44
SRCDIR=$(readlink --canonicalize $(dirname $0))
55
DSTDIR=$(mktemp --directory --tmpdir $(basename $0).XXXXXXXXXX)
66

7-
BAZELISK=/tmp/bazelisk
7+
BAZEL=/tmp/bazel
88
BAZELISK_RELEASE=v1.17.0
99

1010
if [[ ${UID} -ne 0 ]]; then
@@ -16,18 +16,18 @@ if [[ ${UID} -ne 0 ]]; then
1616
sudo docker run -i -t --pull always --rm -v ${SRCDIR}/..:/src -v ${PWD}:/dst emscripten/emsdk /src/app/$(basename $0)
1717
ls -l deploy
1818
else
19-
wget -O ${BAZELISK} https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_RELEASE}/bazelisk-linux-amd64
20-
chmod +x ${BAZELISK}
19+
wget -O ${BAZEL} https://github.com/bazelbuild/bazelisk/releases/download/${BAZELISK_RELEASE}/bazelisk-linux-amd64
20+
chmod +x ${BAZEL}
2121

2222
cd ${SRCDIR}
2323
# Emscripten doesn't support `-fstack-protector`.
2424
AR=emar CC=emcc \
25-
${BAZELISK} build --compilation_mode=opt \
25+
${BAZEL} build --compilation_mode=opt \
2626
--copt=-fno-stack-protector \
2727
-- :all
2828
cp ../bazel-bin/app/_re2.js ${DSTDIR}
2929
# Clean up the sundry Bazel output directories.
30-
${BAZELISK} clean --expunge
30+
${BAZEL} clean --expunge
3131
cp app.ts index.html _re2.d.ts ${DSTDIR}
3232
cp package.json rollup.config.js tsconfig.json ${DSTDIR}
3333

python/setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@
4545
class BuildExt(setuptools.command.build_ext.build_ext):
4646

4747
def build_extension(self, ext):
48-
if 'BAZELISK' not in os.environ:
48+
if 'GITHUB_ACTIONS' not in os.environ:
4949
return super().build_extension(ext)
5050

5151
# For @pybind11_bazel's `python_configure()`.
5252
os.environ['PYTHON_BIN_PATH'] = sys.executable
5353

54-
cmd = [os.environ['BAZELISK'], 'build']
54+
cmd = ['bazel', 'build']
5555
if 'BAZEL_CPU' in os.environ:
5656
cmd.append(f'--cpu={os.environ["BAZEL_CPU"].lower()}')
5757
cmd += ['--compilation_mode=opt', '--', ':all']
@@ -62,7 +62,7 @@ def build_extension(self, ext):
6262
shutil.copyfile('../bazel-bin/python/_re2.so',
6363
self.get_ext_fullpath(ext.name))
6464

65-
cmd = [os.environ['BAZELISK'], 'clean', '--expunge']
65+
cmd = ['bazel', 'clean', '--expunge']
6666
self.spawn(cmd)
6767

6868

0 commit comments

Comments
 (0)