From 6d65cb6f8403679fa5368792bc94fe34675efddd Mon Sep 17 00:00:00 2001 From: Sombrio Date: Thu, 25 Sep 2025 08:26:51 +0000 Subject: [PATCH 1/2] Fix(bazel) Correct Bazel lint errors in BUILD file Signed-off-by: Sombrio --- BUILD | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BUILD b/BUILD index a3bfa0b1..25dfe2b3 100644 --- a/BUILD +++ b/BUILD @@ -1,6 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2025, The OpenROAD Authors +load("@rules_cc//cc:cc_binary.bzl", "cc_binary") +load("@rules_cc//cc:cc_library.bzl", "cc_library") load("@rules_hdl//dependency_support/com_github_westes_flex:flex.bzl", "genlex") load("@rules_hdl//dependency_support/org_gnu_bison:bison.bzl", "genyacc") load("//bazel:tcl_encode_sta.bzl", "tcl_encode_sta") @@ -302,7 +304,6 @@ cc_library( name = "opensta_lib", srcs = parser_cc + parser_headers + glob( include = [ - "app/StaMain.cc", "dcalc/*.cc", "dcalc/*.hh", "graph/*.cc", @@ -333,6 +334,7 @@ cc_library( "util/Machine*.cc", ], ) + [ + "app/StaMain.cc", "util/Machine.cc", ":StaConfig", ], From 52e7223eb4f5edb28ace13012ef5ec34d29825f2 Mon Sep 17 00:00:00 2001 From: Sombrio Date: Thu, 25 Sep 2025 08:36:31 +0000 Subject: [PATCH 2/2] Improve(bazel) Add buildifier lint and format github actions Signed-off-by: Sombrio --- .github/workflows/buildifier.yaml | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/buildifier.yaml diff --git a/.github/workflows/buildifier.yaml b/.github/workflows/buildifier.yaml new file mode 100644 index 00000000..c874a0f2 --- /dev/null +++ b/.github/workflows/buildifier.yaml @@ -0,0 +1,44 @@ +name: Lint Bazel + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + buildifier: + runs-on: 'ubuntu-latest' + strategy: + fail-fast: false + matrix: + check: + - name: Run buildifier format + run: ./buildifier -r -mode=check -lint=off . + - name: Run buildifier lint + run: ./buildifier -r -lint=warn . + name: ${{ matrix.check.name }} + env: + BUILDIFIER_VERSION: v8.2.1 + + steps: + - name: Checkout Code + uses: actions/checkout@v5 + + - name: Cache buildifier + id: cache-buildifier + uses: actions/cache@v4 + with: + path: ./buildifier + key: ${{ runner.os }}-buildifier-${{ env.BUILDIFIER_VERSION }} + + - name: Download buildifier + if: steps.cache-buildifier.outputs.cache-hit != 'true' + run: | + wget https://github.com/bazelbuild/buildtools/releases/download/${BUILDIFIER_VERSION}/buildifier-linux-amd64 -O buildifier + chmod +x buildifier + + - name: ${{ matrix.check.name }} + run: ${{ matrix.check.run }}