From 83e1a42a4153adfcfebb6791aeba3d1e340a400e Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 11:26:41 +0200 Subject: [PATCH 01/20] Github actions --- .github/workflows/test.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..a6c9e176 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,12 @@ +name: Test +on: [push] +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - run: bundle exec rake + From 2858b7d90d855fa95dc745e136376b0f892065fd Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 11:39:25 +0200 Subject: [PATCH 02/20] Add Postgres service --- .github/workflows/test.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a6c9e176..c3b2a945 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,10 +3,17 @@ on: [push] jobs: tests: runs-on: ubuntu-latest + services: + postgres: + image: postgres:latest + ports: + - 5432:5432 + env: + POSTGRES_USER: <%= ENV['USER'] %> + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: bundler-cache: true - run: bundle exec rake - From aea9b822433ee5239c1691d0346bbc3214c5138f Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 11:41:31 +0200 Subject: [PATCH 03/20] Add postgres password --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c3b2a945..bb79ca03 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,7 @@ jobs: - 5432:5432 env: POSTGRES_USER: <%= ENV['USER'] %> + POSTGRES_PASSWORD: postgres options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - uses: actions/checkout@v4 From 9d9e6ee74fd1790a300d023229fe6af30cfa12c7 Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 11:42:50 +0200 Subject: [PATCH 04/20] Remove postgres user --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bb79ca03..1ace57bb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,6 @@ jobs: ports: - 5432:5432 env: - POSTGRES_USER: <%= ENV['USER'] %> POSTGRES_PASSWORD: postgres options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: From f2ed9af6c7e4273915e62fc679efc0cc4045a46e Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 11:53:57 +0200 Subject: [PATCH 05/20] Add pg password in database.yml --- config/database.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/config/database.yml b/config/database.yml index 74b4976a..ed2cd96e 100644 --- a/config/database.yml +++ b/config/database.yml @@ -5,6 +5,7 @@ defaults: &defaults min_messages: warning host: localhost username: <%= ENV['USER'] %> + password: postgres development: <<: *defaults From d1c96cc2fc7139f63cf81f321b1cc23259b72d32 Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 11:55:57 +0200 Subject: [PATCH 06/20] runner user for Github actions pg --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1ace57bb..2a879a25 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,7 @@ jobs: 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: From 2ecb087413f70e15651b7491a5318f281024333d Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 11:59:07 +0200 Subject: [PATCH 07/20] rails db:setup before tests --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2a879a25..2785eaf7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,4 +17,6 @@ jobs: - uses: ruby/setup-ruby@v1 with: bundler-cache: true - - run: bundle exec rake + - run: | + bundle exec rails db:setup + bundle exec rake From 976a8d5ed838d12cd193db3cc5106df7c01e2167 Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 12:00:46 +0200 Subject: [PATCH 08/20] Fix yml? --- .github/workflows/test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2785eaf7..e2d21733 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,4 @@ jobs: - uses: ruby/setup-ruby@v1 with: bundler-cache: true - - run: | - bundle exec rails db:setup - bundle exec rake + - run: bundle exec rails db:setup && bundle exec rake From 121ebf6101bfddb33a0a76e416891e30fe7e527f Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 12:05:29 +0200 Subject: [PATCH 09/20] Fix --- test/test_database_schema.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/test/test_database_schema.rb b/test/test_database_schema.rb index d0164aef..c56c6ee9 100644 --- a/test/test_database_schema.rb +++ b/test/test_database_schema.rb @@ -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[:host]}/#{conn_spec[:database]}" ActiveRecord::Base.establish_connection Rails.configuration.test_database_conn_spec ActiveRecord::Schema.verbose = false From 4550f2740c34e4889645525d33cba804d9e72286 Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 19:11:40 +0200 Subject: [PATCH 10/20] More test DB connection fixing --- test/test_database_schema.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_database_schema.rb b/test/test_database_schema.rb index c56c6ee9..cfd8130f 100644 --- a/test/test_database_schema.rb +++ b/test/test_database_schema.rb @@ -2,7 +2,7 @@ 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 = - "#{conn_spec[:adapter]}://#{conn_spec[:username]}@#{conn_spec[:host]}/#{conn_spec[:database]}" + "#{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 From 76972e3b1cce39bfb9ac57de5e6938d955e7cc9e Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 19:17:00 +0200 Subject: [PATCH 11/20] Add redis service for Github Actions --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e2d21733..fde1fb29 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,13 @@ jobs: tests: runs-on: ubuntu-latest services: + redis: + image: redis + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 postgres: image: postgres:latest ports: From 893c61f718af0e3e4dd69190267b4ff1fee8f9fa Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 19:41:31 +0200 Subject: [PATCH 12/20] Map ports for Redis service --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fde1fb29..bbd49d29 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,8 @@ jobs: services: redis: image: redis + ports: + - 6379:6379 options: >- --health-cmd "redis-cli ping" --health-interval 10s From 1bc6bc612971701ff8233393f1794170197fc6fc Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 19:58:32 +0200 Subject: [PATCH 13/20] Assets --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bbd49d29..72e8f6a7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,6 +24,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 + - uses: actions/setup-node@v3 with: bundler-cache: true + - run: yarn install && bin/rake assets:precompile - run: bundle exec rails db:setup && bundle exec rake From f1e9ff8d70a64074ee361c74102f2104210a6f1f Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 19:59:42 +0200 Subject: [PATCH 14/20] Fix --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 72e8f6a7..877d0cce 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,8 +24,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 - - uses: actions/setup-node@v3 with: bundler-cache: true + - uses: actions/setup-node@v3 - run: yarn install && bin/rake assets:precompile - run: bundle exec rails db:setup && bundle exec rake From 4f1952bae4bd9768ec22d3d3e70b20630ca91962 Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 20:01:17 +0200 Subject: [PATCH 15/20] Fix --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 877d0cce..f07fd7bc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,10 +22,10 @@ jobs: POSTGRES_PASSWORD: postgres options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: + - uses: actions/setup-node@v3 + - run: yarn install - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: bundler-cache: true - - uses: actions/setup-node@v3 - - run: yarn install && bin/rake assets:precompile - - run: bundle exec rails db:setup && bundle exec rake + - run: bundle exec rails db:setup && bin/rake assets:precompile && bundle exec rake From 5668a6be0499cb59f210213b1ad3845be17dd4fc Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 20:02:34 +0200 Subject: [PATCH 16/20] More fixing --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f07fd7bc..e59bfcc6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,4 +28,4 @@ jobs: - uses: ruby/setup-ruby@v1 with: bundler-cache: true - - run: bundle exec rails db:setup && bin/rake assets:precompile && bundle exec rake + - run: bundle exec rails db:setup && bundle exec rake assets:precompile && bundle exec rake From 027efe45bb686d80f1a949fa5bbb1735b15892f6 Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 20:37:21 +0200 Subject: [PATCH 17/20] Argos --- .github/workflows/test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e59bfcc6..51edb5e2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,10 +22,13 @@ jobs: POSTGRES_PASSWORD: postgres options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - uses: actions/setup-node@v3 - - run: yarn install - 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: argos upload tmp/capybara From ccffdccf4cfb3ba75b7225637f38ef85f6d994f9 Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 20:37:52 +0200 Subject: [PATCH 18/20] Fix yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51edb5e2..d027a58f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v3 - run: yarn install + - run: yarn install - uses: ruby/setup-ruby@v1 with: bundler-cache: true From 77c9ba4710262ab9106e31050b18875e4daf384d Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 20:41:48 +0200 Subject: [PATCH 19/20] Fix Argos command hopefully --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d027a58f..23f9f15e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,4 +31,4 @@ jobs: - 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: argos upload tmp/capybara + run: yarn exec argos upload tmp/capybara From 1b99df168989e54dcd44b792774ca6e4cbdaba21 Mon Sep 17 00:00:00 2001 From: Ivan Schneider Date: Thu, 19 Oct 2023 20:51:46 +0200 Subject: [PATCH 20/20] Remove Heroku CI setup --- app.json | 17 ----------------- ci.sh | 12 ------------ 2 files changed, 29 deletions(-) delete mode 100755 ci.sh diff --git a/app.json b/app.json index c7474659..d223ef9a 100644 --- a/app.json +++ b/app.json @@ -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" - } - } } } diff --git a/ci.sh b/ci.sh deleted file mode 100755 index e30a8b0c..00000000 --- a/ci.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -exit_status=0 - -vendor/bundle/bin/rake test || exit_status=1 - -argos upload tmp/capybara --token $ARGOS_TOKEN \ ---reference-branch $HEROKU_TEST_RUN_BRANCH --reference-commit $HEROKU_TEST_RUN_COMMIT_VERSION - -curl --request PATCH "${REMOTE_REPORTER_URL}/${HEROKU_TEST_RUN_ID}?node_total=${CI_NODE_TOTAL}" - -exit $exit_status