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
This commit is contained in:
parent
1cf6ea867f
commit
bb94933b62
|
@ -1,25 +0,0 @@
|
|||
name: Pull Request
|
||||
on: [pull_request]
|
||||
concurrency:
|
||||
group: ${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
# NOTE: This current setup does not post annotations to PRs.
|
||||
# https://github.com/marketplace/actions/trunk-check#getting-inline-annotations-for-fork-prs
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
trunk_check:
|
||||
name: Trunk Check Runner
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
checks: write # For trunk to post annotations
|
||||
contents: read # For repo checkout
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Trunk Check
|
||||
uses: trunk-io/trunk-action@v1
|
|
@ -1,14 +1,26 @@
|
|||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.head_ref || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
checks: write # For trunk to post annotations
|
||||
contents: read # For repo checkout
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Trunk Check
|
||||
uses: trunk-io/trunk-action@v1
|
||||
test:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -25,7 +37,7 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: test
|
||||
- name: Test
|
||||
env:
|
||||
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
|
||||
USE_BZLMOD: ${{ matrix.bzlmod }}
|
||||
|
@ -40,7 +52,7 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: external_test
|
||||
- name: Test
|
||||
env:
|
||||
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
|
||||
USE_BZLMOD: ${{ matrix.bzlmod }}
|
||||
|
@ -63,19 +75,19 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: test
|
||||
- name: Test
|
||||
run: tests/scripts/${{ matrix.script }}_test.sh
|
||||
xcompile_test:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: test
|
||||
- name: Test
|
||||
run: tests/scripts/run_xcompile_tests.sh
|
||||
abs_paths_test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: test
|
||||
- name: Test
|
||||
run: tests/scripts/run_tests.sh -t @llvm_toolchain_with_absolute_paths//:cc-toolchain-x86_64-linux
|
||||
sys_paths_test:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -88,5 +100,5 @@ jobs:
|
|||
ext: .tar.xz
|
||||
local_path: /tmp/llvm-15
|
||||
run: wget --no-verbose "https://github.com/llvm/llvm-project/releases/download/${release}/${archive}${ext}" && tar -xf "${archive}${ext}" && mv "${archive}" "${local_path}"
|
||||
- name: test
|
||||
- name: Test
|
||||
run: tests/scripts/run_tests.sh -t @llvm_toolchain_with_system_llvm//:cc-toolchain-x86_64-linux
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/bazel-*
|
||||
/tests/bazel-*
|
||||
/toolchain/tools/__pycache__
|
||||
/toolchain/tools/host_os_key.pyc
|
||||
|
|
20
MODULE.bazel
20
MODULE.bazel
|
@ -1,9 +1,23 @@
|
|||
# Copyright 2023 The Bazel Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
module(
|
||||
name = "llvm_toolchain",
|
||||
version = "0.0.0",
|
||||
name = "toolchains_llvm",
|
||||
version = "0.10.0",
|
||||
compatibility_level = 0,
|
||||
)
|
||||
|
||||
bazel_dep(name = "bazel_skylib", version = "1.4.2")
|
||||
bazel_dep(name = "rules_cc", version = "0.0.8")
|
||||
bazel_dep(name = "platforms", version = "0.0.6")
|
||||
bazel_dep(name = "platforms", version = "0.0.7")
|
||||
|
|
18
README.md
18
README.md
|
@ -24,11 +24,11 @@ Minimum bazel version: **6.0.0** (6.1.0 if using blzmod)
|
|||
If you're using `bzlmod`, add the following to `MODULE.bazel`:
|
||||
|
||||
```starlark
|
||||
bazel_dep(name = "llvm_toolchain", version = "0.9")
|
||||
bazel_dep(name = "toolchains_llvm", version = "0.10.0")
|
||||
|
||||
llvm = use_extension("@llvm_toolchain//toolchain/extensions:llvm.bzl", "llvm")
|
||||
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
|
||||
llvm.toolchain(
|
||||
llvm_version = "15.0.6",
|
||||
llvm_version = "16.0.0",
|
||||
)
|
||||
|
||||
use_repo(llvm, "llvm_toolchain")
|
||||
|
@ -46,25 +46,25 @@ BAZEL_TOOLCHAIN_TAG = "0.9"
|
|||
BAZEL_TOOLCHAIN_SHA = "95f0bab6982c7e5a83447e08bf32fa7a47f210169da5e5ec62411fef0d8e7f59"
|
||||
|
||||
http_archive(
|
||||
name = "com_grail_bazel_toolchain",
|
||||
name = "toolchains_llvm",
|
||||
sha256 = BAZEL_TOOLCHAIN_SHA,
|
||||
strip_prefix = "bazel-toolchain-{tag}".format(tag = BAZEL_TOOLCHAIN_TAG),
|
||||
canonical_id = BAZEL_TOOLCHAIN_TAG,
|
||||
url = "https://github.com/grailbio/bazel-toolchain/archive/refs/tags/{tag}.tar.gz".format(tag = BAZEL_TOOLCHAIN_TAG),
|
||||
)
|
||||
|
||||
load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")
|
||||
load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")
|
||||
|
||||
bazel_toolchain_dependencies()
|
||||
|
||||
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
|
||||
load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")
|
||||
|
||||
llvm_toolchain(
|
||||
name = "llvm_toolchain",
|
||||
llvm_version = "16.0.0",
|
||||
)
|
||||
|
||||
load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")
|
||||
load("@toolchains_llvm//:toolchains.bzl", "llvm_register_toolchains")
|
||||
|
||||
llvm_register_toolchains()
|
||||
```
|
||||
|
@ -194,7 +194,7 @@ The following mechanisms are available for using an LLVM toolchain:
|
|||
attribute. When using a bazel package path, each of the values is typically
|
||||
a package in the user's workspace or configured through `local_repository` or
|
||||
`http_archive`; the BUILD file of the package should be similar to
|
||||
`@com_grail_bazel_toolchain//toolchain:BUILD.llvm_repo`. If using only
|
||||
`@toolchains_llvm//toolchain:BUILD.llvm_repo`. If using only
|
||||
`http_archive`, maybe consider using the `urls` attribute instead to get more
|
||||
flexibility if you need.
|
||||
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.
|
|||
|
||||
```sh
|
||||
bazel build \
|
||||
--platforms=@com_grail_bazel_toolchain//platforms:linux-x86_64 \
|
||||
--platforms=@toolchains_llvm//platforms:linux-x86_64 \
|
||||
--extra_toolchains=@llvm_toolchain_with_sysroot//:cc-toolchain-x86_64-linux \
|
||||
//...
|
||||
```
|
||||
|
|
|
@ -13,5 +13,5 @@
|
|||
# limitations under the License.
|
||||
|
||||
workspace(
|
||||
name = "com_grail_bazel_toolchain",
|
||||
name = "toolchains_llvm",
|
||||
)
|
||||
|
|
|
@ -1,13 +1,27 @@
|
|||
module(name = "com_grail_bazel_toolchain_tests")
|
||||
# Copyright 2023 The Bazel Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
bazel_dep(name = "llvm_toolchain", version = "0.8.2", repo_name = "com_grail_bazel_toolchain")
|
||||
module(name = "toolchains_llvm_tests")
|
||||
|
||||
bazel_dep(name = "toolchains_llvm", version = "0.0.0")
|
||||
local_path_override(
|
||||
module_name = "llvm_toolchain",
|
||||
module_name = "toolchains_llvm",
|
||||
path = "..",
|
||||
)
|
||||
|
||||
bazel_dep(name = "bazel_skylib", version = "1.4.2")
|
||||
bazel_dep(name = "platforms", version = "0.0.6")
|
||||
bazel_dep(name = "platforms", version = "0.0.7")
|
||||
bazel_dep(name = "rules_cc", version = "0.0.8")
|
||||
bazel_dep(name = "rules_go", version = "0.41.0", repo_name = "io_bazel_rules_go")
|
||||
bazel_dep(name = "rules_foreign_cc", version = "0.9.0")
|
||||
|
@ -38,6 +52,15 @@ git_override(
|
|||
remote = "https://github.com/bazelbuild/rules_rust.git",
|
||||
)
|
||||
|
||||
go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
|
||||
go_sdk.download(
|
||||
name = "go_sdk",
|
||||
version = "1.21.0",
|
||||
)
|
||||
use_repo(go_sdk, "go_toolchains")
|
||||
|
||||
register_toolchains("@go_toolchains//:all")
|
||||
|
||||
rust = use_extension("@rules_rust//rust:extensions.bzl", "rust")
|
||||
rust.toolchain(edition = "2021")
|
||||
use_repo(
|
||||
|
@ -47,7 +70,7 @@ use_repo(
|
|||
|
||||
register_toolchains("@rust_toolchains//:all")
|
||||
|
||||
llvm = use_extension("@com_grail_bazel_toolchain//toolchain/extensions:llvm.bzl", "llvm")
|
||||
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
|
||||
|
||||
# When updating this version, also update the versions associated with
|
||||
# llvm_toolchain below, sys_paths_test in the workflows file, and xcompile_test
|
||||
|
|
|
@ -12,19 +12,19 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
workspace(name = "com_grail_bazel_toolchain_tests")
|
||||
workspace(name = "toolchains_llvm_tests")
|
||||
|
||||
local_repository(
|
||||
name = "com_grail_bazel_toolchain",
|
||||
name = "toolchains_llvm",
|
||||
path = "..",
|
||||
)
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")
|
||||
load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")
|
||||
|
||||
bazel_toolchain_dependencies()
|
||||
|
||||
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
|
||||
load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")
|
||||
|
||||
# When updating this version, also update the versions associated with
|
||||
# llvm_toolchain below, sys_paths_test in the workflows file, and xcompile_test
|
||||
|
@ -186,11 +186,14 @@ http_archive(
|
|||
],
|
||||
)
|
||||
|
||||
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
|
||||
load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_rules_dependencies")
|
||||
|
||||
go_rules_dependencies()
|
||||
|
||||
go_register_toolchains(version = "1.20.5")
|
||||
go_download_sdk(
|
||||
name = "go_sdk",
|
||||
version = "1.21.0",
|
||||
)
|
||||
|
||||
# For testing rules_rust.
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
workspace(name = "com_grail_bazel_toolchain_tests")
|
||||
workspace(name = "toolchains_llvm_tests")
|
||||
|
||||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
||||
|
||||
|
|
|
@ -50,10 +50,10 @@ CONF_FILES = [
|
|||
|
||||
genrule(
|
||||
name = "configure",
|
||||
srcs = [("@com_grail_bazel_toolchain//tests/openssl:" + f) for f in CONF_FILES],
|
||||
srcs = [("@toolchains_llvm_tests//openssl:" + f) for f in CONF_FILES],
|
||||
outs = CONF_FILES,
|
||||
cmd = "\n".join([
|
||||
"cp $(location @com_grail_bazel_toolchain//tests/openssl:{0}) $(location {0})".format(f)
|
||||
"cp $(location @toolchains_llvm_tests//openssl:{0}) $(location {0})".format(f)
|
||||
for f in CONF_FILES
|
||||
]),
|
||||
visibility = ["//visibility:private"],
|
||||
|
|
|
@ -31,7 +31,6 @@ fi
|
|||
|
||||
test_args=(
|
||||
"${common_test_args[@]}"
|
||||
"--linkopt=-nopie" # Not needed after https://github.com/bazelbuild/rules_go/pull/3692.
|
||||
"--copt=-Wno-deprecated-builtins" # https://github.com/abseil/abseil-cpp/issues/1201
|
||||
)
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ echo ""
|
|||
echo "Testing static linked user libraries and dynamic linked system libraries"
|
||||
build_args=(
|
||||
--incompatible_enable_cc_toolchain_resolution
|
||||
--platforms=@com_grail_bazel_toolchain//platforms:linux-x86_64
|
||||
--platforms=@toolchains_llvm//platforms:linux-x86_64
|
||||
--extra_toolchains=@llvm_toolchain_with_sysroot//:cc-toolchain-x86_64-linux
|
||||
--symlink_prefix=/
|
||||
--color=yes
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""LLVM extension for use with bzlmod"""
|
||||
|
||||
load("@llvm_toolchain//toolchain:rules.bzl", "llvm_toolchain")
|
||||
load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")
|
||||
load(
|
||||
"@llvm_toolchain//toolchain/internal:repo.bzl",
|
||||
"@toolchains_llvm//toolchain/internal:repo.bzl",
|
||||
_llvm_config_attrs = "llvm_config_attrs",
|
||||
_llvm_repo_attrs = "llvm_repo_attrs",
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue