Skip to content

Commit af6c624

Browse files
committed
Add services and tools requesed by module devs
Based on feedback received from module developers, we are adding additional tools and checks which should be part of default setup.
1 parent 185cf85 commit af6c624

File tree

7 files changed

+113
-18
lines changed

7 files changed

+113
-18
lines changed

.bazelrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
114
build --java_language_version=17
215
build --tool_java_language_version=17
316
build --java_runtime_version=remotejdk_17

.github/actions/deploy-versioned-pages/action.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ inputs:
2828
create_comment:
2929
description: "Create a comment on the PR with the URL to the documentation" # in case of PR
3030
default: "true"
31-
3231
outputs:
3332
target_folder:
3433
description: "The target folder for the documentation"
3534
value: ${{ steps.calc.outputs.target_folder }}
36-
3735
runs:
3836
using: "composite"
3937
steps:
@@ -47,7 +45,6 @@ runs:
4745
target_folder="${{github.ref_name}}"
4846
fi
4947
echo "target_folder=$target_folder" >> $GITHUB_OUTPUT
50-
5148
- name: Prepare the deploy folder
5249
shell: bash
5350
run: |
@@ -93,21 +90,18 @@ runs:
9390
ls -al deploy_root
9491
ls -al version_root
9592
cat version_root/"${{ inputs.versions_file }}"
96-
9793
- name: Deploy Documentation
9894
uses: JamesIves/github-pages-deploy-action@v4
9995
with:
10096
folder: deploy_root
10197
target-folder: ${{ steps.calc.outputs.target_folder }}
10298
clean: true
10399
clean-exclude: .nojekyll
104-
105100
- name: Deploy version file 🚀
106101
uses: JamesIves/github-pages-deploy-action@v4
107102
with:
108103
folder: version_root
109104
clean: false
110-
111105
- name: Find Comment
112106
if: ${{ github.event_name == 'pull_request_target' }}
113107
uses: peter-evans/find-comment@v3
@@ -116,7 +110,6 @@ runs:
116110
issue-number: ${{ github.event.pull_request.number }}
117111
comment-author: 'github-actions[bot]'
118112
body-includes: The created documentation from the pull request
119-
120113
- name: Comment on PR with docs URL
121114
if: ${{ github.event_name == 'pull_request_target' && inputs.create_comment == 'true' && steps.fc.outputs.comment-id == '' }}
122115
uses: peter-evans/create-or-update-comment@v4

.github/workflows/build_and_test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
14+
# Workflow configuration for `Bazel Build & Test`
15+
# This workflow runs Bazel build and test when triggered by specific pull request events.
16+
17+
name: Bazel Build & Test baselibs
18+
on:
19+
pull_request:
20+
types: [opened, reopened, synchronize]
21+
merge_group:
22+
types: [checks_requested]
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/[email protected]
29+
- name: Setup Bazel
30+
uses: bazel-contrib/[email protected]
31+
# TODO: Uncomment this part once the code is ready for build
32+
# and define the target for it.
33+
# - name: Bazel build module target(s)
34+
# run: |
35+
# bazel build <targets>
36+
test:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/[email protected]
41+
- name: Setup Bazel
42+
uses: bazel-contrib/[email protected]
43+
# TODO: Uncomment this part once the code is ready for test
44+
# and define the targets for it.
45+
# - name: Bazel test module target(s)
46+
# run: |
47+
# bazel test <targets>

.github/workflows/docs-cleanup.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ on:
1616
schedule:
1717
- cron: "0 0 * * *" # Runs every day at midnight UTC
1818
workflow_dispatch: # Allows manual trigger
19-
2019
jobs:
2120
docs-cleanup:
2221
name: Cleanup old documentation
@@ -31,7 +30,6 @@ jobs:
3130
repository: ${{ github.repository }}
3231
ref: gh-pages
3332
fetch-depth: 0
34-
3533
- name: Cleanup old documentation
3634
env:
3735
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -74,7 +72,6 @@ jobs:
7472
7573
# Clean up temp files
7674
rm versions_tmp.json versions_tmp_clean.json
77-
7875
- name: Commit and Push Changes
7976
uses: JamesIves/github-pages-deploy-action@v4
8077
with:

.github/workflows/docs.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ on:
2020
- main # docs are built only on push to main branch, for feature branches there are PR builds
2121
merge_group:
2222
types: [checks_requested]
23-
2423
jobs:
2524
docs-build:
2625
name: Build documentation
@@ -70,7 +69,6 @@ jobs:
7069
path: github-pages.tar
7170
retention-days: 1
7271
if-no-files-found: error
73-
7472
docs-deploy:
7573
name: Deploy documentation to GitHub Pages
7674
permissions:
@@ -88,7 +86,6 @@ jobs:
8886
# ------------------------------------------------------------------------------
8987
- name: Checkout repository
9088
uses: actions/[email protected]
91-
9289
- name: Download documentation artifact
9390
uses: actions/[email protected]
9491
# ------------------------------------------------------------------------------
@@ -102,10 +99,8 @@ jobs:
10299
# ------------------------------------------------------------------------------
103100
with:
104101
name: github-pages-${{ github.event.pull_request.head.sha || github.sha }}
105-
106102
- name: Untar documentation artifact
107103
run: mkdir -p extracted_docs && tar -xf github-pages.tar -C extracted_docs
108-
109104
- name: Deploy 🚀
110105
id: pages-deployment
111106
uses: ./.github/actions/deploy-versioned-pages

BUILD

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,43 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13+
load("@aspect_rules_lint//format:defs.bzl", "format_multirun", "format_test")
1314
load("@score_cr_checker//:cr_checker.bzl", "copyright_checker")
1415

1516
copyright_checker(
1617
name = "copyright",
1718
srcs = [
19+
# TODO: Add all files/directories in `srcs` attribute that needs to be checked.
20+
".github/workflows",
21+
"docs",
1822
"src",
1923
"tests",
2024
"//:BUILD",
2125
"//:MODULE.bazel",
2226
],
23-
template = "@score_cr_checker//resources:templates",
2427
config = "@score_cr_checker//resources:config",
28+
template = "@score_cr_checker//resources:templates",
2529
visibility = ["//visibility:public"],
2630
)
31+
32+
format_multirun(
33+
name = "format.fix",
34+
python = "@aspect_rules_lint//format:ruff",
35+
starlark = "@buildifier_prebuilt//:buildifier",
36+
visibility = [
37+
"//visibility:public",
38+
],
39+
yaml = "@aspect_rules_lint//format:yamlfmt",
40+
)
41+
42+
format_test(
43+
name = "format.check",
44+
no_sandbox = True,
45+
python = "@aspect_rules_lint//format:ruff",
46+
starlark = "@buildifier_prebuilt//:buildifier",
47+
visibility = [
48+
"//visibility:public",
49+
],
50+
workspace = "//:MODULE.bazel",
51+
yaml = "@aspect_rules_lint//format:yamlfmt",
52+
)

MODULE.bazel

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,28 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13-
module(name = "cpp_rust_template_repository", version = "1.0")
13+
14+
# Module definition
15+
# NOTE: The name of new module must start with `score-`
16+
module(
17+
name = "score-cpp_rust_template_repository",
18+
version = "1.0",
19+
compatibility_level = 0,
20+
)
21+
22+
# Python rules and interpreter dependency
23+
bazel_dep(name = "rules_python", version = "1.0.0")
24+
25+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
26+
python.toolchain(
27+
is_default = True,
28+
python_version = "3.12",
29+
)
30+
use_repo(python)
1431

1532
# Add GoogleTest dependency
1633
bazel_dep(name = "googletest", version = "1.14.0")
34+
bazel_dep(name = "google_benchmark", version = "1.9.1")
1735

1836
# Rust rules for Bazel
1937
bazel_dep(name = "rules_rust", version = "0.56.0")
@@ -25,7 +43,7 @@ bazel_dep(name = "score_cr_checker", version = "0.2.0")
2543
bazel_dep(name = "rules_cc", version = "0.1.1")
2644

2745
# LLVM Toolchains Rules - host configuration
28-
bazel_dep(name = "toolchains_llvm", version = "1.2.0")
46+
bazel_dep(name = "toolchains_llvm", version = "1.3.0")
2947

3048
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
3149
llvm.toolchain(
@@ -36,3 +54,9 @@ use_repo(llvm, "llvm_toolchain")
3654
use_repo(llvm, "llvm_toolchain_llvm")
3755

3856
register_toolchains("@llvm_toolchain//:all")
57+
58+
# Provides formatting and linting of Bazel files.
59+
bazel_dep(name = "buildifier_prebuilt", version = "7.3.1")
60+
61+
# Generic linting and formatting rules
62+
bazel_dep(name = "aspect_rules_lint", version = "1.0.3")

0 commit comments

Comments
 (0)