Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Rust Chat CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build_and_test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Build
run: cargo build --verbose

- name: Run Integration Test
run: |
cargo run --bin server > server.log 2>&1 &
SERVER_PID=$!

echo "Server started with PID $SERVER_PID. Waiting for it to initialize..."
sleep 5

# 2. Run the Client with piped input
echo -e "send Hello GitHub Actions\nleave" | cargo run --bin client 127.0.0.1 8080 Abhi

CLIENT_EXIT_CODE=$?

kill $SERVER_PID

if [ $CLIENT_EXIT_CODE -ne 0 ]; then
echo "Client failed!"
cat server.log
exit 1
fi

echo "Integration test passed!"
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

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

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb


# Added by cargo

/target
Loading