Skip to content

Commit

Permalink
aider: feat: add benchmark GitHub workflow and update database connec…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
schpet committed Sep 8, 2024
1 parent e65139b commit df8a11c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
49 changes: 49 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion benchmark/cool_id_benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down

0 comments on commit df8a11c

Please sign in to comment.