Skip to content

Commit

Permalink
Merge pull request #45 from atomicjolt/ds/multi-tenancy
Browse files Browse the repository at this point in the history
Add models and helpers for multi tenancy
  • Loading branch information
jbasdf authored Nov 25, 2024
2 parents 192b1e6 + 1ad652f commit cf5c7fb
Show file tree
Hide file tree
Showing 44 changed files with 1,508 additions and 192 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/github-actions-ci-brakeman.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: brakeman

on:
push:
branches: [ main ]
pull_request:
branches:
- '*'

jobs:
brakeman:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Security audit application code
run: bundle exec brakeman -q -w2
42 changes: 42 additions & 0 deletions .github/workflows/github-actions-ci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on: [pull_request]

name: Pronto

jobs:
linters:
name: Linters
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: [3.3]
steps:
- name: Checkout code
uses: actions/checkout@v2

- run: |
git fetch --no-tags --prune --depth=10 origin +refs/heads/*:refs/remotes/origin/*
- name: Setup Ruby
uses: ruby/setup-ruby@v1

- name: Ruby gem cache
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Setup pronto
run: gem install pronto pronto-rubocop

- name: Install gems
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run Pronto
run: bundle exec pronto run -f github_status github_pr -c origin/${{ github.base_ref }}
env:
PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
PRONTO_GITHUB_ACCESS_TOKEN: "${{ github.token }}"
66 changes: 66 additions & 0 deletions .github/workflows/github-actions-ci-rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: rspec

on: pull_request

jobs:
rspec-test:

runs-on: ubuntu-latest

strategy:
matrix:
ruby-version: [3.3]

# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:13.8
# Provide the password for postgres
env:
POSTGRES_DB: postgres_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports: ["5432:5432"]
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v2

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

- name: Install dependencies
env:
RAILS_ENV: test
RAILS_GROUPS: build
run: |
bundle install
- name: Copy database config yml
run: cp test/dummy/config/ci.database.yml test/dummy/config/database.yml

- name: Create db
env:
RAILS_ENV: test
run: bin/rails db:create

- name: Run migrations
env:
RAILS_ENV: test
run: bin/rails db:migrate

- name: Run tests
env:
RAILS_ENV: test
run: bundle exec rspec
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
/test/dummy/log/*.log
/test/dummy/storage/
/test/dummy/tmp/
/test/dummy/db/schema.rb
/test/dummy/db/*structure.sql
.vscode
/vendor
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.3.5
29 changes: 29 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,32 @@ gem 'sprockets-rails'

# Start debugger with binding.b [https://github.com/ruby/debug]
# gem "debug", ">= 1.0.0"

group :development, :test, :linter do
gem "byebug"
gem "factory_bot_rails"
gem "ims-lti"
gem "rubocop"
gem "rubocop-performance"
gem "rubocop-rails"
gem "rubocop-rspec"
gem "webmock"
end

group :test do
gem "launchy"
gem "rspec"
gem "rspec-rails", "~>7.0"

gem "jwt", "~>2.7.0"
gem "json-jwt"
gem "httparty"
gem "database_cleaner"
gem "atomic_lti"
end

group :ci do
gem "brakeman"
gem "pronto"
gem "pronto-rubocop", require: false
end
Loading

0 comments on commit cf5c7fb

Please sign in to comment.