Skip to content

faizkhairi/loadtest-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Loadtest Action

CI

Run HTTP load tests in your CI pipeline and get results posted as PR comments.

PR Comment

Usage

- uses: faizkhairi/loadtest-action@v1
  with:
    url: 'https://api.example.com/health'
    requests: 200
    concurrency: 20

Inputs

Input Required Default Description
url Yes Target URL to load test
requests No 100 Total number of requests
concurrency No 10 Concurrent requests
method No GET HTTP method
headers No {} Headers as JSON string
body No Request body for POST/PUT
threshold No 0 P95 latency threshold in ms (action fails if exceeded)
comment No true Post results as PR comment
token No github.token GitHub token for PR comments

Outputs

Output Description
avg Average latency (ms)
p50 P50 latency (ms)
p95 P95 latency (ms)
p99 P99 latency (ms)
rps Requests per second
errors Failed request count
results Full results as JSON

Examples

Basic health check

name: Load Test
on: pull_request

jobs:
  loadtest:
    runs-on: ubuntu-latest
    steps:
      - uses: faizkhairi/loadtest-action@v1
        with:
          url: 'https://api.example.com/health'

With performance threshold

- uses: faizkhairi/loadtest-action@v1
  with:
    url: 'https://api.example.com/users'
    requests: 500
    concurrency: 50
    threshold: 200  # Fail if P95 > 200ms

POST with auth and body

- uses: faizkhairi/loadtest-action@v1
  with:
    url: 'https://api.example.com/data'
    method: POST
    headers: '{"Authorization": "Bearer ${{ secrets.API_TOKEN }}"}'
    body: '{"key": "value"}'
    requests: 100
    concurrency: 10

Use outputs in subsequent steps

- uses: faizkhairi/loadtest-action@v1
  id: loadtest
  with:
    url: 'https://api.example.com/health'

- run: echo "P95 latency was ${{ steps.loadtest.outputs.p95 }}ms"

PR Comment

When running on a pull request, the action posts a formatted comment with results:

Metric Value
Target GET https://api.example.com/health
Requests 100 (concurrency: 10)
Avg Latency 45.2 ms
P95 120.5 ms
P99 180.3 ms
RPS 85.7
Errors 0 / 100

License

MIT

About

GitHub Action to run HTTP load tests in CI and post results as PR comments

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors