Skip to content

Commit d54e940

Browse files
committed
Initialize Rust project for prisma schema to rust types codegen
Added initial files for a Rust project, including Cargo configuration and strict lint rules.
0 parents  commit d54e940

File tree

10 files changed

+207
-0
lines changed

10 files changed

+207
-0
lines changed

.github/actions-rs/grcov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
output-type: lcov
2+
output-file: ./lcov.info

.github/dependabot.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
ignore:
8+
- dependency-name: "*"
9+
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
10+
assignees:
11+
- "mkpro118"
12+
labels:
13+
- "type: upkeep"
14+
- "domain: Rust"
15+
16+
- package-ecosystem: "github-actions"
17+
directory: "/"
18+
schedule:
19+
interval: "weekly"
20+
assignees:
21+
- "mkpro118"
22+
labels:
23+
- "type: upkeep"
24+
- "domain: GitHub Actions"

.github/workflows/lint.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Lint
2+
on: [push, pull_request]
3+
4+
env:
5+
CARGO_TERM_COLOR: always
6+
7+
jobs:
8+
fmt:
9+
name: Rustfmt
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v5
13+
- uses: dtolnay/rust-toolchain@stable
14+
with:
15+
components: rustfmt
16+
- name: Enforce formatting
17+
run: cargo fmt -- --check
18+
19+
cargo_check:
20+
name: Cargo Check
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
matrix:
24+
os: [ubuntu-latest, windows-latest]
25+
rust: [stable, beta, nightly]
26+
feature: ["", "--all-features", "--no-default-features"]
27+
steps:
28+
- uses: actions/checkout@v5
29+
- uses: dtolnay/rust-toolchain@master
30+
with:
31+
toolchain: ${{ matrix.rust }}
32+
- name: Cache
33+
uses: actions/cache@v3
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-${{ hashFiles('**/Cargo.lock') }}
42+
- name: Rust cargo check
43+
run: cargo check --workspace ${{ matrix.feature }}
44+
45+
clippy:
46+
name: Clippy
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v5
50+
- uses: dtolnay/rust-toolchain@stable
51+
with:
52+
components: clippy
53+
- name: Cache
54+
uses: actions/cache@v3
55+
with:
56+
path: |
57+
~/.cargo/bin/
58+
~/.cargo/registry/index/
59+
~/.cargo/registry/cache/
60+
~/.cargo/git/db/
61+
target/
62+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
63+
- uses: actions-rs/clippy-check@v1
64+
with:
65+
token: ${{ secrets.GITHUB_TOKEN }}
66+
args: --all-features --tests -- -F clippy::pedantic
67+
68+
audit:
69+
name: Security Audit
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v5
73+
- uses: dtolnay/rust-toolchain@stable
74+
- name: Cache
75+
uses: actions/cache@v3
76+
with:
77+
path: |
78+
~/.cargo/bin/
79+
~/.cargo/registry/index/
80+
~/.cargo/registry/cache/
81+
~/.cargo/git/db/
82+
target/
83+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
84+
- name: Run audit
85+
uses: actions-rs/audit-check@v1
86+
with:
87+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Test
2+
on: [push, pull_request]
3+
4+
env:
5+
CARGO_TERM_COLOR: always
6+
7+
jobs:
8+
test:
9+
name: Test ${{ matrix.rust }} on ${{ matrix.os }}
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, windows-latest, macos-latest]
14+
rust: [stable, beta, nightly]
15+
feature: ["", "--all-features", "--no-default-features"]
16+
steps:
17+
- uses: actions/checkout@v5
18+
- uses: dtolnay/rust-toolchain@master
19+
with:
20+
toolchain: ${{ matrix.rust }}
21+
- name: Cache
22+
uses: actions/cache@v4
23+
with:
24+
path: |
25+
~/.cargo/bin/
26+
~/.cargo/registry/index/
27+
~/.cargo/registry/cache/
28+
~/.cargo/git/db/
29+
target/
30+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
31+
- name: Run tests
32+
run: cargo test --workspace ${{ matrix.feature }}
33+
34+
coverage:
35+
name: Code coverage
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v5
40+
41+
- name: Install Rust toolchain
42+
uses: dtolnay/rust-toolchain@stable
43+
with:
44+
components: llvm-tools-preview
45+
46+
- name: Install cargo-llvm-cov
47+
uses: taiki-e/install-action@cargo-llvm-cov
48+
49+
- name: Cache
50+
uses: actions/cache@v4
51+
with:
52+
path: |
53+
~/.cargo/bin/
54+
~/.cargo/registry/index/
55+
~/.cargo/registry/cache/
56+
~/.cargo/git/db/
57+
target/
58+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
59+
60+
- name: Generate code coverage
61+
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
62+
63+
- name: Upload coverage to Codecov
64+
uses: codecov/codecov-action@v3
65+
with:
66+
files: lcov.info
67+
fail_ci_if_error: true

.gitignore

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

.rustfmt.toml

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

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "prisma-rs"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]

rust-toolchain

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

src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#![deny(clippy::expect_used)] // using deny so that test code can use it
2+
#![deny(clippy::style)]
3+
#![deny(clippy::unwrap_used)] // using deny so that test code can use it
4+
#![deny(unsafe_code)]
5+
#![forbid(clippy::allow_attributes)]
6+
#![forbid(clippy::complexity)]
7+
#![forbid(clippy::correctness)]
8+
#![forbid(clippy::pedantic)]
9+
#![forbid(clippy::perf)]
10+
#![forbid(clippy::suspicious)]
11+
#![forbid(future_incompatible)]

0 commit comments

Comments
 (0)