From 97f00287abec3cc55f2c7443fc4c61f7f0ffd8df Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Wed, 16 Mar 2022 15:32:28 -0700 Subject: [PATCH] Try to get postgres:latest working in CI --- .github/workflows/ci.yml | 4 +++- Rakefile | 8 +++----- spec/spec_helper.rb | 5 +++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f440efb9..a71e7052 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,9 +11,11 @@ jobs: runs-on: ubuntu-latest services: postgres: - image: postgres:11.5 + image: postgres:latest ports: ["5432:5432"] options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + env: + POSTGRES_PASSWORD: postgres mysql: image: mysql:latest env: diff --git a/Rakefile b/Rakefile index 25abec30..2eae52ce 100644 --- a/Rakefile +++ b/Rakefile @@ -169,16 +169,14 @@ task :spec_ci do end if RUBY_ENGINE == 'jruby' - pg_db = "jdbc:postgresql://localhost/#{pg_database}?user=postgres" + pg_db = "jdbc:postgresql://localhost/#{pg_database}?user=postgres&password=postgres" my_db = "jdbc:mysql://#{mysql_host}/rodauth_test?user=root#{mysql_password}&useSSL=false&allowPublicKeyRetrieval=true" else - pg_db = "postgres://localhost/#{pg_database}?user=postgres" + pg_db = "postgres://localhost/#{pg_database}?user=postgres&password=postgres" my_db = "mysql2://#{mysql_host}/rodauth_test?user=root#{mysql_password}&useSSL=false" end - sh "psql -U postgres -h localhost -c 'CREATE EXTENSION citext' #{pg_database}" - sh "psql -U postgres -h localhost -c 'CREATE EXTENSION pgcrypto' #{pg_database}" if ENV['RODAUTH_SPEC_UUID'] - spec.call('RODAUTH_SPEC_MIGRATE'=>'1', 'RODAUTH_SPEC_DB'=>pg_db) + spec.call('RODAUTH_SPEC_CI'=>'1', 'RODAUTH_SPEC_MIGRATE'=>'1', 'RODAUTH_SPEC_DB'=>pg_db) if RUBY_VERSION >= '2.4' spec.call('RODAUTH_SPEC_MIGRATE'=>'1', 'RODAUTH_SPEC_DB'=>my_db) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b5a48fb2..45c1f0b1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -81,6 +81,11 @@ def SimpleCov.rodauth_coverage(opts = {}) DB.extension :freeze_datasets, :date_arithmetic puts "using #{DB.database_type}" +if ENV['RODAUTH_SPEC_CI'] && DB.database_type == :postgres + DB.run "CREATE EXTENSION citext" + DB.run "CREATE EXTENSION pg_crypto" if ENV['RODAUTH_SPEC_UUID'] +end + DB.loggers << Logger.new($stdout) if ENV['LOG_SQL'] if DB.adapter_scheme == :jdbc case DB.database_type