Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add models and helpers for multi tenancy #45

Merged
merged 23 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading