Skip to content

Commit

Permalink
add bazel config file
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Sep 11, 2024
1 parent 6188942 commit 8a88493
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Bazel files check

permissions: read-all

on:
push:
branches:
- master
paths:
- '*.bazel'
- '*.bzl'
pull_request:
paths:
- '*.bazel'
- '*.bzl'

jobs:
check:
name: Validate formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup buildifier
uses: jbajic/setup-buildifier@v1
with:
buildifier-version: '7.3.1'

- name: Run buildifier
run: |
buildifier -mode check -r .
16 changes: 16 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Bazel support is added to enable projects that use Bazel to easily
# access the test suite, and file groups without having the need to float
# a patch on top of WPT.
#
# In order to iterate over the files inside a subfolder of WPT, we expose
# the globs in the `tests.bzl` file.
#
# In order to format and lint a bazel file, you can use the following command:
# > buildifier -mode=check BUILD.bazel tests.bzl
load("//:tests.bzl", "directories")

[filegroup(
name = dir,
srcs = glob(["{}/**/*".format(dir)]),
visibility = ["//visibility:public"],
) for dir in directories]
7 changes: 7 additions & 0 deletions tests.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This excludes all folders that start with `.` annotation to remove folders like `.github`
directories = glob(["*"], exclude_directories = 0, exclude = glob(["*", ".*"], exclude_directories = 1))

TEST_GROUPS = {
name: glob([name + "/**/*"])
for name in directories
}

0 comments on commit 8a88493

Please sign in to comment.