diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..be66fa6e67 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,53 @@ +name: CI + +on: [push] + +jobs: + test: + strategy: + matrix: + database: [ mysql, postgresql ] + extension: [ core, dragonfly, images, pages, resources ] + ruby: [ "2.7.x", "2.6.x" ] + fail-fast: false + max-parallel: 10 + runs-on: ubuntu-latest + + env: + BUNDLE_JOBS: 4 + BUNDLE_PATH: vendor/bundle + CI: true + DB: ${{ matrix.database }} + MYSQL_PASSWORD: root + PGHOST: localhost + PGUSER: postgres + RAILS_ENV: test + + name: ${{ matrix.extension }} ${{ matrix.ruby }} ${{ matrix.database }} + steps: + - uses: actions/setup-ruby@v1.0.0 + with: + version: ${{ matrix.ruby }} + - uses: actions/checkout@v2 + - run: sudo apt-get update && sudo apt-get install libpq-dev libmysqlclient-dev libsqlite3-dev -y + - run: sudo systemctl start mysql.service + - id: cache-bundler + uses: actions/cache@v2 + with: + path: vendor/bundle + key: ${{ matrix.ruby }}-gem-${{ matrix.database }}-${{ hashFiles('Gemfile') }} + - run: bundle install --without development --path vendor/bundle + - run: bin/rake refinery:testing:dummy_app + env: + PGPORT: ${{ job.services.postgres.ports[5432] }} + + - run: bin/rspec ${{ matrix.extension }}/spec + env: + PGPORT: ${{ job.services.postgres.ports[5432] }} + RETRY_COUNT: 3 + + services: + postgres: + image: postgres:11.5 + ports: ["5432:5432"] + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7effb4bab6..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -language: ruby -dist: bionic -sudo: false -branches: - only: - - master -addons: - postgresql: '10' -services: - - mysql -cache: - bundler: true - directories: - - /home/travis/.webdrivers/ -before_install: - - gem update bundler -bundler_args: --without development -before_script: - - export RETRY_COUNT=3 - - bin/rake refinery:testing:dummy_app -script: - - bin/rspec $EXTENSION/spec -env: - - DB=postgresql EXTENSION=core - - DB=postgresql EXTENSION=dragonfly - - DB=postgresql EXTENSION=pages - - DB=postgresql EXTENSION=images - - DB=postgresql EXTENSION=resources - - DB=mysql EXTENSION=core - - DB=mysql EXTENSION=dragonfly - - DB=mysql EXTENSION=pages - - DB=mysql EXTENSION=images - - DB=mysql EXTENSION=resources -notifications: - email: true - webhooks: - - https://webhooks.gitter.im/e/b5d48907cdc89864b874 -rvm: - - 2.6 - - 2.5 diff --git a/Gemfile b/Gemfile index 20880a9fc0..2c13a9b35e 100644 --- a/Gemfile +++ b/Gemfile @@ -9,11 +9,6 @@ path "./" do gem "refinerycms-resources" end -gem 'bootsnap', require: false -gem 'listen' - -gem 'activejob' - # Add support for refinerycms-acts-as-indexed gem 'refinerycms-acts-as-indexed', ['~> 3.0', '>= 3.0.0'] @@ -21,25 +16,31 @@ gem 'refinerycms-acts-as-indexed', ['~> 3.0', '>= 3.0.0'] gem 'refinerycms-wymeditor', ['~> 2.2', '>= 2.2.0'] # Database Configuration -unless ENV['TRAVIS'] +unless ENV['CI'] gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0.rc1', platform: :jruby gem 'sqlite3', platform: :ruby end -if !ENV['TRAVIS'] || ENV['DB'] == 'mysql' +if !ENV['CI'] || ENV['DB'] == 'mysql' group :mysql do gem 'activerecord-jdbcmysql-adapter', '>= 1.3.0.rc1', platform: :jruby gem 'mysql2', '~> 0.4', :platform => :ruby end end -if !ENV['TRAVIS'] || ENV['DB'] == 'postgresql' +if !ENV['CI'] || ENV['DB'] == 'postgresql' group :postgres, :postgresql do gem 'activerecord-jdbcpostgresql-adapter', '>= 1.3.0.rc1', platform: :jruby gem 'pg', '~> 0.21', platform: :ruby end end +group :development, :test do + gem 'activejob' + gem 'bootsnap', require: false + gem 'listen', '~> 3.0' +end + group :test do gem 'refinerycms-testing', path: './testing' gem 'generator_spec', '~> 0.9.3' diff --git a/core/lib/generators/refinery/cms/templates/config/database.yml.mysql b/core/lib/generators/refinery/cms/templates/config/database.mysql.yml similarity index 100% rename from core/lib/generators/refinery/cms/templates/config/database.yml.mysql rename to core/lib/generators/refinery/cms/templates/config/database.mysql.yml diff --git a/core/lib/generators/refinery/cms/templates/config/database.yml.postgresql b/core/lib/generators/refinery/cms/templates/config/database.postgresql.yml similarity index 100% rename from core/lib/generators/refinery/cms/templates/config/database.yml.postgresql rename to core/lib/generators/refinery/cms/templates/config/database.postgresql.yml diff --git a/core/lib/generators/refinery/cms/templates/config/database.yml.sqlite3 b/core/lib/generators/refinery/cms/templates/config/database.sqlite3.yml similarity index 100% rename from core/lib/generators/refinery/cms/templates/config/database.yml.sqlite3 rename to core/lib/generators/refinery/cms/templates/config/database.sqlite3.yml diff --git a/core/lib/generators/refinery/dummy/templates/rails/database.yml b/core/lib/generators/refinery/dummy/templates/rails/database.yml index f09bb1daa8..88a6ac3e2f 100644 --- a/core/lib/generators/refinery/dummy/templates/rails/database.yml +++ b/core/lib/generators/refinery/dummy/templates/rails/database.yml @@ -5,7 +5,7 @@ login: &login reconnect: false pool: 5 username: root - password: + password: <%%= ENV['MYSQL_PASSWORD'] %> #socket: /tmp/mysql.sock <% elsif /postgresql/ === @database %> adapter: postgresql @@ -31,4 +31,4 @@ test: production: <<: *login - database: dummy_prod \ No newline at end of file + database: dummy_prod diff --git a/core/spec/lib/generators/refinery/cms/cms_generator_spec.rb b/core/spec/lib/generators/refinery/cms/cms_generator_spec.rb index 05b435b915..7c29c6ba89 100644 --- a/core/spec/lib/generators/refinery/cms/cms_generator_spec.rb +++ b/core/spec/lib/generators/refinery/cms/cms_generator_spec.rb @@ -57,9 +57,9 @@ module Refinery end end directory "config" do - file "database.yml.mysql" - file "database.yml.postgresql" - file "database.yml.sqlite3" + file "database.mysql.yml" + file "database.postgresql.yml" + file "database.sqlite3.yml" end } end