Skip to content

Commit

Permalink
ci: add benchmarks (#505)
Browse files Browse the repository at this point in the history
* feat(performance): add benchmark step to CI workflow

Add a new 'Benchmark' job in the GitHub Actions workflow to run
performance tests and generate graphs. Save the test report as
an artifact in the Earthfile. The job runs on 'github-001' and
triggers on PRs labeled 'benchmarks' or on the main branch.

* remove unnecessary dependency from Benchmark job in GitHub Actions

* perf(performance): remove artifact saving from Earthfile

Remove the line saving the test report artifact locally, as it is
unnecessary for the current performance testing setup.

* refactor(workflows): move benchmark job to a separate workflow

Create a new benchmark.yml for the benchmark job. Remove the
benchmark job from main.yml. This organizes workflows better
by separating concerns.

* feat: add CI step for performance testing and update benchmark workflow

Add a new 'ci' target in Earthfile for local performance testing.
Update the benchmark workflow to use the new 'ci' step and upgrade
actions/upload-artifact to v4.

* fix(performance): add sudo to systemctl restart in Earthfile

Add sudo to the systemctl restart command to ensure proper
permissions are granted when restarting the ledger service
during performance tests.

* refactor(performance): remove ci block from Earthfile and update benchmark workflow

Remove redundant ci block from Earthfile and update the GitHub
Actions benchmark workflow to execute the 'run' target with
appropriate arguments.

* refactor(performance): remove ci block from Earthfile and update benchmark workflow

Remove redundant ci block from Earthfile and update the GitHub
Actions benchmark workflow to execute the 'run' target with
appropriate arguments.

* fix(workflow): remove sudo from systemctl command in benchmark.yml

* fix(workflow): remove sudo from systemctl command in benchmark.yml

* fix(workflow): update benchmark server start and stop commands

Update the command to start `ledger serve` without using `systemctl`.
Add a command to kill the server process after benchmarking.
  • Loading branch information
flemzord authored and gfyrag committed Oct 23, 2024
1 parent 65fcb58 commit 0a7dc18
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Benchmark
on:
workflow_dispatch:
pull_request:
types: [ assigned, opened, synchronize, reopened, labeled ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
Benchmark:
runs-on: "github-001"
if: contains(github.event.pull_request.labels.*.name, 'benchmarks') || github.ref == 'refs/heads/main'
steps:
- uses: 'actions/checkout@v4'
with:
fetch-depth: 0
- run: go build -o /tmp/ledger ./
- run: echo "running actions as ${USER}"
- run: /tmp/ledger serve --postgres-uri=postgres://formance:[email protected]/ledger --postgres-conn-max-idle-time=120s --postgres-max-open-conns=500 --postgres-max-idle-conns=100 &
- run: >
earthly
--allow-privileged
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
./test/performance+run --args="-benchtime 10s --ledger.url=http://localhost:3068"
- run: >
earthly
--allow-privileged
${{ contains(github.event.pull_request.labels.*.name, 'no-cache') && '--no-cache' || '' }}
./test/performance+generate-graphs
- run: kill -9 $(ps aux | grep "ledger serve"| grep -v "grep" | awk '{print $2}')
- uses: actions/upload-artifact@v4
with:
name: graphs
path: test/performance/report

0 comments on commit 0a7dc18

Please sign in to comment.