diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f09d2e8..11b9075 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,17 +1,12 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby - -name: CI +name: build on: push: branches: [main] pull_request: - branches: [main] + branches: "*" jobs: style: @@ -24,3 +19,97 @@ jobs: ruby-version: "2.7" bundler-cache: true - run: bundle exec standardrb --format github + + test-mysql: + name: Tests (MySQL) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby-version: [2.7, jruby-9.4] + + services: + mysql: + image: mysql:5.7 + ports: + - 3306 + env: + JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" + MYSQL_USER: root + MYSQL_PASSWORD: root + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Setup database + run: | + sudo service mysql start + - name: Run tests + run: | + bundle exec rake test:mysql2 + + test-pgsql: + name: Tests (Postgres) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby-version: [2.7, jruby-9.4] + + services: + postgres: + image: postgres:11 + env: + POSTGRES_PASSWORD: postgres + POSTGRES_HOST_AUTH_METHOD: trust + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + env: + JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" + PGHOST: localhost + PGPORT: 5432 + PGUSER: postgres + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Setup database + env: + PGPASSWORD: postgres + run: | + createdb spectacles_test + - name: Run tests + run: | + bundle exec rake test:postgresql + + test-sqlite: + name: Tests (SQLite) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby-version: [2.7, jruby-9.4] + + env: + JRUBY_OPTS: "-J-Xms64M -J-Xmx1024M" + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: | + bundle exec rake test:sqlite3 diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml deleted file mode 100644 index 51e7310..0000000 --- a/.github/workflows/ruby.yml +++ /dev/null @@ -1,60 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# GitHub recommends pinning actions to a commit SHA. -# To get a newer version, you will need to update the SHA. -# You can also reference a tag or branch, but the action may change without warning. - -name: Ruby CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - test_jruby_93: - runs-on: ubuntu-latest - - strategy: - matrix: - ruby-version: ['jruby-9.3','jruby-9.4','2.7','3.0','3.1'] - rails-version: ['rails-61'] - steps: - - uses: actions/checkout@v4 - - name: Set up Ruby ${{ matrix.ruby-version }} - uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1 - with: - ruby-version: ${{ matrix.ruby-version }} - - name: Install dependencies - run: bundle install - - name: Generate gemfiles - run: bundle exec appraisal clean && bundle exec appraisal generate - - name: Install from appraisal gemfile - run: bundle exec appraisal ${{ matrix.rails-version }} bundle install --jobs=2 --retry=3 - - name: Run tests - run: bundle exec appraisal ${{ matrix.rails-version }} bundle exec rake - test: - runs-on: ubuntu-latest - - strategy: - matrix: - ruby-version: ['jruby-9.4','3.0','3.1'] - rails-version: ['rails-61','rails-70'] - steps: - - uses: actions/checkout@v4 - - name: Set up Ruby ${{ matrix.ruby-version }} - uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1 - with: - ruby-version: ${{ matrix.ruby-version }} - - name: Install dependencies - run: bundle install - - name: Generate gemfiles - run: bundle exec appraisal clean && bundle exec appraisal generate - - name: Install from appraisal gemfile - run: bundle exec appraisal ${{ matrix.rails-version }} bundle install --jobs=2 --retry=3 - - name: Run tests - run: bundle exec appraisal ${{ matrix.rails-version }} bundle exec rake diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 342cfde..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: ruby -jdk: - - openjdk8 -rvm: - - 2.2 - - 2.3 - - 2.4 - - 2.5 - - 2.6 - - 2.7 - - jruby -cache: bundler -services: - - mysql - - postgresql diff --git a/Appraisals b/Appraisals deleted file mode 100644 index da8f080..0000000 --- a/Appraisals +++ /dev/null @@ -1,17 +0,0 @@ -appraise "rails-61" do - gem "activerecord", "~> 6.1", "< 6.2" - gem "protobuf-activerecord", ">= 6.1" - platforms :jruby do - gem "activerecord-jdbcpostgresql-adapter", ">= 61", "< 62" - gem "activerecord-jdbcsqlite3-adapter", ">= 61", "< 62" - end -end - -appraise "rails-70" do - gem "activerecord", "~> 7.0", "< 7.1" - gem "protobuf-activerecord", ">= 7.0" - platforms :jruby do - gem "activerecord-jdbcpostgresql-adapter", ">= 70", "< 72" - gem "activerecord-jdbcsqlite3-adapter", ">= 70", "< 72" - end -end diff --git a/lib/spectacles/schema_statements/postgresql_adapter.rb b/lib/spectacles/schema_statements/postgresql_adapter.rb index ea707b9..b95a47d 100644 --- a/lib/spectacles/schema_statements/postgresql_adapter.rb +++ b/lib/spectacles/schema_statements/postgresql_adapter.rb @@ -11,6 +11,7 @@ def views(name = nil) # :nodoc: FROM information_schema.views AS t INNER JOIN pg_class AS c ON c.relname = t.table_name AND c.relnamespace = to_regnamespace(t.table_schema)::oid WHERE t.table_schema = ANY(current_schemas(true)) + AND table_schema NOT IN ('information_schema', 'pg_catalog') AND pg_catalog.pg_get_userbyid(c.relowner) = #{quote(database_username)} SQL diff --git a/specs/adapters/mysql2_adapter_spec.rb b/specs/adapters/mysql2_adapter_spec.rb index d7a9b82..08d23ea 100644 --- a/specs/adapters/mysql2_adapter_spec.rb +++ b/specs/adapters/mysql2_adapter_spec.rb @@ -8,6 +8,11 @@ password: ENV["MYSQL_PASSWORD"] } + if defined? JRUBY_VERSION + config[:properties] ||= {} + config[:properties]["allowPublicKeyRetrieval"] = true + end + configure_database(config) recreate_database("spectacles_test") load_schema