Restore local CI, sensible setup for open source users
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
GIT
|
||||
remote: https://github.com/basecamp/fizzy-saas
|
||||
revision: f251028405bd0ba586fe836d1a8c56428b8abff0
|
||||
revision: 720bedaf37faf8dff18c9586e1fa7031bad1d2a9
|
||||
specs:
|
||||
fizzy-saas (0.1.0)
|
||||
queenbee
|
||||
|
||||
@@ -82,16 +82,46 @@ step "Installing RubyGems" bundle install
|
||||
if [ -n "$SAAS" ]; then
|
||||
saas_setup=$(bundle show fizzy-saas)/bin/setup
|
||||
source "$saas_setup"
|
||||
else
|
||||
if ! nc -z localhost 3306 2>/dev/null; then
|
||||
if docker ps -aq -f name=fizzy-mysql | grep -q .; then
|
||||
step "Starting MySQL" docker start fizzy-mysql
|
||||
else
|
||||
step "Setting up MySQL" bash -c '
|
||||
docker pull mysql:8.4
|
||||
docker run -d \
|
||||
--name fizzy-mysql \
|
||||
-e MYSQL_ALLOW_EMPTY_PASSWORD=yes \
|
||||
-p 3306:3306 \
|
||||
mysql:8.4
|
||||
echo "MySQL is starting… (it may take a few seconds)"
|
||||
'
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $* == *--reset* ]]; then
|
||||
step "Resetting the database" rails db:reset
|
||||
else
|
||||
step "Preparing the database" rails db:prepare
|
||||
if [ -n "$SAAS" ]; then
|
||||
if [[ $* == *--reset* ]]; then
|
||||
step "Resetting the database" rails db:reset
|
||||
else
|
||||
step "Preparing the database" rails db:prepare
|
||||
|
||||
if needs_seeding; then
|
||||
step "Seeding the database" rails db:seed
|
||||
if needs_seeding; then
|
||||
step "Seeding the database" rails db:seed
|
||||
fi
|
||||
fi
|
||||
else
|
||||
for adapter in sqlite mysql; do
|
||||
if [[ $* == *--reset* ]]; then
|
||||
step "Resetting the database ($adapter)" env DATABASE_ADAPTER=$adapter rails db:reset
|
||||
else
|
||||
step "Preparing the database ($adapter)" env DATABASE_ADAPTER=$adapter rails db:prepare
|
||||
|
||||
if needs_seeding; then
|
||||
step "Seeding the database ($adapter)" env DATABASE_ADAPTER=$adapter rails db:seed
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
step "Cleaning up logs and tempfiles" rails log:clear tmp:clear
|
||||
|
||||
+9
-4
@@ -7,12 +7,17 @@ CI.run do
|
||||
|
||||
step "Style: Ruby", "bin/rubocop"
|
||||
|
||||
step "Security: Gem audit", "bin/bundler-audit check --update"
|
||||
step "Security: Gem audit", "bin/bundler-audit check --update"
|
||||
step "Security: Importmap audit", "bin/importmap audit"
|
||||
step "Security: Brakeman audit", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error"
|
||||
step "Security: Brakeman audit", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error"
|
||||
|
||||
if Fizzy.saas?
|
||||
step "Tests: SaaS", "SAAS=true BUNDLE_GEMFILE=Gemfile.saas bin/rails test:all"
|
||||
else
|
||||
step "Tests: MySQL", "SAAS=false BUNDLE_GEMFILE=Gemfile DATABASE_ADAPTER=mysql bin/rails test:all"
|
||||
step "Tests: SQLite", "SAAS=false BUNDLE_GEMFILE=Gemfile DATABASE_ADAPTER=sqlite bin/rails test:all"
|
||||
end
|
||||
|
||||
step "Tests: Open source", "bin/rails test"
|
||||
step "Tests: System", "bin/rails test:system"
|
||||
|
||||
if success?
|
||||
step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ module Fizzy
|
||||
class << self
|
||||
def saas?
|
||||
return @saas if defined?(@saas)
|
||||
@saas = !!(ENV["SAAS"] || File.exist?(File.expand_path("../tmp/saas.txt", __dir__)))
|
||||
@saas = !!(((ENV["SAAS"] || File.exist?(File.expand_path("../tmp/saas.txt", __dir__))) && ENV["SAAS"] != "false"))
|
||||
end
|
||||
|
||||
def db_adapter
|
||||
|
||||
Reference in New Issue
Block a user