Skip to content

Commit 2531d23

Browse files
committed
[bazel] configure CI options in .bazelrc instead of Dockerfile
1 parent 310e05b commit 2531d23

File tree

9 files changed

+47
-70
lines changed

9 files changed

+47
-70
lines changed

.bazelrc

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ build --flag_alias=with_bop=//ortools/linear_solver:with_bop
66
build --flag_alias=with_cbc=//ortools/linear_solver:with_cbc
77
build --flag_alias=with_clp=//ortools/linear_solver:with_clp
88
build --flag_alias=with_cp_sat=//ortools/linear_solver:with_cp_sat
9+
build --flag_alias=with_cplex=//ortools/linear_solver:with_cplex
910
build --flag_alias=with_glop=//ortools/linear_solver:with_glop
1011
build --flag_alias=with_glpk=//ortools/linear_solver:with_glpk
1112
build --flag_alias=with_highs=//ortools/linear_solver:with_highs
1213
build --flag_alias=with_pdlp=//ortools/linear_solver:with_pdlp
1314
build --flag_alias=with_scip=//ortools/linear_solver:with_scip
14-
15-
build --flag_alias=with_cplex=//ortools/linear_solver:with_cplex
1615
build --flag_alias=with_xpress=//ortools/linear_solver:with_xpress
1716

1817
# Sets the default Apple platform to macOS.
@@ -43,11 +42,37 @@ build:windows --host_cxxopt="/std:c++20"
4342
startup --windows_enable_symlinks
4443
build:windows --enable_runfiles
4544

46-
# Print command lines for build commands.
47-
# build --subcommands=pretty_print
4845

49-
# Print test logs for failed tests.
50-
test --test_output=errors --test_timeout_filters=-eternal
46+
###############################################################################
47+
# Options for continuous integration.
48+
###############################################################################
49+
50+
# All build options also apply to test as described by the "Option precedence"
51+
# section in https://bazel.build/run/bazelrc#bazelrc-syntax-semantics.
52+
53+
# Note for anybody considering using --compilation_mode=opt in CI, it builds
54+
# most files twice, one PIC version for shared libraries in tests, and one
55+
# non-PIC version for binaries.
56+
build:ci --copt=-O1
57+
58+
# Speedup bazel using a ramdisk.
59+
build:ci --sandbox_base=/dev/shm
60+
61+
# Show as many errors as possible.
62+
build:ci --keep_going
63+
64+
# Show test errors.
65+
build:ci --test_output=errors
66+
67+
# Override timeout for tests
68+
build:ci --test_timeout_filters=-eternal
69+
70+
# Only show failing tests to reduce output
71+
build:ci --test_summary=terse
72+
73+
# Attempt to work around intermittent issue while trying to fetch remote blob.
74+
# See e.g. https://github.com/bazelbuild/bazel/issues/18694.
75+
build:ci --remote_default_exec_properties=cache-silo-key=CleverPeafowl
5176

5277
# Put user-specific options in .bazelrc.user
5378
try-import %workspace%/.bazelrc.user

bazel/docker/almalinux/Dockerfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,7 @@ COPY . .
3838

3939
FROM devel AS build
4040
RUN bazel version
41-
RUN bazel build \
42-
-c opt \
43-
--subcommands=true \
44-
//ortools/... //examples/...
41+
RUN bazel build --config=ci //ortools/... //examples/...
4542

4643
FROM build AS test
47-
RUN bazel test \
48-
-c opt \
49-
--test_output=errors \
50-
//ortools/... //examples/...
44+
RUN bazel test --config=ci //ortools/... //examples/...

bazel/docker/alpine/Dockerfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,7 @@ COPY . .
2020

2121
FROM devel AS build
2222
RUN bazel version
23-
RUN bazel build \
24-
-c opt \
25-
--subcommands=true \
26-
//ortools/... //examples/...
23+
RUN bazel build --config=ci //ortools/... //examples/...
2724

2825
FROM build AS test
29-
RUN bazel test \
30-
-c opt \
31-
--test_output=errors \
32-
//ortools/... //examples/...
26+
RUN bazel test --config=ci //ortools/... //examples/...

bazel/docker/archlinux/Dockerfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ COPY . .
1616

1717
FROM devel AS build
1818
RUN bazel version
19-
RUN bazel build \
20-
-c opt \
21-
--subcommands=true \
22-
//ortools/... //examples/...
19+
RUN bazel build --config=ci //ortools/... //examples/...
2320

2421
FROM build AS test
25-
RUN bazel test \
26-
-c opt \
27-
--test_output=errors \
28-
//ortools/... //examples/...
22+
RUN bazel test --config=ci //ortools/... //examples/...

bazel/docker/debian/Dockerfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,7 @@ COPY . .
2626

2727
FROM devel AS build
2828
RUN bazel version
29-
RUN bazel build \
30-
-c opt \
31-
--subcommands=true \
32-
//ortools/... //examples/...
29+
RUN bazel build --config=ci //ortools/... //examples/...
3330

3431
FROM build AS test
35-
RUN bazel test \
36-
-c opt \
37-
--test_output=errors \
38-
//ortools/... //examples/...
32+
RUN bazel test --config=ci //ortools/... //examples/...

bazel/docker/fedora/Dockerfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,7 @@ COPY . .
3535

3636
FROM devel AS build
3737
RUN bazel version
38-
RUN bazel build \
39-
-c opt \
40-
--subcommands=true \
41-
//ortools/... //examples/...
38+
RUN bazel build --config=ci //ortools/... //examples/...
4239

4340
FROM build AS test
44-
RUN bazel test \
45-
-c opt \
46-
--test_output=errors \
47-
//ortools/... //examples/...
41+
RUN bazel test --config=ci //ortools/... //examples/...

bazel/docker/opensuse/Dockerfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,7 @@ COPY . .
3232

3333
FROM devel AS build
3434
RUN bazel version
35-
RUN bazel build \
36-
-c opt \
37-
--subcommands=true \
38-
//ortools/... //examples/...
35+
RUN bazel build --config=ci //ortools/... //examples/...
3936

4037
FROM build AS test
41-
RUN bazel test \
42-
-c opt \
43-
--test_output=errors \
44-
//ortools/... //examples/...
38+
RUN bazel test --config=ci //ortools/... //examples/...

bazel/docker/rockylinux/Dockerfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,7 @@ COPY . .
3838

3939
FROM devel AS build
4040
RUN bazel version
41-
RUN bazel build \
42-
-c opt \
43-
--subcommands=true \
44-
//ortools/... //examples/...
41+
RUN bazel build --config=ci //ortools/... //examples/...
4542

4643
FROM build AS test
47-
RUN bazel test \
48-
-c opt \
49-
--test_output=errors \
50-
//ortools/... //examples/...
44+
RUN bazel test --config=ci //ortools/... //examples/...

bazel/docker/ubuntu/Dockerfile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,7 @@ COPY . .
3232

3333
FROM devel AS build
3434
RUN bazel version
35-
RUN bazel build \
36-
-c opt \
37-
--subcommands=true \
38-
//ortools/... //examples/...
35+
RUN bazel build --config=ci //ortools/... //examples/...
3936

4037
FROM build AS test
41-
RUN bazel test \
42-
-c opt \
43-
--test_output=errors \
44-
//ortools/... //examples/...
38+
RUN bazel test --config=ci //ortools/... //examples/...

0 commit comments

Comments
 (0)