Skip to content

Commit bb94933

Browse files
authored
Misc cleanups (#216)
- Prepare for BCR release as 0.10.0 - Rename repo name to toolchains_llvm - Upgrade Go version in tests and remove -nopie flag - Combine lint and tests workflow
1 parent 1cf6ea8 commit bb94933

File tree

13 files changed

+92
-65
lines changed

13 files changed

+92
-65
lines changed

.github/workflows/lint.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
name: Tests
22

33
on:
4-
push:
5-
branches: [master]
64
pull_request:
75
branches: [master]
86

7+
concurrency:
8+
group: ${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
911
permissions: read-all
1012

1113
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
checks: write # For trunk to post annotations
18+
contents: read # For repo checkout
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
- name: Trunk Check
23+
uses: trunk-io/trunk-action@v1
1224
test:
1325
strategy:
1426
fail-fast: false
@@ -25,7 +37,7 @@ jobs:
2537
runs-on: ${{ matrix.os }}
2638
steps:
2739
- uses: actions/checkout@v3
28-
- name: test
40+
- name: Test
2941
env:
3042
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
3143
USE_BZLMOD: ${{ matrix.bzlmod }}
@@ -40,7 +52,7 @@ jobs:
4052
runs-on: ${{ matrix.os }}
4153
steps:
4254
- uses: actions/checkout@v3
43-
- name: external_test
55+
- name: Test
4456
env:
4557
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
4658
USE_BZLMOD: ${{ matrix.bzlmod }}
@@ -63,19 +75,19 @@ jobs:
6375
runs-on: ubuntu-latest
6476
steps:
6577
- uses: actions/checkout@v3
66-
- name: test
78+
- name: Test
6779
run: tests/scripts/${{ matrix.script }}_test.sh
6880
xcompile_test:
6981
runs-on: macos-latest
7082
steps:
7183
- uses: actions/checkout@v3
72-
- name: test
84+
- name: Test
7385
run: tests/scripts/run_xcompile_tests.sh
7486
abs_paths_test:
7587
runs-on: ubuntu-latest
7688
steps:
7789
- uses: actions/checkout@v3
78-
- name: test
90+
- name: Test
7991
run: tests/scripts/run_tests.sh -t @llvm_toolchain_with_absolute_paths//:cc-toolchain-x86_64-linux
8092
sys_paths_test:
8193
runs-on: ubuntu-latest
@@ -88,5 +100,5 @@ jobs:
88100
ext: .tar.xz
89101
local_path: /tmp/llvm-15
90102
run: wget --no-verbose "https://github.com/llvm/llvm-project/releases/download/${release}/${archive}${ext}" && tar -xf "${archive}${ext}" && mv "${archive}" "${local_path}"
91-
- name: test
103+
- name: Test
92104
run: tests/scripts/run_tests.sh -t @llvm_toolchain_with_system_llvm//:cc-toolchain-x86_64-linux

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/bazel-*
12
/tests/bazel-*
23
/toolchain/tools/__pycache__
34
/toolchain/tools/host_os_key.pyc

MODULE.bazel

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
1+
# Copyright 2023 The Bazel Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
module(
2-
name = "llvm_toolchain",
3-
version = "0.0.0",
16+
name = "toolchains_llvm",
17+
version = "0.10.0",
418
compatibility_level = 0,
519
)
620

721
bazel_dep(name = "bazel_skylib", version = "1.4.2")
822
bazel_dep(name = "rules_cc", version = "0.0.8")
9-
bazel_dep(name = "platforms", version = "0.0.6")
23+
bazel_dep(name = "platforms", version = "0.0.7")

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ Minimum bazel version: **6.0.0** (6.1.0 if using blzmod)
2424
If you're using `bzlmod`, add the following to `MODULE.bazel`:
2525

2626
```starlark
27-
bazel_dep(name = "llvm_toolchain", version = "0.9")
27+
bazel_dep(name = "toolchains_llvm", version = "0.10.0")
2828

29-
llvm = use_extension("@llvm_toolchain//toolchain/extensions:llvm.bzl", "llvm")
29+
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
3030
llvm.toolchain(
31-
llvm_version = "15.0.6",
31+
llvm_version = "16.0.0",
3232
)
3333

3434
use_repo(llvm, "llvm_toolchain")
@@ -46,25 +46,25 @@ BAZEL_TOOLCHAIN_TAG = "0.9"
4646
BAZEL_TOOLCHAIN_SHA = "95f0bab6982c7e5a83447e08bf32fa7a47f210169da5e5ec62411fef0d8e7f59"
4747

4848
http_archive(
49-
name = "com_grail_bazel_toolchain",
49+
name = "toolchains_llvm",
5050
sha256 = BAZEL_TOOLCHAIN_SHA,
5151
strip_prefix = "bazel-toolchain-{tag}".format(tag = BAZEL_TOOLCHAIN_TAG),
5252
canonical_id = BAZEL_TOOLCHAIN_TAG,
5353
url = "https://github.com/grailbio/bazel-toolchain/archive/refs/tags/{tag}.tar.gz".format(tag = BAZEL_TOOLCHAIN_TAG),
5454
)
5555

56-
load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")
56+
load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")
5757

5858
bazel_toolchain_dependencies()
5959

60-
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
60+
load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")
6161

6262
llvm_toolchain(
6363
name = "llvm_toolchain",
6464
llvm_version = "16.0.0",
6565
)
6666

67-
load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")
67+
load("@toolchains_llvm//:toolchains.bzl", "llvm_register_toolchains")
6868

6969
llvm_register_toolchains()
7070
```
@@ -194,7 +194,7 @@ The following mechanisms are available for using an LLVM toolchain:
194194
attribute. When using a bazel package path, each of the values is typically
195195
a package in the user's workspace or configured through `local_repository` or
196196
`http_archive`; the BUILD file of the package should be similar to
197-
`@com_grail_bazel_toolchain//toolchain:BUILD.llvm_repo`. If using only
197+
`@toolchains_llvm//toolchain:BUILD.llvm_repo`. If using only
198198
`http_archive`, maybe consider using the `urls` attribute instead to get more
199199
flexibility if you need.
200200
4. All the above options rely on host OS information, and are not suited for
@@ -233,7 +233,7 @@ the [test script](tests/scripts/run_xcompile_tests.sh) for cross-compilation.
233233

234234
```sh
235235
bazel build \
236-
--platforms=@com_grail_bazel_toolchain//platforms:linux-x86_64 \
236+
--platforms=@toolchains_llvm//platforms:linux-x86_64 \
237237
--extra_toolchains=@llvm_toolchain_with_sysroot//:cc-toolchain-x86_64-linux \
238238
//...
239239
```

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
# limitations under the License.
1414

1515
workspace(
16-
name = "com_grail_bazel_toolchain",
16+
name = "toolchains_llvm",
1717
)

tests/MODULE.bazel

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1-
module(name = "com_grail_bazel_toolchain_tests")
2-
3-
bazel_dep(name = "llvm_toolchain", version = "0.8.2", repo_name = "com_grail_bazel_toolchain")
1+
# Copyright 2023 The Bazel Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
module(name = "toolchains_llvm_tests")
16+
17+
bazel_dep(name = "toolchains_llvm", version = "0.0.0")
418
local_path_override(
5-
module_name = "llvm_toolchain",
19+
module_name = "toolchains_llvm",
620
path = "..",
721
)
822

923
bazel_dep(name = "bazel_skylib", version = "1.4.2")
10-
bazel_dep(name = "platforms", version = "0.0.6")
24+
bazel_dep(name = "platforms", version = "0.0.7")
1125
bazel_dep(name = "rules_cc", version = "0.0.8")
1226
bazel_dep(name = "rules_go", version = "0.41.0", repo_name = "io_bazel_rules_go")
1327
bazel_dep(name = "rules_foreign_cc", version = "0.9.0")
@@ -38,6 +52,15 @@ git_override(
3852
remote = "https://github.com/bazelbuild/rules_rust.git",
3953
)
4054

55+
go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
56+
go_sdk.download(
57+
name = "go_sdk",
58+
version = "1.21.0",
59+
)
60+
use_repo(go_sdk, "go_toolchains")
61+
62+
register_toolchains("@go_toolchains//:all")
63+
4164
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
4265
rust.toolchain(edition = "2021")
4366
use_repo(
@@ -47,7 +70,7 @@ use_repo(
4770

4871
register_toolchains("@rust_toolchains//:all")
4972

50-
llvm = use_extension("@com_grail_bazel_toolchain//toolchain/extensions:llvm.bzl", "llvm")
73+
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
5174

5275
# When updating this version, also update the versions associated with
5376
# llvm_toolchain below, sys_paths_test in the workflows file, and xcompile_test

tests/WORKSPACE

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
workspace(name = "com_grail_bazel_toolchain_tests")
15+
workspace(name = "toolchains_llvm_tests")
1616

1717
local_repository(
18-
name = "com_grail_bazel_toolchain",
18+
name = "toolchains_llvm",
1919
path = "..",
2020
)
2121

2222
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
23-
load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")
23+
load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")
2424

2525
bazel_toolchain_dependencies()
2626

27-
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
27+
load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")
2828

2929
# When updating this version, also update the versions associated with
3030
# llvm_toolchain below, sys_paths_test in the workflows file, and xcompile_test
@@ -186,11 +186,14 @@ http_archive(
186186
],
187187
)
188188

189-
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
189+
load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_rules_dependencies")
190190

191191
go_rules_dependencies()
192192

193-
go_register_toolchains(version = "1.20.5")
193+
go_download_sdk(
194+
name = "go_sdk",
195+
version = "1.21.0",
196+
)
194197

195198
# For testing rules_rust.
196199

tests/WORKSPACE.bzlmod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
workspace(name = "com_grail_bazel_toolchain_tests")
1+
workspace(name = "toolchains_llvm_tests")
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44

tests/openssl/openssl.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ CONF_FILES = [
5050

5151
genrule(
5252
name = "configure",
53-
srcs = [("@com_grail_bazel_toolchain//tests/openssl:" + f) for f in CONF_FILES],
53+
srcs = [("@toolchains_llvm_tests//openssl:" + f) for f in CONF_FILES],
5454
outs = CONF_FILES,
5555
cmd = "\n".join([
56-
"cp $(location @com_grail_bazel_toolchain//tests/openssl:{0}) $(location {0})".format(f)
56+
"cp $(location @toolchains_llvm_tests//openssl:{0}) $(location {0})".format(f)
5757
for f in CONF_FILES
5858
]),
5959
visibility = ["//visibility:private"],

0 commit comments

Comments
 (0)