Skip to content

Commit 173a7cb

Browse files
authored
feat(rs): initial rust implementation for dotprompt (#390)
1 parent d799864 commit 173a7cb

26 files changed

+4689
-15
lines changed

.github/labeler.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,35 @@ root:
2020
- changed-files:
2121
- any-glob-to-any-file: "*"
2222

23+
bazel:
24+
- changed-files:
25+
- any-glob-to-any-file:
26+
- "**/*.bazel"
27+
- "**/*.bzl"
28+
- "**/.bazel*"
29+
- "**/MODULE.bazel*"
30+
- "**/maven_install.json"
31+
32+
java:
33+
- changed-files:
34+
- any-glob-to-any-file:
35+
- "**/*.java"
36+
- "java/**"
37+
- "**/maven_install.json"
38+
39+
kotlin:
40+
- changed-files:
41+
- any-glob-to-any-file:
42+
- "**/*.kt"
43+
44+
rust:
45+
- changed-files:
46+
- any-glob-to-any-file:
47+
- "**/*.rs"
48+
- "**/Cargo.toml"
49+
- "**/Cargo.lock"
50+
- "rs/**"
51+
2352
go:
2453
- changed-files:
2554
- any-glob-to-any-file:

.github/workflows/publish_rust.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
17+
name: Publish Rust Package
18+
19+
on:
20+
release:
21+
types: [created]
22+
23+
jobs:
24+
publish-cargo:
25+
runs-on: ubuntu-latest
26+
# Only run for releases tagged with rs- prefix
27+
if: startsWith(github.ref, 'refs/tags/rs-')
28+
permissions:
29+
contents: read
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v6
33+
34+
- name: Install Rust toolchain
35+
uses: dtolnay/rust-toolchain@stable
36+
37+
- name: Verify package
38+
run: |
39+
cd rs/dotprompt
40+
cargo package --list
41+
42+
- name: Publish to crates.io
43+
env:
44+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
45+
run: |
46+
cd rs/dotprompt
47+
cargo publish --token "${CARGO_REGISTRY_TOKEN}"

.github/workflows/rust.yml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2025 Google LLC
1+
# Copyright 2026 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -25,6 +25,36 @@ on:
2525
- ".github/workflows/rust.yml"
2626

2727
jobs:
28+
format-check:
29+
name: Format Check
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v6
34+
35+
- name: Install Rust toolchain
36+
uses: dtolnay/rust-toolchain@stable
37+
with:
38+
components: rustfmt
39+
40+
- name: Check formatting
41+
run: cargo fmt --all -- --check
42+
43+
clippy-lint:
44+
name: Clippy Linting
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v6
49+
50+
- name: Install Rust toolchain
51+
uses: dtolnay/rust-toolchain@stable
52+
with:
53+
components: clippy
54+
55+
- name: Run clippy
56+
run: cargo clippy --all-targets --workspace -- -D warnings
57+
2858
check-build-test:
2959
name: Check, Build & Test (${{ matrix.toolchain }}, ${{ matrix.os_config.os }}-${{ matrix.os_config.arch }})
3060
runs-on: ${{ matrix.os_config.os }}
@@ -69,6 +99,17 @@ jobs:
6999
# Allow nightly tests to fail
70100
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
71101

102+
- name: Verify SPEC_FILE support
103+
env:
104+
RUST_BACKTRACE: 1
105+
run: |
106+
find spec -name "*.yaml" | while read -r spec_file; do
107+
relative_spec_file="../../$spec_file"
108+
echo "Testing SPEC_FILE=$relative_spec_file"
109+
SPEC_FILE="$relative_spec_file" cargo test --test spec_test -- --nocapture > /dev/null || exit 1
110+
done
111+
continue-on-error: ${{ matrix.toolchain == 'nightly' }}
112+
72113
#check-build-test-musl-matrix:
73114
# name: Check, Build & Test (${{ matrix.toolchain }}, alpine-${{ matrix.arch }}-musl)
74115
# runs-on: ubuntu-latest # Runner OS
@@ -136,3 +177,4 @@ jobs:
136177
# run: cargo test --all-targets --workspace --target ${{ matrix.target }}
137178
# # Allow nightly tests to fail
138179
# continue-on-error: ${{ matrix.toolchain == 'nightly' }}
180+

.release-please-manifest.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"js": "1.1.1",
3-
"python/dotpromptz": "0.1.4",
4-
"python/handlebarrz": "0.1.3",
5-
"go": "0.1.0",
6-
"java": "0.1.0"
2+
"js": "0.2.9",
3+
"python/dotpromptz": "0.2.1",
4+
"python/handlebarrz": "0.1.2",
5+
"go": "0.2.0",
6+
"java": "0.1.0",
7+
"rs": "0.1.0"
78
}

0 commit comments

Comments
 (0)