From 5e5ffcaafca7994c9a205af1fdb104c4d225de51 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Tue, 22 Oct 2019 14:02:13 +0200 Subject: [PATCH] Test with multiple databases on github actions ci --- .github/workflows/ci.yml | 51 ++++++++++++++++++++++------------ spec/dummy/config/database.yml | 2 +- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93c2fdb170..2df1206479 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,22 +10,37 @@ jobs: ruby: - '2.5.x' - '2.6.x' + database: + - mysql + - postgresql + env: + DB: ${{ matrix.database }} + MYSQL_PASSWORD: root + PGHOST: 127.0.0.1 + PGUSER: postgres + RAILS_ENV: test + services: + postgres: + image: postgres:10 + ports: ['5432:5432'] + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - uses: actions/checkout@v1 - - name: Setup SQlite3 - run: | - sudo apt-get install -y libsqlite3-dev - - name: Set up Ruby - uses: actions/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - name: Install bundle - run: | - gem install bundler - bundle install --jobs 4 --retry 3 - - name: Prepare database - run: | - bundle exec rake alchemy:spec:prepare - - name: Test with RSpec - run: | - bundle exec rspec + - uses: actions/checkout@v1 + - name: Set up Ruby + uses: actions/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Install Postgres headers + if: matrix.database == 'postgresql' + run: | + sudo apt install -yqq libpq-dev + - name: Install bundle + run: | + gem install bundler + bundle install --jobs 4 --retry 3 + - name: Prepare database + run: | + bundle exec rake alchemy:spec:prepare + - name: Test with RSpec + run: | + bundle exec rspec diff --git a/spec/dummy/config/database.yml b/spec/dummy/config/database.yml index 9223533ff0..b9af7934bf 100644 --- a/spec/dummy/config/database.yml +++ b/spec/dummy/config/database.yml @@ -6,7 +6,7 @@ mysql: &mysql adapter: mysql2 encoding: utf8mb4 username: root - password: + password: <%= ENV['MYSQL_PASSWORD'] %> database: alchemy_cms_dummy_<%= Rails.env %> postgresql: &postgresql