From df8a11c9ba9b128d2592d6280dc66bbcfcaa1847 Mon Sep 17 00:00:00 2001 From: "Peter Schilling (aider)" Date: Sun, 8 Sep 2024 07:26:07 -0700 Subject: [PATCH] aider: feat: add benchmark GitHub workflow and update database connection --- .github/workflows/benchmark.yml | 49 +++++++++++++++++++++++++++++++++ benchmark/cool_id_benchmark.rb | 4 ++- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/benchmark.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000..09d17f9 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,49 @@ +name: Benchmark + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + benchmark: + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:13 + env: + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1.0 + bundler-cache: true + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y postgresql-client + - name: Set up database + run: | + createdb -h localhost -U postgres cool_id_benchmark + env: + PGPASSWORD: postgres + - name: Run benchmark + run: | + bundle exec ruby benchmark/cool_id_benchmark.rb + env: + PGHOST: localhost + PGUSER: postgres + PGPASSWORD: postgres diff --git a/benchmark/cool_id_benchmark.rb b/benchmark/cool_id_benchmark.rb index 9da1374..d9ee071 100644 --- a/benchmark/cool_id_benchmark.rb +++ b/benchmark/cool_id_benchmark.rb @@ -8,7 +8,9 @@ # Configure ActiveRecord to use PostgreSQL ActiveRecord::Base.establish_connection( adapter: "postgresql", - host: "localhost", + host: ENV["PGHOST"] || "localhost", + username: ENV["PGUSER"] || "postgres", + password: ENV["PGPASSWORD"] || "postgres", database: "cool_id_benchmark" )