Skip to content

Commit f4053f2

Browse files
committed
feat: add bazel, pre-commit hooks, update renovate
1 parent 5ccd707 commit f4053f2

File tree

16 files changed

+678
-42
lines changed

16 files changed

+678
-42
lines changed

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import %workspace%/tools/preset.bazelrc
2+
3+
# Load user-specific settings, if any
4+
try-import %workspace%/user.bazelrc

.bazelversion

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

.github/workflows/bazel.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Bazel CI
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
7+
jobs:
8+
build:
9+
name: Run
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
runs-on: ${{ matrix.os }}
15+
timeout-minutes: 10
16+
steps:
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
18+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
19+
- uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0
20+
- name: "Build & Test"
21+
shell: bash
22+
run: bazel test --config=ci //...

.github/workflows/main.yml

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
11
name: CI
2-
on: [ push, pull_request ]
3-
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
6+
branches: [master]
47
jobs:
58
build:
69
name: Run
710
strategy:
811
fail-fast: false
912
matrix:
10-
os: [ ubuntu-latest, macos-latest, windows-latest ]
11-
dc: [ dmd-latest, ldc-latest ]
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
dc: [dmd-latest, ldc-latest]
1215
exclude:
1316
- os: macos-latest
14-
dc: dmd-latest # dmd is not available on macOS ARM runners
15-
17+
dc: dmd-latest # dmd is not available on macOS ARM runners
1618
runs-on: ${{ matrix.os }}
1719
timeout-minutes: 30
18-
1920
steps:
20-
- uses: actions/checkout@v6
21-
with:
22-
# Requiried for codecov action
23-
fetch-depth: 2
24-
25-
- uses: dlang-community/setup-dlang@v1
26-
with:
27-
compiler: ${{ matrix.dc }}
28-
29-
- name: 'Build & Test'
30-
shell: bash
31-
run: |
32-
dub test --compiler=$DC -b unittest-cov
33-
34-
- name: Upload coverage to Codecov
35-
uses: codecov/codecov-action@v5
36-
with:
37-
flags: unittests
21+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
22+
with:
23+
# Requiried for codecov action
24+
fetch-depth: 2
25+
- uses: dlang-community/setup-dlang@0a7469b93f791d83f30932c6fd105796c6966e20 # v2.0.0
26+
with:
27+
compiler: ${{ matrix.dc }}
28+
- name: "Build & Test"
29+
shell: bash
30+
run: |
31+
dub test --compiler=$DC -b unittest-cov
32+
- name: Upload coverage to Codecov
33+
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
34+
with:
35+
flags: unittests

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ docs/
3232

3333
# Visual Studio Code
3434
.vscode
35+
36+
# Bazel
37+
bazel-*
38+
user.bazelrc

.pre-commit-config.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# See CONTRIBUTING.md for instructions.
2+
# See https://pre-commit.com for more information
3+
# See https://pre-commit.com/hooks.html for more hooks
4+
# Commitizen runs in commit-msg stage
5+
# but we don't want to run the other hooks on commit messages
6+
default_stages: [pre-commit]
7+
# Use a slightly older version of node by default
8+
# as the default uses a very new version of GLIBC
9+
default_language_version:
10+
node: 16.18.0
11+
repos:
12+
- repo: meta
13+
hooks:
14+
- id: check-hooks-apply
15+
- id: check-useless-excludes
16+
- repo: https://github.com/pre-commit/pre-commit-hooks
17+
rev: v6.0.0
18+
hooks:
19+
- id: check-shebang-scripts-are-executable
20+
- id: check-yaml
21+
- id: destroyed-symlinks
22+
- id: detect-private-key
23+
- id: end-of-file-fixer
24+
- id: trailing-whitespace
25+
# Check formatting and lint for starlark code
26+
- repo: https://github.com/keith/pre-commit-buildifier
27+
rev: 8.2.1
28+
hooks:
29+
- id: buildifier
30+
- id: buildifier-lint
31+
# Enforce that commit messages allow for later changelog generation
32+
- repo: https://github.com/commitizen-tools/commitizen
33+
rev: v4.13.9
34+
hooks:
35+
# Requires that commitizen is already installed
36+
- id: commitizen
37+
stages: [commit-msg]
38+
- repo: https://github.com/pre-commit/mirrors-prettier
39+
rev: v3.1.0
40+
hooks:
41+
- id: prettier
42+
- repo: https://github.com/google/yamlfmt
43+
rev: v0.21.0
44+
hooks:
45+
- id: yamlfmt
46+
- repo: https://github.com/crate-ci/typos
47+
rev: v1.44.0
48+
hooks:
49+
- id: typos

BUILD.bazel

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
load("@rules_d//d:defs.bzl", "d_library", "d_test")
2+
3+
d_library(
4+
name = "semver",
5+
srcs = ["source/semver.d"],
6+
visibility = ["//visibility:public"],
7+
)
8+
9+
d_test(
10+
name = "semver_test",
11+
srcs = ["source/semver.d"],
12+
)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1717
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1818
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1919
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

MODULE.bazel

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module(
2+
name = "semver",
3+
version = "0.7.0",
4+
)
5+
6+
bazel_dep(name = "rules_d", version = "0.7.4")
7+
8+
bazel_dep(name = "bazelrc-preset.bzl", version = "1.9.2", dev_dependency = True)
9+
10+
# Select first d toolchain available for the current platform.
11+
d = use_extension("@rules_d//d:extensions.bzl", "d")
12+
d.toolchain(d_version = "dmd-2.112.0")
13+
d.toolchain(d_version = "ldc-1.41.0")
14+
use_repo(d, "d_toolchains")
15+
16+
register_toolchains("@d_toolchains//:all")

0 commit comments

Comments
 (0)