Skip to content

Commit 67b958d

Browse files
committed
chore: generate rust-sdk github action with build.rs
1 parent 6013f7a commit 67b958d

File tree

4 files changed

+47
-28
lines changed

4 files changed

+47
-28
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/rust-sdk.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Rust SDK
2+
env:
3+
RUSTFLAGS: -Dwarnings
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request_target:
9+
types:
10+
- opened
11+
- synchronize
12+
- reopened
13+
branches:
14+
- main
15+
permissions:
16+
contents: read
17+
jobs:
18+
build:
19+
name: Build and Test
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout Code
23+
uses: actions/checkout@v4
24+
- uses: actions-rust-lang/setup-rust-toolchain@v1
25+
with:
26+
toolchain: stable, nightly
27+
components: clippy, rustfmt
28+
- run: cargo test --all-features --workspace
29+
- run: cargo +nightly fmt --check
30+
- run: cargo +nightly clippy --all-features --workspace -- -D warnings

rust-sdk/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ name = "simple"
2121
[dev-dependencies]
2222
chrono = "0.4.38"
2323
env_logger = { version = "0.11.3", features = ["unstable-kv"] }
24+
25+
[build-dependencies]
26+
gh-workflow = "0.1.2"
27+
serde_yaml = "0.9"

rust-sdk/build.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use gh_workflow::*;
2+
3+
fn main() {
4+
let workflow = Workflow::setup_rust().name("Rust SDK".to_string());
5+
6+
// release 0.1.3 will contain a way to change the filename
7+
//workflow.generate().unwrap();
8+
std::fs::write(
9+
"../.github/workflows/rust-sdk.yml",
10+
serde_yaml::to_string(&workflow).unwrap(),
11+
)
12+
.unwrap();
13+
}

0 commit comments

Comments
 (0)