Retrospring/.github/workflows/retrospring.yml

76 lines
2.2 KiB
YAML
Raw Normal View History

name: Retrospring
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.12
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: justask_test
ports:
- 5432/tcp
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server
env:
RAILS_ENV: test
POSTGRES_HOST: localhost
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: justask_test
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7.x
- name: Install dependencies
run: sudo apt update && sudo apt-get install -y libpq-dev libxml2-dev libxslt1-dev libmagickwand-dev imagemagick
- name: Copy default configuration
run: |
cp config/database.yml.postgres config/database.yml
cp config/justask.yml.example config/justask.yml
- name: Install gems
run: |
gem install bundler
bundle config path vendor/bundle
bundle config set without 'production'
bundle install --jobs 4 --retry 3
- name: Set up database
run: bundle exec rake db:setup
env:
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
- name: Run tests
run: bundle exec rake spec
env:
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
REDIS_URL: "redis://localhost:${{ job.services.redis.ports[6379] }}"
2020-05-10 05:33:03 -07:00
- name: Lint HAML templates
run: bundle exec haml-lint app/views
2020-05-01 01:13:42 -07:00
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/coverage.xml