# Run using bin/ci

CI.run do

step "Setup", "bin/setup --skip-server"

<% unless options.skip_rubocop? %>

step "Style: Ruby", "bin/rubocop"

<% end -%>

<% unless options.skip_bundler_audit? -%>

step "Security: Gem audit", "bin/bundler-audit"

<% end -%> <% if using_node? -%>

step "Security: Yarn vulnerability audit", "yarn audit"

<% end -%> <% if using_importmap? -%>

step "Security: Importmap vulnerability audit", "bin/importmap audit"

<% end -%> <% unless options.skip_brakeman? -%>

step "Security: Brakeman code analysis", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error"

<% end -%> <% unless options -%>

step "Tests: Rails", "bin/rails test"

<% unless options.skip_active_record? -%>

step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant"

<% end -%> <% end -%>

<% unless options -%>

# Optional: Run system tests
# step "Tests: System", "bin/rails test:system"

<% end -%>

# Optional: set a green GitHub commit status to unblock PR merge.
# Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`.
# if success?
#   step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff"
# else
#   failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again."
# end

end