Skip to content

Commit

Permalink
Merge pull request #224 from momocus/elasticsearch
Browse files Browse the repository at this point in the history
Elasticsearch導入
  • Loading branch information
momocus authored Jul 2, 2021
2 parents 2c28f61 + 86f4e00 commit 2c4d8ab
Show file tree
Hide file tree
Showing 16 changed files with 431 additions and 129 deletions.
105 changes: 58 additions & 47 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,50 +21,61 @@ jobs:
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: node_modules
cache-env: prod
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-env }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-env }}-
- name: Install Dependencies
run: yarn install --production=true
- name: Set up Ruby 3
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
- name: Cache gems
uses: actions/cache@v2
env:
cache-name: gems
cache-env: test
with:
path: vendor/bundle
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-env }}-${{ hashFiles('**/Gemfile') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-env }}-
- name: Install bundle dependencies
run: |
bundle config path vendor/bundle
bundle config set --local without development
bundle config set --local with test
bundle install
- name: Setup Database
env:
RAILS_ENV: test
POSTGRES_USERNAME: postgres
POSTGRES_PASSWORD: password
run: bundle exec rails db:create
- name: Run tests
env:
RAILS_ENV: test
POSTGRES_USERNAME: postgres
POSTGRES_PASSWORD: password
run: |
bundle exec rake webpacker:compile
bundle exec rspec
- uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: node_modules
cache-env: prod
with:
path: "**/node_modules"
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-env }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-env }}-
- name: Install Dependencies
run: yarn install --production=true
- name: Set up Ruby 3
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
- name: Cache gems
uses: actions/cache@v2
env:
cache-name: gems
cache-env: test
with:
path: vendor/bundle
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-env }}-${{ hashFiles('**/Gemfile') }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ env.cache-env }}-
- name: Install bundle dependencies
run: |
bundle config path vendor/bundle
bundle config set --local without development
bundle config set --local with test
bundle install
- name: Setup Database
env:
RAILS_ENV: test
POSTGRES_USERNAME: postgres
POSTGRES_PASSWORD: password
run: bundle exec rails db:create
- name: Configure system parameter
run: |
sudo swapoff --all
sudo sysctl --write vm.swappiness=1
sudo sysctl --write fs.file-max=262144
sudo sysctl --write vm.max_map_count=262144
- name: Run Elasticsearch with Plugins
uses: miyataka/elasticsearch-github-actions@1
with:
stack-version: "7.11.2"
plugins: "analysis-kuromoji analysis-icu"
- name: Run tests
env:
RAILS_ENV: test
POSTGRES_USERNAME: postgres
POSTGRES_PASSWORD: password
run: |
bundle exec rake webpacker:compile
bundle exec rspec
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ gem "kaminari"
# Japanese Era
gem "era_ja"

# ElasticSearch
gem "bonsai-elasticsearch-rails"
gem "elasticsearch-model"
gem "elasticsearch-rails"

group :development, :test do
gem "annotate"
# Call 'byebug' anywhere in the code to stop execution and get a debugger
Expand Down
Loading

0 comments on commit 2c4d8ab

Please sign in to comment.