Skip to content

Commit 6577e43

Browse files
authored
Merge pull request #1 from rsachdeva/chatty
Implement Async TCP Chat System with High-throughput Server and Interactive CLI Client
2 parents 6fa8d5b + 46e95e2 commit 6577e43

30 files changed

+2166
-1
lines changed

.cargo/config.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[env]
2+
# https://doc.rust-lang.org/cargo/reference/config.html#env
3+
RUST_LOG = { value = "chatty_types=info,chatty_tcp=info", force = true }
4+
5+
TCP_SERVER_ADDRESS = "localhost"
6+
TCP_SERVER_PORT = "8081"

.githooks/pre-commit

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
echo "Running pre-commit checks..."
3+
4+
# Check formatting
5+
echo "Checking formatting..."
6+
cargo fmt --quiet -- --check
7+
if [ $? -ne 0 ]; then
8+
echo "Formatting check failed. Please run 'cargo fmt' to fix"
9+
exit 1
10+
fi
11+
12+
# Run clippy
13+
echo "Running clippy..."
14+
cargo clippy --quiet -- -D warnings
15+
if [ $? -ne 0 ]; then
16+
echo "Clippy check failed. Please fix the warnings"
17+
exit 1
18+
fi
19+
20+
# Compile check
21+
echo "Checking compilation..."
22+
cargo check --quiet
23+
if [ $? -ne 0 ]; then
24+
echo "Compilation failed"
25+
exit 1
26+
fi
27+
28+
echo "All pre-commit checks passed!"
29+
exit 0

.github/workflows/rust.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
- 'v*' # This will match any branch starting with 'v'
8+
- 'chatty*'# This will match any branch starting with 'chatty'
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Check Rust version
24+
run: |
25+
echo "Installed rustc version:"
26+
rustc --version
27+
echo "Installed cargo version:"
28+
cargo --version
29+
30+
- name: Install Just
31+
uses: extractions/setup-just@v2
32+
33+
- name: Check Just version
34+
run: |
35+
echo "Installed just version:"
36+
just --version
37+
38+
- name: Build with Tests
39+
run: |
40+
just build-with-tests
41+
42+
verify-chat-connection:
43+
needs: build
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Checkout repository
47+
uses: actions/checkout@v4
48+
49+
- name: Check Rust version
50+
run: |
51+
echo "Installed rustc version:"
52+
rustc --version
53+
echo "Installed cargo version:"
54+
cargo --version
55+
56+
- name: Install Just
57+
uses: extractions/setup-just@v2
58+
59+
- name: Check Just version
60+
run: |
61+
echo "Installed just version:"
62+
just --version
63+
64+
- name: Start Chat Server
65+
run: |
66+
just run-chatty-tcp-server &
67+
sleep 3
68+
69+
- name: Test Client Connection
70+
run: |
71+
TCP_SERVER_ADDRESS="localhost" TCP_SERVER_PORT="8081" cargo run --quiet --package chatty-tcp --bin client -- --username "rohit_s" < <(echo -e "send Hello World\nleave")
72+
73+
74+
test:
75+
needs: build
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: Checkout repository
79+
uses: actions/checkout@v4
80+
81+
- name: Check Rust version
82+
run: |
83+
echo "Installed rustc version:"
84+
rustc --version
85+
echo "Installed cargo version:"
86+
cargo --version
87+
88+
- name: Install Just
89+
uses: extractions/setup-just@v2
90+
91+
- name: Check Just version
92+
run: |
93+
echo "Installed just version:"
94+
just --version
95+
96+
- name: Run unit and integration tests
97+
run: just test

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22
# will have compiled files and executables
33
debug/
44
target/
5+
private/
56

67
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
78
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
8-
Cargo.lock
99

10+
# simple-chat is execuatle so should not be included in gitignore
11+
# so it is checked in the git repo
12+
# Cargo.lock
13+
14+
# some extra files
1015
# These are backup files generated by rustfmt
1116
**/*.rs.bk
1217

18+
# Working on MacOS still per Github keeping this
1319
# MSVC Windows builds of rustc generate these, which store debugging information
1420
*.pdb

0 commit comments

Comments
 (0)