diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..ea72ee8 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,56 @@ +name: CI +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:11-alpine + ports: + - 5432:5432 + env: + POSTGRES_PASSWORD: mysecretpassword + + steps: + - uses: actions/checkout@v2 + + - name: Set up Ruby 2.6 + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6.6 + + - name: Cache Ruby gems + uses: actions/cache@v2 + with: + path: vendor/bundle + key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} + restore-keys: | + ${{ runner.os }}-gem- + - name: Bundle gems + run: | + bundle config path vendor/bundle + bundle config set without 'production development' + bundle install --jobs 4 --retry 3 + - name: Lint with RuboCop + run: bundle exec rubocop --parallel + + - name: Get yarn cache + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Run Tests + env: + RAILS_ENV: test + DB_PASSWORD: mysecretpassword + run: | + bundle exec rails db:create + bundle exec rails test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cbb80d3..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: ruby -sudo: required -dist: xenial - -services: - - postgresql - -rvm: - - 2.5 - -cache: bundler -bundler_args: --without development production --jobs=3 --retry=3 -before_install: - - gem install bundler:2.0.2 - -before_script: - - RAILS_ENV=test bundle exec rails db:create - -script: - - bundle exec rails test - - bundle exec rubocop diff --git a/README.md b/README.md index ea9b605..cfc37f6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ + +[![Github Build Status](https://github.com/ualbertalib/oaisys/workflows/CI/badge.svg)](https://github.com/ualbertalib/oaisys/actions) + # Oaisys Short description and motivation. diff --git a/test/dummy/config/database.yml b/test/dummy/config/database.yml index 92d2ce2..695ab9a 100644 --- a/test/dummy/config/database.yml +++ b/test/dummy/config/database.yml @@ -17,6 +17,9 @@ default: &default adapter: postgresql encoding: unicode + username: <%= ENV['DB_USER'] || 'postgres' %> + password: <%= ENV['DB_PASSWORD'] || 'mysecretpassword' %> + host: <%= ENV['DB_HOST'] || 'localhost' %> # For details on connection pooling, see Rails configuration guide # http://guides.rubyonrails.org/configuring.html#database-pooling pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>