Skip to content

Commit b812e77

Browse files
authored
Implement small world integration test project (#177)
Implement a small world project, which shows (and tests) the basic use of some `rules_swiftnav` repos and tests the coverage with the clang toolchains. It contains some basic libs, which follow the old/legacy "cmake" folder structure and the modern Bazel folder structure.
1 parent 73b468f commit b812e77

28 files changed

+1544
-272
lines changed

.bazeliskrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
USE_BAZEL_VERSION=7.6.1
1+
USE_BAZEL_VERSION=8.3.1

.github/workflows/ci.yaml

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,45 @@ on:
77
- 'main'
88

99
jobs:
10-
1110
check-formatting:
1211
runs-on: ubuntu-latest
1312
steps:
14-
- name: Set up credentials
15-
uses: aws-actions/configure-aws-credentials@v1
13+
- name: Checkout source
14+
uses: actions/checkout@v5
15+
16+
- uses: bazel-contrib/[email protected]
17+
18+
- name: Mount bazel cache
19+
uses: actions/cache@v4
1620
with:
17-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
18-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
19-
aws-region: us-west-2
21+
path: "~/.cache/bazel"
22+
key: bazel
2023

21-
- name: Set up cache
24+
- name: Run format
2225
run: |
23-
npm install -g bazels3cache
24-
bazels3cache --bucket=${{ secrets.BAZEL_BUCKET }}
26+
bazel run //:buildifier
27+
git diff --exit-code
2528
29+
example-small-world:
30+
runs-on: ubuntu-latest
31+
steps:
2632
- name: Checkout source
27-
uses: actions/checkout@v2
33+
uses: actions/checkout@v5
34+
35+
- uses: bazel-contrib/[email protected]
36+
37+
- name: Mount bazel cache
38+
uses: actions/cache@v4
39+
with:
40+
path: "~/.cache/bazel"
41+
key: bazel-example-small-world
42+
43+
- name: Build and generate coverage
44+
run: |
45+
cd examples/small_world
46+
./scripts/generate_coverage.sh
2847
2948
- name: Run format
3049
run: |
31-
bazel run --remote_cache=http://localhost:7777 //:buildifier
50+
bazel run //:buildifier
3251
git diff --exit-code

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/bazel-*
1+
bazel-*

MODULE.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ module(
1515
)
1616

1717
# Core Bazel dependencies
18-
bazel_dep(name = "bazel_skylib", version = "1.4.1")
19-
bazel_dep(name = "platforms", version = "0.0.6")
20-
bazel_dep(name = "rules_cc", version = "0.0.9")
21-
bazel_dep(name = "rules_pkg", version = "0.9.1")
18+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
19+
bazel_dep(name = "platforms", version = "0.0.11")
20+
bazel_dep(name = "rules_cc", version = "0.1.1")
21+
bazel_dep(name = "rules_pkg", version = "1.0.1")
2222
bazel_dep(name = "rules_oci", version = "1.0.0")
2323

2424
# Register module extensions

MODULE.bazel.lock

Lines changed: 271 additions & 254 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cc/repositories.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def swift_cc_toolchain_llvm20():
102102
build_file = Label("@rules_swiftnav//cc/toolchains/llvm20:llvm.BUILD.bzl"),
103103
url = AARCH64_DARWIN_LLVM20,
104104
strip_prefix = "LLVM-20.1.7-macOS-ARM64",
105-
# TODO: Add sha256 hash for integrity
105+
sha256 = "6aa75de00575ad0663183b00f00f39992ded611b5136e57649ace1e6a53c0d16",
106106
)
107107

108108
maybe(

cc/toolchains/llvm20/llvm.BUILD.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ filegroup(
6666
"lib/libclang*.a",
6767
"lib/liblld*.a",
6868
],
69+
allow_empty = True,
6970
),
7071
# Do not include the .dylib files in the linker sandbox because they will
7172
# not be available at runtime. Any library linked from the toolchain should

examples/small_world/.bazeliskrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
USE_BASEL_VERSION=8.3.1

examples/small_world/.bazelrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
common --@rules_swiftnav//cc:enable_bzlmod=true
2+
3+
coverage --experimental_generate_llvm_lcov
4+
coverage --combined_report=lcov
5+
6+
# Work around for Mac: https://github.com/bazelbuild/bazel/issues/14970.
7+
# bazel coverage --config=cov_mac //...
8+
build:cov_mac --repo_env=GCOV=/Library/Developer/CommandLineTools/usr/bin/llvm-profdata
9+
build:cov_mac --test_env=LLVM_COV=/Library/Developer/CommandLineTools/usr/bin/llvm-cov
10+
build:cov_mac --copt=-ffile-compilation-dir=.

examples/small_world/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
cov.dat
2+
cov_html/

0 commit comments

Comments
 (0)