Skip to content

Commit 086904a

Browse files
authored
Merge branch 'rollkit:main' into main
2 parents a6541d0 + 4906143 commit 086904a

File tree

185 files changed

+17964
-4060
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+17964
-4060
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "Setup Rust"
2+
description: "Setup Rust toolchain with caching and protoc"
3+
inputs:
4+
toolchain:
5+
description: "Rust toolchain to install"
6+
required: false
7+
default: "stable"
8+
components:
9+
description: "Rust components to install"
10+
required: false
11+
default: ""
12+
cache-key:
13+
description: "Additional cache key for dependencies"
14+
required: false
15+
default: "default"
16+
17+
runs:
18+
using: "composite"
19+
steps:
20+
- name: Install Rust toolchain
21+
uses: dtolnay/rust-toolchain@master
22+
with:
23+
toolchain: ${{ inputs.toolchain }}
24+
components: ${{ inputs.components }}
25+
26+
- name: Install protoc
27+
uses: arduino/setup-protoc@v3
28+
with:
29+
version: "25.1"
30+
repo-token: ${{ github.token }}
31+
32+
- name: Cache Rust dependencies
33+
uses: actions/cache@v4
34+
with:
35+
path: |
36+
~/.cargo/bin/
37+
~/.cargo/registry/index/
38+
~/.cargo/registry/cache/
39+
~/.cargo/git/db/
40+
target/
41+
key: ${{ runner.os }}-cargo-${{ inputs.toolchain }}-${{ inputs.cache-key }}-${{ hashFiles('**/Cargo.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-cargo-${{ inputs.toolchain }}-${{ inputs.cache-key }}-
44+
${{ runner.os }}-cargo-${{ inputs.toolchain }}-
45+
46+
- name: Display Rust version
47+
shell: bash
48+
run: |
49+
rustc --version
50+
cargo --version
51+
protoc --version

.github/dependabot.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
version: 2
22
updates:
33
- package-ecosystem: github-actions
4+
target-branch: main
45
directory: "/"
56
schedule:
67
interval: weekly
@@ -29,6 +30,7 @@ updates:
2930
- "patch"
3031
- "minor"
3132
- package-ecosystem: gomod
33+
target-branch: main
3234
directory: "/"
3335
schedule:
3436
interval: weekly
@@ -55,9 +57,8 @@ updates:
5557
applies-to: version-updates
5658
update-types:
5759
- "patch"
58-
- "minor"
5960
- package-ecosystem: docker
60-
directory: "/docker"
61+
directory: "/"
6162
schedule:
6263
interval: daily
6364
open-pull-requests-limit: 10
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Rust CI Status
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Rust Tests", "Rust Lint", "Rust Proto Generation Check"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
status:
11+
name: Update CI Status
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
if: github.event.workflow_run.conclusion != 'skipped'
16+
steps:
17+
- name: Report status
18+
run: |
19+
echo "Workflow: ${{ github.event.workflow_run.name }}"
20+
echo "Status: ${{ github.event.workflow_run.conclusion }}"
21+
echo "Branch: ${{ github.event.workflow_run.head_branch }}"
22+
23+
if [ "${{ github.event.workflow_run.conclusion }}" != "success" ]; then
24+
echo "::error::Rust CI workflow failed"
25+
exit 1
26+
fi

.github/workflows/rust-lint.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Rust Lint
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "client/**"
7+
- "proto/**"
8+
- "Cargo.toml"
9+
- "Cargo.lock"
10+
- ".github/workflows/rust-*.yml"
11+
push:
12+
branches:
13+
- main
14+
- release/*
15+
16+
jobs:
17+
fmt:
18+
name: Rustfmt
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Install Rust toolchain
25+
uses: dtolnay/rust-toolchain@stable
26+
with:
27+
components: rustfmt
28+
29+
- name: Check formatting
30+
run: cargo fmt --all -- --check
31+
32+
clippy:
33+
name: Clippy
34+
runs-on: ubuntu-latest
35+
permissions:
36+
contents: read
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
41+
- name: Install Rust toolchain
42+
uses: dtolnay/rust-toolchain@stable
43+
with:
44+
components: clippy
45+
46+
- name: Install protoc
47+
uses: arduino/setup-protoc@v3
48+
with:
49+
version: "25.1"
50+
repo-token: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Cache Rust dependencies
53+
uses: actions/cache@v4
54+
with:
55+
path: |
56+
~/.cargo/bin/
57+
~/.cargo/registry/index/
58+
~/.cargo/registry/cache/
59+
~/.cargo/git/db/
60+
target/
61+
key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
62+
restore-keys: |
63+
${{ runner.os }}-cargo-clippy-
64+
65+
- name: Run clippy
66+
run: cargo clippy --workspace --all-features -- -D warnings
67+
68+
audit:
69+
name: Security Audit
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Checkout code
73+
uses: actions/checkout@v4
74+
75+
- name: Run cargo audit
76+
uses: actions-rust-lang/audit@v1
77+
with:
78+
ignore: "" # Add RUSTSEC IDs to ignore if needed
79+
80+
docs:
81+
name: Documentation
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v4
86+
87+
- name: Install Rust toolchain
88+
uses: dtolnay/rust-toolchain@stable
89+
90+
- name: Install protoc
91+
uses: arduino/setup-protoc@v3
92+
with:
93+
version: "25.1"
94+
repo-token: ${{ secrets.GITHUB_TOKEN }}
95+
96+
- name: Cache Rust dependencies
97+
uses: actions/cache@v4
98+
with:
99+
path: |
100+
~/.cargo/bin/
101+
~/.cargo/registry/index/
102+
~/.cargo/registry/cache/
103+
~/.cargo/git/db/
104+
target/
105+
key: ${{ runner.os }}-cargo-doc-${{ hashFiles('**/Cargo.lock') }}
106+
restore-keys: |
107+
${{ runner.os }}-cargo-doc-
108+
109+
- name: Check documentation
110+
run: cargo doc --workspace --no-deps --all-features
111+
env:
112+
RUSTDOCFLAGS: -D warnings

.github/workflows/rust-publish.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Publish Rust Crates
2+
3+
on:
4+
push:
5+
tags:
6+
- 'rust-v*'
7+
workflow_dispatch:
8+
inputs:
9+
dry_run:
10+
description: 'Perform a dry run without publishing'
11+
required: false
12+
type: boolean
13+
default: true
14+
15+
jobs:
16+
publish:
17+
name: Publish to crates.io
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Rust
24+
uses: ./.github/actions/rust-setup
25+
with:
26+
cache-key: publish
27+
28+
- name: Check crate versions
29+
run: |
30+
echo "=== Checking crate versions ==="
31+
echo "rollkit-types version: $(cargo pkgid -p rollkit-types | cut -d# -f2)"
32+
echo "rollkit-client version: $(cargo pkgid -p rollkit-client | cut -d# -f2)"
33+
34+
- name: Run tests
35+
run: cargo test --workspace --all-features
36+
37+
- name: Package crates
38+
run: |
39+
cargo package -p rollkit-types --allow-dirty
40+
cargo package -p rollkit-client --allow-dirty
41+
42+
- name: Publish rollkit-types (dry run)
43+
if: github.event_name == 'workflow_dispatch' && inputs.dry_run
44+
run: |
45+
cd client/crates/rollkit-types
46+
cargo publish --dry-run
47+
48+
- name: Publish rollkit-client (dry run)
49+
if: github.event_name == 'workflow_dispatch' && inputs.dry_run
50+
run: |
51+
cd client/crates/rollkit-client
52+
cargo publish --dry-run
53+
54+
- name: Publish rollkit-types
55+
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && !inputs.dry_run)
56+
env:
57+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
58+
run: |
59+
cd client/crates/rollkit-types
60+
cargo publish
61+
62+
- name: Wait for rollkit-types to be available
63+
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && !inputs.dry_run)
64+
run: |
65+
echo "Waiting for rollkit-types to be available on crates.io..."
66+
sleep 30
67+
68+
- name: Publish rollkit-client
69+
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || (github.event_name == 'workflow_dispatch' && !inputs.dry_run)
70+
env:
71+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
72+
run: |
73+
cd client/crates/rollkit-client
74+
cargo publish
75+
76+
- name: Create GitHub Release
77+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
78+
uses: softprops/action-gh-release@v2
79+
with:
80+
name: Rust Client ${{ github.ref_name }}
81+
body: |
82+
# Rust Client Release
83+
84+
This release includes:
85+
- `rollkit-types`: Proto-generated types for Rollkit
86+
- `rollkit-client`: High-level Rust client for Rollkit gRPC services
87+
88+
## Installation
89+
90+
Add to your `Cargo.toml`:
91+
```toml
92+
[dependencies]
93+
rollkit-client = "<version>"
94+
```
95+
96+
See the [README](https://github.com/rollkit/rollkit/tree/main/client/crates/rollkit-client) for usage examples.
97+
draft: false
98+
prerelease: false

0 commit comments

Comments
 (0)