Skip to content

Commit

Permalink
Merge pull request #9 from tamu-edu-students/integration
Browse files Browse the repository at this point in the history
Sprint 1 MVP: Working Version
  • Loading branch information
kushalnl7 authored Oct 4, 2024
2 parents ebedbca + 44a1834 commit f3e1b68
Show file tree
Hide file tree
Showing 128 changed files with 8,910 additions and 65 deletions.
Binary file modified .DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: 2
engines:
rubocop:
enabled: true
channel: rubygems
81 changes: 76 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: CI
on:
pull_request:
push:
branches: [ main ]

jobs:
scan_ruby:
Expand Down Expand Up @@ -51,7 +50,18 @@ jobs:
bundler-cache: true

- name: Lint code for consistent style
run: bin/rubocop -f github
run: |
bin/rubocop --format json --out rubocop_output.json
offenses_per_file=$(jq '.files[] | {path, offenses: (.offenses | length)} | select(.offenses > 1)' rubocop_output.json)
if [[ -n "$offenses_per_file" ]]; then
echo "There are files with more than 1 offense:"
echo "$offenses_per_file"
exit 1
else
echo "All files have 1 or fewer offenses."
fi
test:
runs-on: ubuntu-latest
Expand All @@ -75,11 +85,40 @@ jobs:
ruby-version: .ruby-version
bundler-cache: true

# - name: Run tests
# env:
# RAILS_ENV: test
- name: Install bundler
run: gem install bundler

- name: Install dependencies
run: |
bundle install
- name: Run database migrations
run: bin/rails db:migrate RAILS_ENV=test

- name: Prepare the test database
run: bin/rails db:test:prepare

- name: Debug installed gems
run: |
bundle exec gem list
- name: Run tests
env:
RAILS_ENV: test
# REDIS_URL: redis://localhost:6379/0
# run: bin/rails db:test:prepare test test:system
run: |
bundle exec rails test
- name: Check test coverage
run: |
covered_percent=$(ruby -r simplecov -e "puts SimpleCov.result.covered_percent")
if (( $(echo "$covered_percent < 90" | bc -l) )); then
echo "Code coverage is below 90%: $covered_percent%"
exit 1
else
echo "Code coverage is sufficient: $covered_percent%"
fi
- name: Keep screenshots from failed system tests
uses: actions/upload-artifact@v4
Expand All @@ -88,3 +127,35 @@ jobs:
name: screenshots
path: ${{ github.workspace }}/tmp/screenshots
if-no-files-found: ignore

cucumber_coverage:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true

- name: Install dependencies
run: bundle install

- name: Run Cucumber tests with coverage
run: |
bundle exec cucumber --format pretty --format html --out cucumber_report.html
if grep -q "coverage below" coverage/.last_run.json; then
echo "Test coverage is below the required threshold"
exit 1
else
echo "Test coverage meets the required threshold"
fi
- name: Upload Cucumber HTML Report
uses: actions/upload-artifact@v4
with:
name: cucumber-report
path: cucumber_report.html
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--require spec_helper
36 changes: 34 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ ruby "3.3.4"
gem "rails", "~> 7.2.1"
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem "sprockets-rails"
# Use sqlite3 as the database for Active Record
gem "sqlite3", ">= 1.4"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
Expand All @@ -18,6 +16,15 @@ gem "turbo-rails"
gem "stimulus-rails"
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
gem "jbuilder"

gem "warden"
gem "devise"

# omniauth for google login
gem "omniauth"
gem "omniauth-google-oauth2"
gem "omniauth-rails_csrf_protection"

# Use Redis adapter to run Action Cable in production
# gem "redis", ">= 4.0.1"

Expand All @@ -37,6 +44,9 @@ gem "bootsnap", require: false
# gem "image_processing", "~> 1.2"

group :development, :test do
# Use sqlite3 as the database for Active Record
gem "sqlite3", ">= 1.4"

# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"

Expand All @@ -45,15 +55,37 @@ group :development, :test do

# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
gem "rubocop-rails-omakase", require: false

gem "carrierwave", "~> 2.0"

gem "factory_bot_rails"
end

group :development do
# Use console on exceptions pages [https://github.com/rails/web-console]
gem "web-console"
gem "rubocop", require: false
gem "rubocop-performance", require: false
gem "rubocop-rails", require: false
gem "rubocop-rspec", require: false
gem "rubycritic", require: false
end

group :test do
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
gem "capybara"
gem "selenium-webdriver"
gem "cucumber-rails", require: false
gem "database_cleaner"
gem "rails-controller-testing"
gem "rspec-rails"
gem "simplecov", require: false
gem "ZenTest"
gem "warden"
gem "devise"
# gem "codeclimate-test-reporter", require: nil
end

group :production do
gem "pg" # for Heroku deployment
end
Loading

0 comments on commit f3e1b68

Please sign in to comment.