Skip to content

Instantly share code, notes, and snippets.

@jathayde
Created October 3, 2025 11:31
Show Gist options
  • Select an option

  • Save jathayde/476768e145644adaa84f1d503427fa77 to your computer and use it in GitHub Desktop.

Select an option

Save jathayde/476768e145644adaa84f1d503427fa77 to your computer and use it in GitHub Desktop.
bin/ci setup based on @gregmolnar's tweet, derived from concepts learned from David Bryant Copeland. You can swap out tooling here as needed (e.g. standardrb vs rubocop, test runner for rspec, other linters for import map audit if you're using node stuff, etc)
# bin/ci
#!/usr/bin/env bash
set -e
echo "=========================================="
echo "[ bin/ci ] Starting CI Pipeline"
echo "=========================================="
echo ""
# Step 1: Run full RSpec test suite
echo "[ bin/ci ] Running RSpec test suite..."
bin/rspec
echo "✓ Tests passed"
echo ""
# Step 2: Security audits
echo "[ bin/ci ] Running security audits..."
echo ""
echo "[ bin/ci ] Analyzing code for security vulnerabilities with Brakeman"
echo "[ bin/ci ] Output will be in tmp/brakeman.html"
bundle exec brakeman -q -o tmp/brakeman.html --no-exit-on-warn --no-exit-on-error
echo "✓ Brakeman scan complete"
echo ""
echo "[ bin/ci ] Checking Ruby gems for security vulnerabilities"
bundle exec bundle audit check --update
echo "✓ Bundle audit complete"
echo ""
echo "[ bin/ci ] Checking JavaScript dependencies for security vulnerabilities"
bin/importmap audit
echo "✓ Importmap audit complete"
echo ""
# Step 3: Code style (last, since it auto-fixes)
echo "[ bin/ci ] Running Rubocop with autofix enabled"
bundle exec rubocop --auto-correct
echo "✓ Rubocop complete"
echo ""
echo "=========================================="
echo "[ bin/ci ] ✓ All checks passed!"
echo "=========================================="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment