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 indexes for db performance #557

Merged
merged 25 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
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
43 changes: 21 additions & 22 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,37 +84,34 @@ jobs:

- name: Run Rspec Tests
run: |
mkdir -p tmp/parallel_runtime_rspec
rm -f tmp/parallel_runtime_rspec.log
if [ -f "tmp/parallel_runtime_rspec.log" ]; then
bundle exec parallel_rspec -n 4 --group-by runtime --only-group ${{ matrix.group }} --verbose
else
bundle exec parallel_rspec -n 4 --group-by filesize --only-group ${{ matrix.group }} --verbose
fi

env:
AUTH_SECRET: ${{ secrets.AUTH_SECRET}}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
RECORD_RUNTIME: "true"

- name: "Runtime cache: store chunk"
if: always() && steps.cache-restore.outputs.cache-hit != 'true' # Only save if cache was not hit
uses: actions/cache/save@v4
with:
key: runtime-cache-${{ matrix.group }}
path: tmp/parallel_runtime_rspec

- name: "Runtime cache: clear chunk"
- name: "Runtime cache: rename chunk"
if: always()
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete runtime-cache-${{ matrix.group }} --confirm || true
mkdir -p tmp/parallel_runtime_rspec
if [ -f "tmp/parallel_runtime_rspec.log" ]; then
echo "Renaming runtime log"
mkdir -p tmp/parallel_runtime_rspec
mv tmp/parallel_runtime_rspec.log tmp/parallel_runtime_rspec/${{ matrix.group }}.log
fi
- name: "Runtime cache: store chunk"
if: always() && steps.cache-restore.outputs.cache-hit != 'true' # Only save if cache was not hit
uses: actions/cache/save@v4
with:
key: runtime-cache-${{ matrix.group }}
path: tmp/parallel_runtime_rspec/${{ matrix.group }}.log

- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
Expand Down Expand Up @@ -154,41 +151,43 @@ jobs:
uses: actions/cache/restore@v4
with:
key: runtime-cache-1
path: tmp/parallel_runtime_rspec
path: tmp/parallel_runtime_rspec/1.log

- name: "Runtime cache: load chunk 2"
uses: actions/cache/restore@v4
with:
key: runtime-cache-2
path: tmp/parallel_runtime_rspec
path: tmp/parallel_runtime_rspec/2.log

- name: "Runtime cache: load chunk 3"
uses: actions/cache/restore@v4
with:
key: runtime-cache-3
path: tmp/parallel_runtime_rspec
path: tmp/parallel_runtime_rspec/3.log

- name: "Runtime cache: load chunk 4"
uses: actions/cache/restore@v4
with:
key: runtime-cache-4
path: tmp/parallel_runtime_rspec
path: tmp/parallel_runtime_rspec/4.log

- name: "Runtime cache: combine chunks"
run: |
mkdir -p tmp
if [ ! -f "tmp/parallel_runtime_rspec/1.log" ] || [ ! -f "tmp/parallel_runtime_rspec/2.log" ] || [ ! -f "tmp/parallel_runtime_rspec/3.log" ] || [ ! -f "tmp/parallel_runtime_rspec/4.log" ]; then
echo "Error: Missing runtime logs"
exit 1
fi
for i in 1 2 3 4; do
if [ ! -f "tmp/parallel_runtime_rspec/${i}.log" ]; then
echo "Error: Missing runtime log for chunk ${i}"
exit 1
fi
done
cat tmp/parallel_runtime_rspec/* > tmp/parallel_runtime_rspec.log
cat tmp/parallel_runtime_rspec.log

- name: "Runtime cache: clear"
env:
GH_TOKEN: ${{ github.token }}
run: |
gh extension install actions/gh-actions-cache
mkdir -p tmp/parallel_runtime_rspec
gh actions-cache delete runtime-cache-all --confirm
continue-on-error: true
- name: "Runtime cache: store"
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/spellcheck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Check spelling'
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
jobs:
spellcheck: # run the action
name: Spell Check
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: write # Allows the action to comment on PRs
steps:
- uses: actions/checkout@v4
- uses: streetsidesoftware/cspell-action@v6
with:
# Inline PR comments instead of annotations
inline: error
# Fail on warnings
strict: true
# Show progress
verbose: true
suggestions: true
18 changes: 9 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ruby "3.3.5"

# Rails framework
gem "active_model_serializers", "~> 0"
gem "bootsnap", ">= 1.4.4", require: false
gem "bootsnap", ">= 1", require: false
gem "rails", "~> 7.2"
gem "sprockets-rails"
gem "stimulus-rails", "~> 1"
Expand All @@ -20,10 +20,10 @@ gem "pundit"
gem "friendly_id"
gem "kaminari"
gem "kredis", "~> 1"
gem "pg", "~> 1.5.7"
gem "pg", "~> 1"

# API and Serialization
gem "json", "~> 2.7"
gem "json", "~> 2"
gem "jsonapi-serializer", "~> 2"
gem "rswag-api"
gem "rswag-ui"
Expand All @@ -33,19 +33,19 @@ gem "versionist", "~> 2"
gem "sidekiq", "~> 7"

# Security
gem "openssl", "~> 3.2"
gem "openssl", "~> 3"
gem "rack-attack", "~> 6"
gem "rack-cors", "~> 2"

# Utilities
gem "awesome_print"
gem "dotenv-rails"
gem "ostruct", "~> 0"
gem "parallel", "~> 1.26"
gem "parallel", "~> 1"
gem "retries"
gem "svix"
gem "typhoeus", "~> 1.4"
gem "uri", "~> 0.13.1"
gem "typhoeus", "~> 1"
gem "uri", "~> 1"

# Redis
gem "redis", "~> 5"
Expand All @@ -61,7 +61,7 @@ gem "traceroute", "~> 0"
gem "tzinfo-data", platforms: %i[windows jruby]

# Web Server
gem "puma", "~> 6.4"
gem "puma", "~> 6"

group :development do
gem "rails-erd"
Expand Down Expand Up @@ -91,7 +91,7 @@ group :development, :test do
gem "parallel_tests", "~> 4"
gem "rspec-json_expectations"
gem "rspec-rails"
gem "ruby-lsp-rails", "~> 0.3.15"
gem "ruby-lsp-rails", "~> 0.3"
gem "ruby-lsp-rspec"
gem "spring", "~> 4"
gem "webmock", "~> 3"
Expand Down
34 changes: 17 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ GEM
net-smtp
marcel (1.0.4)
mini_mime (1.1.5)
minitest (5.25.1)
minitest (5.25.2)
msgpack (1.7.5)
net-imap (0.5.1)
date
Expand Down Expand Up @@ -229,7 +229,7 @@ GEM
psych (5.2.0)
stringio
public_suffix (6.0.1)
puma (6.4.3)
puma (6.5.0)
nio4r (~> 2.0)
pundit (2.4.0)
activesupport (>= 3.0.0)
Expand Down Expand Up @@ -351,16 +351,16 @@ GEM
rswag-ui (2.16.0)
actionpack (>= 5.2, < 8.1)
railties (>= 5.2, < 8.1)
rubocop (1.68.0)
rubocop (1.69.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
rubocop-ast (>= 1.36.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.36.1)
parser (>= 3.3.1.0)
rubocop-checkstyle_formatter (0.6.0)
Expand Down Expand Up @@ -433,7 +433,7 @@ GEM
bundler-audit (~> 0.9.0)
rubyzip (2.3.2)
securerandom (0.3.2)
selenium-webdriver (4.26.0)
selenium-webdriver (4.27.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
Expand Down Expand Up @@ -461,7 +461,7 @@ GEM
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
smart_properties (1.17.0)
sorbet-runtime (0.5.11647)
sorbet-runtime (0.5.11668)
spring (4.2.1)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
Expand Down Expand Up @@ -489,7 +489,7 @@ GEM
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.6.0)
uri (0.13.1)
uri (1.0.2)
useragent (0.16.10)
versionist (2.0.1)
activesupport (>= 3)
Expand Down Expand Up @@ -531,26 +531,26 @@ DEPENDENCIES
active_model_serializers (~> 0)
awesome_print
bcrypt (~> 3)
bootsnap (>= 1.4.4)
bootsnap (>= 1)
brakeman (~> 6)
bundler-audit (~> 0)
debug (~> 1)
dotenv-rails
factory_bot_rails (~> 6)
faker (~> 3)
friendly_id
json (~> 2.7)
json (~> 2)
jsonapi-serializer (~> 2)
jwt (~> 2.8)
kaminari
kredis (~> 1)
listen (~> 3.3)
openssl (~> 3.2)
openssl (~> 3)
ostruct (~> 0)
parallel (~> 1.26)
parallel (~> 1)
parallel_tests (~> 4)
pg (~> 1.5.7)
puma (~> 6.4)
pg (~> 1)
puma (~> 6)
pundit
rack-attack (~> 6)
rack-cors (~> 2)
Expand Down Expand Up @@ -589,7 +589,7 @@ DEPENDENCIES
rubocop-shopify
rubocop-thread_safety
ruby-lsp
ruby-lsp-rails (~> 0.3.15)
ruby-lsp-rails (~> 0.3)
ruby-lsp-rspec
ruby_audit (~> 2)
selenium-webdriver (~> 4)
Expand All @@ -606,9 +606,9 @@ DEPENDENCIES
timecop (~> 0)
traceroute (~> 0)
turbo-rails (~> 2)
typhoeus (~> 1.4)
typhoeus (~> 1)
tzinfo-data
uri (~> 0.13.1)
uri (~> 1)
versionist (~> 2)
web-console (~> 4)
webmock (~> 3)
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/rswag-ui.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Rswag::Ui.configure do |c|
c.swagger_endpoint "/api-docs/v1/openapi.yaml", "API V1 Docs"
c.openapi_endpoint "/api-docs/v1/openapi.yaml", "API V1 Docs"
end
39 changes: 39 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: "0.2"
ignorePaths:
- db/schema.rb
- Gemfile
- Gemfile.lock
- db/migrate
- db/schema.rb
dictionaryDefinitions: []
dictionaries:
- en_US
- companies
- softwareTerms
- misc
- ruby
- rails
- bash
- typescript
- node
- markdown
- lorem-ipsum
words:
- Rswag
- bytesize
- filesize
- invalidcookie
- isready
- mikepenz
- resultset
- reviewdog
- timestr
- unsubscription
- VERCEL
- swag
- rewax
- rowan
- rag
- rsa
ignoreWords: []
import: []
Loading
Loading