main #355
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: main | |
on: workflow_dispatch | |
jobs: | |
CD: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_DB: muffon_api_test | |
POSTGRES_USER: muffon_api_test | |
POSTGRES_PASSWORD: muffon_api_test | |
ports: ['5432:5432'] | |
redis: | |
image: redis | |
ports: ['6379:6379'] | |
steps: | |
- name: Set up Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Set up dependencies | |
run: bundle install | |
- name: Lint | |
run: bundle exec rubocop | |
- name: Test | |
env: | |
RAILS_ENV: test | |
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} | |
run: | | |
bundle exec rails db:migrate | |
bundle exec rspec | |
- name: Deploy | |
env: | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
run: | | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}" | |
bundle exec cap production deploy |