.github/workflows/event_registrations_build.yml
name: EventRegistrationsBuild
on:
push:
branches: [develop]
jobs:
linters:
name: Linters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.2
- 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: Install gems
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run linters
run: |
bundle exec rubocop --parallel
tests:
name: Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
POSTGRES_DB: "agilebrazil_test"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.2
- 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: Install gems
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Test & publish code coverage
uses: paambaati/codeclimate-action@v2.7.5
with:
coverageCommand: bundle exec rspec
debug: true
env:
RAILS_ENV: test
PG_HOST: localhost
PG_USER: "postgres"
PG_PASSWORD: "postgres"
PG_PORT: ${{ job.services.postgres.ports['5432'] }}
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
AGILE_ALLIANCE_API_HOST: 'https://aa-service-bus.herokuapp.com'
AGILE_ALLIANCE_API_TOKEN: 'xpto'
PAG_SEGURO_STORE_CODE: 'pagseguro_store_code'
deploy-staging:
runs-on: ubuntu-latest
needs: [linters, tests]
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.6.8
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: "event-registrations-staging"
heroku_email: "celso.av.martins@gmail.com"
branch: "develop"