Skip to content

Commit d7796e8

Browse files
committed
feat: Set CI and init project.
1 parent 0374ad4 commit d7796e8

File tree

5 files changed

+96
-0
lines changed

5 files changed

+96
-0
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
tests:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Cache .cargo and target
15+
uses: actions/cache@v2
16+
with:
17+
path: |
18+
~/.cargo
19+
./target
20+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
21+
restore-keys: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
22+
- name: Install Rust toolchain
23+
uses: actions-rs/toolchain@v1
24+
with:
25+
toolchain: stable
26+
profile: minimal
27+
default: true
28+
- name: Stable Build
29+
uses: actions-rs/cargo@v1
30+
with:
31+
command: build
32+
args: --all-features
33+
- name: Tests
34+
uses: actions-rs/cargo@v1
35+
with:
36+
command: test
37+
args: --all-features

.github/workflows/lint.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Lint checks
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
env:
13+
TZ: "/usr/share/zoneinfo/your/location"
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Cache .cargo and target
17+
uses: actions/cache@v2
18+
with:
19+
path: |
20+
~/.cargo
21+
./target
22+
key: ${{ runner.os }}-lint-cargo-${{ hashFiles('**/Cargo.toml') }}
23+
restore-keys: ${{ runner.os }}-lint-cargo-${{ hashFiles('**/Cargo.toml') }}
24+
- name: Install Rust toolchain
25+
uses: actions-rs/toolchain@v1
26+
with:
27+
toolchain: stable
28+
profile: minimal
29+
default: true
30+
- run: rustup component add rustfmt
31+
- name: Check formt
32+
uses: actions-rs/cargo@v1
33+
with:
34+
command: fmt
35+
args: --all -- --check
36+
- run: rustup component add clippy
37+
- name: Run clippy
38+
uses: actions-rs/cargo@v1
39+
with:
40+
command: clippy
41+
args: --all-features -- -Drust-2018-idioms -Dwarnings

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
Cargo.lock

Cargo.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "typesense"
3+
version = "0.1.0"
4+
authors = ["Typesense <[email protected]>"]
5+
edition = "2018"
6+
7+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8+
9+
[dependencies]

src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#[cfg(test)]
2+
mod tests {
3+
#[test]
4+
fn it_works() {
5+
assert_eq!(2 + 2, 4);
6+
}
7+
}

0 commit comments

Comments
 (0)