Skip to content

Clean up before starting update. #38

Clean up before starting update.

Clean up before starting update. #38

Workflow file for this run

name: Dev-Test
on:
push:
branches:
- develop
jobs:
test:
runs-on: ubuntu-latest
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
env:
STACK_VERSION: 7.17.1
xpack.security.enabled: false
cluster.name: beckett-elasticsearch
http.port: 9200
discovery.type: single-node
options: >-
--health-cmd "curl http://localhost:9200/_cluster/health"
--health-interval 10s
--health-timeout 5s
--health-retries 10
ports:
- 9200:9200
postgres:
image: postgres:10
env:
POSTGRES_PASSWORD: password
POSTGRES_USER: user
POSTGRES_DB: beckett_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
- name: Setup cache key and directory for gems cache
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-use-ruby-${{ hashFiles('**/Gemfile.lock') }}
- name: Install system requirements
run: |
sudo apt update
sudo apt install -y postgresql-client
- name: Bundle Install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Test with RSpec
id: rspec
env:
RAILS_ENV: test
DB_USERNAME: user
DB_HOSTNAME: localhost
DB_PASSWORD: password
DB_NAME: beckett_test
run: |
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rspec spec/
# - name: Deploy
# env:
# SSH_KEY: ${{secrets.SSH_KEY}}
# if: steps.rspec.outcome == 'success'
# run: |
# mkdir ~/.ssh
# echo "$SSH_KEY" >> ~/.ssh/id_rsa
# chmod 400 ~/.ssh/id_rsa
# bundle exec cap production deploy