-
Notifications
You must be signed in to change notification settings - Fork 312
/
Copy pathbazel-8.yaml
167 lines (149 loc) · 4.25 KB
/
bazel-8.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
package:
name: bazel-8
version: "8.1.1"
epoch: 0
description: Bazel is an open-source build and test tool
resources:
cpu: 16
memory: 16Gi
dependencies:
provides:
- bazel=${{package.full-version}}
copyright:
- license: Apache-2.0
environment:
contents:
packages:
- bash
- build-base
- busybox
- ca-certificates-bundle
- libstdc++-6
- libstdc++-6-dev
- openjdk-21
- openssf-compiler-options
- python3
- zip
pipeline:
- uses: fetch
with:
expected-sha256: 4c9487a16f7841150092f07d93a6727d66f2c4133a617d739dca8ec83fb0099c
uri: https://github.com/bazelbuild/bazel/releases/download/${{package.version}}/bazel-${{package.version}}-dist.zip
extract: false
delete: false
- runs: unzip bazel-${{package.version}}-dist.zip
- runs: |
mkdir -p $HOME/.cache/bazel/_bazel_root
export JAVA_HOME=/usr/lib/jvm/java-21-openjdk
EMBED_LABEL=${{package.version}}-${{package.epoch}} \
EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk \
--cxxopt=-fdelete-null-pointer-checks \
--host_cxxopt=-fdelete-null-pointer-checks" \
bash ./compile.sh
./output/bazel clean --expunge
mkdir -p ${{targets.destdir}}/usr/bin
cp ./output/bazel ${{targets.destdir}}/usr/bin/
update:
enabled: true
github:
identifier: bazelbuild/bazel
strip-prefix: v
tag-filter: "8."
test:
environment:
contents:
packages:
- bash
- git
- python3
- openjdk-21
- openjdk-21-default-jvm
- gcc
environment:
JAVA_HOME: /usr/lib/jvm/java-21-openjdk
pipeline:
- name: "Verify bazel version"
runs: |
bazel --version
- name: "Test workspace creation and basic build: default behaviour"
runs: |
mkdir -p test-workspace
cd test-workspace
cat > WORKSPACE <<'EOF'
workspace(name = "test_workspace")
EOF
cat > MODULE.bazel <<'EOF'
bazel_dep(name = "rules_python", version = "1.1.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
configure_coverage_tool = False,
ignore_root_user_error = True,
python_version = "3.11",
)
EOF
cat > BUILD <<'EOF'
genrule(
name = "hello",
outs = ["hello.txt"],
cmd = "echo 'Hello, Wolfi!' > $@",
)
EOF
bazel build //:hello
test -f bazel-bin/hello.txt
- name: "Test workspace creation and basic build: --enable_workspace"
runs: |
mkdir -p test-workspace
cd test-workspace
cat > WORKSPACE <<'EOF'
workspace(name = "test_workspace")
EOF
cat > BUILD <<'EOF'
genrule(
name = "hello",
outs = ["hello.txt"],
cmd = "echo 'Hello, Wolfi!' > $@",
)
EOF
bazel build --noenable_bzlmod --enable_workspace //:hello
test -f bazel-bin/hello.txt
- name: "Test Java project build"
runs: |
mkdir -p java-test/src/main/java/hello
cd java-test
cat > WORKSPACE <<'EOF'
workspace(name = "java_test")
EOF
cat > MODULE.bazel <<'EOF'
bazel_dep(name = "rules_python", version = "1.1.0")
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
configure_coverage_tool = False,
ignore_root_user_error = True,
python_version = "3.11",
)
EOF
cat > BUILD <<'EOF'
java_binary(
name = "hello",
srcs = ["src/main/java/hello/Hello.java"],
main_class = "hello.Hello",
)
EOF
cat > src/main/java/hello/Hello.java <<'EOF'
package hello;
public class Hello {
public static void main(String[] args) {
System.out.println("Hello from Java!");
}
}
EOF
bazel build //:hello
- name: "Test query capabilities"
runs: |
cd java-test
bazel query //...
bazel query 'deps(//:hello)'
- name: "Test clean command"
runs: |
cd java-test
bazel clean --expunge