-
Notifications
You must be signed in to change notification settings - Fork 17
176 lines (170 loc) · 6.78 KB
/
_bazel.yml
File metadata and controls
176 lines (170 loc) · 6.78 KB
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
168
169
170
171
172
173
174
175
176
name: _bazel
on:
workflow_call:
inputs:
action:
description: Bazel action (build or test)
required: true
type: string
artifacts:
description: Artifacts to upload
required: false
type: string
bazel-args:
description: Bazel args
default:
type: string
bazel-mode:
description: Bazel mode (workspace or bzlmod)
required: true
type: string
bazel-path:
description: Path to bazel workspace
default: .
type: string
targets:
description: Bazel targets
required: true
type: string
upload:
description: Upload CI artifacts
type: boolean
default: false
permissions:
contents: read
jobs:
bazel:
runs-on: ubuntu-24.04
name: Bazel (${{ inputs.action }})
steps:
- uses: envoyproxy/toolshed/actions/bind-mounts@5e0c5734ee7fc8a30629bd3f54fc910f92285bbe
with:
mounts: |
- src: /mnt/workspace
target: ${{ github.workspace }}
chown: "runner:runner"
- src: /mnt/cache
target: /home/runner/.cache
chown: "runner:runner"
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Bazel
uses: bazelbuild/setup-bazelisk@b39c379c82683a5f25d34f0d062761f62693e0b2 # v3
- name: Install libtinfo5
run: |
# Workaround for https://github.com/llvm/llvm-project/issues/75490
curl -LO "http://archive.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb"
sudo dpkg -i "libtinfo5_6.3-2ubuntu0.1_amd64.deb"
rm "libtinfo5_6.3-2ubuntu0.1_amd64.deb"
sudo apt-get -qq update
sudo apt-get -qq install -y --no-install-recommends \
debian-archive-keyring debootstrap qemu-user-static binfmt-support
- name: Bazel targets (${{ inputs.action }}/${{ inputs.bazel-mode }})
run: |
exec bazel ${{ inputs.action }} ${{ inputs.bazel-args }} ${{ inputs.targets }}
working-directory: ${{ inputs.bazel-path }}
- name: Create source tarball
id: source-tarball
if: >-
inputs.action == 'build'
&& inputs.bazel-path == 'bazel'
&& inputs.upload
uses: envoyproxy/toolshed/actions/source@5e0c5734ee7fc8a30629bd3f54fc910f92285bbe
with:
output-name: toolshed-bazel-v{version}.tar.gz
source-path: bazel/
transform: s,^bazel,toolshed-bazel-v{version},
version-file: bazel/VERSION.txt
- name: Bazel source
if: ${{ steps.source-tarball.outputs.tarball }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: bazel-source
path: ${{ steps.source-tarball.outputs.tarball }}
retention-days: 30
- name: Bazel artifact paths
id: artifact-paths
if: >-
inputs.action == 'build'
&& inputs.artifacts
&& inputs.upload
uses: envoyproxy/toolshed/actions/jq@5e0c5734ee7fc8a30629bd3f54fc910f92285bbe
with:
input: ${{ inputs.artifacts }}
input-format: text
options: -Rr
filter: |
select(length > 0)
| "${{ inputs.bazel-path }}/bazel-bin/\(.)"
- name: Bazel artifacts
if: ${{ inputs.upload && (steps.artifact-paths.outputs.value || steps.source-tarball.outputs.tarball) }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: bazel-artifacts
path: |
${{ steps.artifact-paths.outputs.value }}
retention-days: 30
xcompile-x86-to-arm:
if: inputs.action == 'test'
runs-on: ubuntu-24.04
name: Bazel (x-compile x86 -> arm)
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Bazel
uses: bazelbuild/setup-bazelisk@b39c379c82683a5f25d34f0d062761f62693e0b2 # v3
- name: Install libtinfo5
run: |
# Workaround for https://github.com/llvm/llvm-project/issues/75490
curl -LO "http://archive.ubuntu.com/ubuntu/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_amd64.deb"
sudo dpkg -i "libtinfo5_6.3-2ubuntu0.1_amd64.deb"
rm "libtinfo5_6.3-2ubuntu0.1_amd64.deb"
sudo apt-get -qq update
sudo apt-get -qq install -y --no-install-recommends \
debian-archive-keyring debootstrap qemu-user-static binfmt-support
- name: Cross-compile test (x86_64 -> aarch64/${{ inputs.bazel-mode }})
run: |
exec bazel test ${{ inputs.bazel-args }} \
--platforms=@toolchains_llvm//platforms:linux-aarch64 \
//compile/test:cross_compile_aarch64_test \
//compile/test:cross_compile_aarch64_unwind_test
working-directory: ${{ inputs.bazel-path }}
- name: Cross-compile test (x86_64 -> aarch64/${{ inputs.bazel-mode }})
run: |
exec bazel test ${{ inputs.bazel-args }} \
--platforms=@toolchains_llvm//platforms:linux-aarch64 \
--@toolchains_llvm//toolchain/config:libunwind=False \
//compile/test:cross_compile_aarch64_no_unwind_test
working-directory: ${{ inputs.bazel-path }}
xcompile-arm-to-x86:
if: inputs.action == 'test'
runs-on: ubuntu-24.04-arm
name: Bazel (x-compile arm -> x86)
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Bazel
uses: bazelbuild/setup-bazelisk@b39c379c82683a5f25d34f0d062761f62693e0b2 # v3
- name: Install libtinfo5
run: |
# Workaround for https://github.com/llvm/llvm-project/issues/75490
curl -LO "http://ports.ubuntu.com/ubuntu-ports/pool/universe/n/ncurses/libtinfo5_6.3-2ubuntu0.1_arm64.deb"
sudo dpkg -i "libtinfo5_6.3-2ubuntu0.1_arm64.deb"
rm "libtinfo5_6.3-2ubuntu0.1_arm64.deb"
sudo apt-get -qq update
sudo apt-get -qq install -y --no-install-recommends \
debian-archive-keyring debootstrap qemu-user-static binfmt-support
- name: Cross-compile test (aarch64 -> x86_64/${{ inputs.bazel-mode }})
run: |
exec bazel test ${{ inputs.bazel-args }} \
--platforms=@toolchains_llvm//platforms:linux-x86_64 \
//compile/test:cross_compile_x86_64_test \
//compile/test:cross_compile_x86_64_unwind_test
working-directory: ${{ inputs.bazel-path }}
- name: Cross-compile test (x86_64 -> x86_64/${{ inputs.bazel-mode }})
run: |
exec bazel test ${{ inputs.bazel-args }} \
--platforms=@toolchains_llvm//platforms:linux-x86_64 \
--@toolchains_llvm//toolchain/config:libunwind=False \
//compile/test:cross_compile_x86_64_no_unwind_test
working-directory: ${{ inputs.bazel-path }}