Revert "feat(): added stress test on server" #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Load Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
load-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install Artillery | |
run: npm install -g artillery | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Cache Cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-registry- | |
- name: Cache Cargo build | |
uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-build- | |
- name: Build the server | |
run: cargo build --release | |
- name: Start the server | |
run: cargo run --release & | |
env: | |
SERVER_LOCAL_PORT: 3000 | |
- name: Wait for server to start | |
run: sleep 10 | |
- name: Run load test | |
run: artillery run --output report.json load-test.yml | |
- name: Upload test report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artillery-report | |
path: report.json | |
- name: Stop the server | |
run: pkill -f "cargo run --release" |