Retrospring/.github/workflows/retrospring.yml

88 lines
2.5 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
NODE_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: Set up Node 12
uses: actions/setup-node@v1
with:
node-version: '12'
- 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: Install node modules
run: |
npm i -g yarn
2020-12-25 05:16:34 -08:00
yarn install --frozen-lockfile
2020-12-25 05:11:31 -08:00
- name: Compile assets
run:
bundle exec rake assets:precompile
- 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