Skip to content

Commit e79a802

Browse files
committed
chore: init repo for 2nd week
0 parents  commit e79a802

13 files changed

+572
-0
lines changed

.github/workflows/build.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
tags:
8+
- v*
9+
pull_request:
10+
branches:
11+
- master
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
build-rust:
18+
strategy:
19+
matrix:
20+
platform: [ubuntu-latest]
21+
runs-on: ${{ matrix.platform }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
submodules: recursive
27+
- name: Install Rust
28+
run: rustup toolchain install stable --component llvm-tools-preview
29+
- name: Install cargo-llvm-cov
30+
uses: taiki-e/install-action@cargo-llvm-cov
31+
- name: install nextest
32+
uses: taiki-e/install-action@nextest
33+
- uses: Swatinem/rust-cache@v2
34+
- name: Check code format
35+
run: cargo fmt -- --check
36+
- name: Check the package for errors
37+
run: cargo check --all
38+
- name: Lint rust sources
39+
run: cargo clippy --all-targets --all-features --tests --benches -- -D warnings
40+
- name: Execute rust tests
41+
run: cargo nextest run --all-features
42+
- name: Generate a changelog
43+
uses: orhun/git-cliff-action@v2
44+
id: git-cliff
45+
if: startsWith(github.ref, 'refs/tags/')
46+
with:
47+
config: cliff.toml
48+
args: -vv --latest --strip header
49+
env:
50+
OUTPUT: CHANGES.md
51+
- name: Release
52+
uses: softprops/action-gh-release@v1
53+
if: startsWith(github.ref, 'refs/tags/')
54+
with:
55+
body: ${{ steps.git-cliff.outputs.content }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

.pre-commit-config.yaml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
fail_fast: false
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.3.0
5+
hooks:
6+
- id: check-byte-order-marker
7+
- id: check-case-conflict
8+
- id: check-merge-conflict
9+
- id: check-symlinks
10+
- id: check-yaml
11+
- id: end-of-file-fixer
12+
- id: mixed-line-ending
13+
- id: trailing-whitespace
14+
- repo: https://github.com/psf/black
15+
rev: 22.10.0
16+
hooks:
17+
- id: black
18+
- repo: local
19+
hooks:
20+
- id: cargo-fmt
21+
name: cargo fmt
22+
description: Format files with rustfmt.
23+
entry: bash -c 'cargo fmt -- --check'
24+
language: rust
25+
files: \.rs$
26+
args: []
27+
- id: cargo-deny
28+
name: cargo deny check
29+
description: Check cargo dependencies
30+
entry: bash -c 'cargo deny check -d'
31+
language: rust
32+
files: \.rs$
33+
args: []
34+
- id: typos
35+
name: typos
36+
description: check typo
37+
entry: bash -c 'typos'
38+
language: rust
39+
files: \.*$
40+
pass_filenames: false
41+
- id: cargo-check
42+
name: cargo check
43+
description: Check the package for errors.
44+
entry: bash -c 'cargo check --all'
45+
language: rust
46+
files: \.rs$
47+
pass_filenames: false
48+
- id: cargo-clippy
49+
name: cargo clippy
50+
description: Lint rust sources
51+
entry: bash -c 'cargo clippy --all-targets --all-features --tests --benches -- -D warnings'
52+
language: rust
53+
files: \.rs$
54+
pass_filenames: false
55+
- id: cargo-test
56+
name: cargo test
57+
description: unit test for the project
58+
entry: bash -c 'cargo nextest run --all-features'
59+
language: rust
60+
files: \.rs$
61+
pass_filenames: false

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
4+
5+
---
6+
## [unreleased]
7+
8+
### Miscellaneous Chores
9+
10+
- initialize basic structure for the repo - ([2436bec](https://github.com/tyrchen/qdrant-lib/commit/2436bec4a02caac64f6c1f97ca79b6ce745b4f53)) - Tyr Chen
11+
12+
### Other
13+
14+
- init the project and add the assets - ([6a3ca0a](https://github.com/tyrchen/qdrant-lib/commit/6a3ca0a900451c55969cc8dec20afb5351d86599)) - Tyr Chen
15+
16+
<!-- generated by git-cliff -->

Cargo.lock

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[package]
2+
name = "template"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]

README.md

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Geektime Rust 语言训练营
2+
3+
## 环境设置
4+
5+
### 安装 Rust
6+
7+
```bash
8+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
9+
```
10+
11+
### 安装 VSCode 插件
12+
13+
- crates: Rust 包管理
14+
- Even Better TOML: TOML 文件支持
15+
- Better Comments: 优化注释显示
16+
- Error Lens: 错误提示优化
17+
- GitLens: Git 增强
18+
- Github Copilot: 代码提示
19+
- indent-rainbow: 缩进显示优化
20+
- Prettier - Code formatter: 代码格式化
21+
- REST client: REST API 调试
22+
- rust-analyzer: Rust 语言支持
23+
- Rust Test lens: Rust 测试支持
24+
- Rust Test Explorer: Rust 测试概览
25+
- TODO Highlight: TODO 高亮
26+
- vscode-icons: 图标优化
27+
- YAML: YAML 文件支持
28+
29+
### 安装 cargo generate
30+
31+
cargo generate 是一个用于生成项目模板的工具。它可以使用已有的 github repo 作为模版生成新的项目。
32+
33+
```bash
34+
cargo install cargo-generate
35+
```
36+
37+
在我们的课程中,新的项目会使用 `tyr-rust-bootcamp/template` 模版生成基本的代码:
38+
39+
```bash
40+
cargo generate tyr-rust-bootcamp/template
41+
```
42+
43+
### 安装 pre-commit
44+
45+
pre-commit 是一个代码检查工具,可以在提交代码前进行代码检查。
46+
47+
```bash
48+
pipx install pre-commit
49+
```
50+
51+
安装成功后运行 `pre-commit install` 即可。
52+
53+
### 安装 Cargo deny
54+
55+
Cargo deny 是一个 Cargo 插件,可以用于检查依赖的安全性。
56+
57+
```bash
58+
cargo install --locked cargo-deny
59+
```
60+
61+
### 安装 typos
62+
63+
typos 是一个拼写检查工具。
64+
65+
```bash
66+
cargo install typos-cli
67+
```
68+
69+
### 安装 git cliff
70+
71+
git cliff 是一个生成 changelog 的工具。
72+
73+
```bash
74+
cargo install git-cliff
75+
```
76+
77+
### 安装 cargo nextest
78+
79+
cargo nextest 是一个 Rust 增强测试工具。
80+
81+
```bash
82+
cargo install cargo-nextest --locked
83+
```

_typos.toml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[default.extend-words]
2+
3+
[files]
4+
extend-exclude = ["CHANGELOG.md", "notebooks/*"]

assets/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Assets
2+
3+
- [juventus.csv](./juventus.csv): dataset from [The-Football-Data](https://github.com/buckthorndev/The-Football-Data).

assets/juventus.csv

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Name,Position,DOB,Nationality,Kit Number
2+
Wojciech Szczesny,Goalkeeper,"Apr 18, 1990 (29)",Poland,1
3+
Mattia Perin,Goalkeeper,"Nov 10, 1992 (26)",Italy,37
4+
Gianluigi Buffon,Goalkeeper,"Jan 28, 1978 (41)",Italy,77
5+
Carlo Pinsoglio,Goalkeeper,"Mar 16, 1990 (29)",Italy,31
6+
Matthijs de Ligt,Centre-Back,"Aug 12, 1999 (20)",Netherlands,4
7+
Leonardo Bonucci,Centre-Back,"May 1, 1987 (32)",Italy,19
8+
Daniele Rugani,Centre-Back,"Jul 29, 1994 (25)",Italy,24
9+
Merih Demiral,Centre-Back,"Mar 5, 1998 (21)",Turkey,28
10+
Giorgio Chiellini,Centre-Back,"Aug 14, 1984 (35)",Italy,3
11+
Alex Sandro,Left-Back,"Jan 26, 1991 (28)",Brazil,12
12+
Danilo,Right-Back,"Jul 15, 1991 (28)",Brazil,13
13+
Mattia De Sciglio,Right-Back,"Oct 20, 1992 (27)",Italy,2
14+
Emre Can,Defensive Midfield,"Jan 12, 1994 (25)",Germany,23
15+
Miralem Pjanic,Central Midfield,"Apr 2, 1990 (29)",Bosnia-Herzegovina,5
16+
Aaron Ramsey,Central Midfield,"Dec 26, 1990 (28)",Wales,8
17+
Adrien Rabiot,Central Midfield,"Apr 3, 1995 (24)",France,25
18+
Rodrigo Bentancur,Central Midfield,"Jun 25, 1997 (22)",Uruguay,30
19+
Blaise Matuidi,Central Midfield,"Apr 9, 1987 (32)",France,14
20+
Sami Khedira,Central Midfield,"Apr 4, 1987 (32)",Germany,6
21+
Cristiano Ronaldo,Left Winger,"Feb 5, 1985 (34)",Portugal,7
22+
Marko Pjaca,Left Winger,"May 6, 1995 (24)",Croatia,15
23+
Federico Bernardeschi,Right Winger,"Feb 16, 1994 (25)",Italy,33
24+
Douglas Costa,Right Winger,"Sep 14, 1990 (29)",Brazil,11
25+
Juan Cuadrado,Right Winger,"May 26, 1988 (31)",Colombia,16
26+
Paulo Dybala,Second Striker,"Nov 15, 1993 (25)",Argentina,10
27+
Gonzalo Higuaín,Centre-Forward,"Dec 10, 1987 (31)",Argentina,21
28+
Mario Mandzukic,Centre-Forward,"May 21, 1986 (33)",Croatia,17

cliff.toml

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# git-cliff ~ configuration file
2+
# https://git-cliff.org/docs/configuration
3+
4+
[changelog]
5+
# changelog header
6+
header = """
7+
# Changelog\n
8+
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.\n
9+
"""
10+
# template for the changelog body
11+
# https://keats.github.io/tera/docs/#introduction
12+
body = """
13+
---
14+
{% if version %}\
15+
{% if previous.version %}\
16+
## [{{ version | trim_start_matches(pat="v") }}]($REPO/compare/{{ previous.version }}..{{ version }}) - {{ timestamp | date(format="%Y-%m-%d") }}
17+
{% else %}\
18+
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
19+
{% endif %}\
20+
{% else %}\
21+
## [unreleased]
22+
{% endif %}\
23+
{% for group, commits in commits | group_by(attribute="group") %}
24+
### {{ group | striptags | trim | upper_first }}
25+
{% for commit in commits
26+
| filter(attribute="scope")
27+
| sort(attribute="scope") %}
28+
- **({{commit.scope}})**{% if commit.breaking %} [**breaking**]{% endif %} \
29+
{{ commit.message|trim }} - ([{{ commit.id | truncate(length=7, end="") }}]($REPO/commit/{{ commit.id }})) - {{ commit.author.name }}
30+
{%- endfor -%}
31+
{% raw %}\n{% endraw %}\
32+
{%- for commit in commits %}
33+
{%- if commit.scope -%}
34+
{% else -%}
35+
- {% if commit.breaking %} [**breaking**]{% endif %}\
36+
{{ commit.message|trim }} - ([{{ commit.id | truncate(length=7, end="") }}]($REPO/commit/{{ commit.id }})) - {{ commit.author.name }}
37+
{% endif -%}
38+
{% endfor -%}
39+
{% endfor %}\n
40+
"""
41+
# template for the changelog footer
42+
footer = """
43+
<!-- generated by git-cliff -->
44+
"""
45+
# remove the leading and trailing whitespace from the templates
46+
trim = true
47+
# postprocessors
48+
postprocessors = [
49+
{ pattern = '\$REPO', replace = "https://github.com/tyr-rust-bootcamp/02-concurrency" }, # replace repository URL
50+
]
51+
52+
[git]
53+
# parse the commits based on https://www.conventionalcommits.org
54+
conventional_commits = true
55+
# filter out the commits that are not conventional
56+
filter_unconventional = false
57+
# process each line of a commit as an individual commit
58+
split_commits = false
59+
# regex for preprocessing the commit messages
60+
commit_preprocessors = [
61+
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](https://github.com/orhun/git-cliff/issues/${2}))"}, # replace issue numbers
62+
]
63+
# regex for parsing and grouping commits
64+
commit_parsers = [
65+
{ message = "\\[skip", skip = true },
66+
{ message = "\\p{Han}", skip = true },
67+
{ message = "^feat", group = "Features" },
68+
{ message = "^fix", group = "Bug Fixes" },
69+
{ message = "^doc", group = "Documentation" },
70+
{ message = "^perf", group = "Performance" },
71+
{ message = "^refactor", group = "Refactoring" },
72+
{ message = "^style", group = "Style" },
73+
{ message = "^revert", group = "Revert" },
74+
{ message = "^test", group = "Tests" },
75+
{ message = "^chore\\(version\\):", skip = true },
76+
{ message = "^chore", group = "Miscellaneous Chores" },
77+
{ message = ".*", group = "Other" },
78+
{ body = ".*security", group = "Security" },
79+
]
80+
# protect breaking changes from being skipped due to matching a skipping commit_parser
81+
protect_breaking_commits = false
82+
# filter out the commits that are not matched by commit parsers
83+
filter_commits = false
84+
# regex for matching git tags
85+
tag_pattern = "v[0-9].*"
86+
# regex for skipping tags
87+
skip_tags = "v0.1.0-beta.1"
88+
# regex for ignoring tags
89+
ignore_tags = ""
90+
# sort the tags topologically
91+
topo_order = false
92+
# sort the commits inside sections by oldest/newest order
93+
sort_commits = "oldest"
94+
# limit the number of commits included in the changelog.
95+
# limit_commits = 42

0 commit comments

Comments
 (0)