Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI with GitHub actions #719

Merged
merged 20 commits into from
Oct 19, 2023
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test
on: [push]
jobs:
tests:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_USER: runner
POSTGRES_PASSWORD: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- run: yarn install
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bundle exec rails db:setup && bundle exec rake assets:precompile && bundle exec rake
- name: Upload screenshots to argos-ci.com
continue-on-error: true
run: yarn exec argos upload tmp/capybara
17 changes: 0 additions & 17 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,5 @@
"stack": "heroku-20",
"scripts": {
"postdeploy": "bundle exec rake db:schema:load"
},
"environments": {
"test": {
"addons": ["heroku-redis:in-dyno", "heroku-postgresql:in-dyno"],
"buildpacks": [
{ "url": "heroku/ruby" },
{ "url": "heroku/nodejs" },
{ "url": "heroku/google-chrome" }
],
"env": {
"DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL": true,
"REMOTE_REPORTER_URL": "http://test-failures.herokuapp.com/867a5de4a32757d08569575eaf78ab"
},
"scripts": {
"test": "./ci.sh"
}
}
}
}
12 changes: 0 additions & 12 deletions ci.sh

This file was deleted.

1 change: 1 addition & 0 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ defaults: &defaults
min_messages: warning
host: localhost
username: <%= ENV['USER'] %>
password: postgres

development:
<<: *defaults
Expand Down
12 changes: 3 additions & 9 deletions test/test_database_schema.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
test_adapter = ENV['adapter'] || ENV['ADAPTER'] || 'postgres'
ActiveRecord::Base.connection.execute 'create database "adminium-fixture"' if ENV['CI']
conn_spec = ActiveRecord::Base.configurations.find_db_config("fixture-#{test_adapter}").configuration_hash
Rails.configuration.test_database_conn_spec =
if ENV['CI']
ActiveRecord::Base.connection.execute 'create database "adminium-fixture"'
conn_spec = ENV['DATABASE_URL'].split('/')
conn_spec[-1] = 'adminium-fixture'
conn_spec.join('/')
else
conn_spec = ActiveRecord::Base.configurations.find_db_config("fixture-#{test_adapter}").configuration_hash
"#{conn_spec[:adapter]}://#{conn_spec[:username]}@#{conn_spec[:host]}/#{conn_spec[:database]}"
end
"#{conn_spec[:adapter]}://#{conn_spec[:username]}:#{conn_spec[:password]}@#{conn_spec[:host]}/#{conn_spec[:database]}"

ActiveRecord::Base.establish_connection Rails.configuration.test_database_conn_spec
ActiveRecord::Schema.verbose = false
Expand Down