2020-04-20 13:02:48 -07:00
|
|
|
name: Retrospring
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-01-26 13:47:37 -08:00
|
|
|
branches: [ main ]
|
2020-04-20 13:02:48 -07:00
|
|
|
pull_request:
|
2022-01-26 13:47:37 -08:00
|
|
|
branches: [ main ]
|
2020-04-20 13:02:48 -07:00
|
|
|
|
|
|
|
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
|
2020-12-24 14:36:02 -08:00
|
|
|
NODE_ENV: test
|
2020-04-20 13:02:48 -07:00
|
|
|
POSTGRES_HOST: localhost
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_DB: justask_test
|
|
|
|
|
2022-01-06 12:20:29 -08:00
|
|
|
# used by setup-ruby with bundler-cache
|
|
|
|
BUNDLE_JOBS: '4'
|
|
|
|
BUNDLE_RETRY: '3'
|
|
|
|
BUNDLE_WITHOUT: 'production'
|
|
|
|
|
2020-04-20 13:02:48 -07:00
|
|
|
steps:
|
2023-09-11 02:08:11 -07:00
|
|
|
- uses: actions/checkout@v4.0.0
|
2022-01-06 12:20:29 -08:00
|
|
|
- name: Install dependencies
|
|
|
|
run: sudo apt update && sudo apt-get install -y libpq-dev libxml2-dev libxslt1-dev libmagickwand-dev imagemagick libidn11-dev
|
|
|
|
- name: Set up Ruby
|
|
|
|
uses: ruby/setup-ruby@v1
|
2020-04-20 13:02:48 -07:00
|
|
|
with:
|
2022-01-06 12:20:29 -08:00
|
|
|
bundler-cache: true
|
2022-11-06 04:20:14 -08:00
|
|
|
- name: Set up Node 14
|
2022-07-08 17:45:45 -07:00
|
|
|
uses: actions/setup-node@v3
|
2020-12-24 14:35:12 -08:00
|
|
|
with:
|
2022-11-06 04:20:14 -08:00
|
|
|
node-version: '14'
|
2023-01-20 21:56:40 -08:00
|
|
|
cache: 'yarn'
|
2020-04-20 13:02:48 -07:00
|
|
|
- name: Copy default configuration
|
|
|
|
run: |
|
|
|
|
cp config/database.yml.postgres config/database.yml
|
|
|
|
cp config/justask.yml.example config/justask.yml
|
2020-12-24 14:35:12 -08:00
|
|
|
- name: Install node modules
|
|
|
|
run: |
|
|
|
|
npm i -g yarn
|
2020-12-25 05:16:34 -08:00
|
|
|
yarn install --frozen-lockfile
|
2020-12-25 06:08:33 -08:00
|
|
|
- name: Export i18n JS files
|
2022-09-17 06:18:55 -07:00
|
|
|
run: bundle exec i18n export
|
2020-12-25 05:11:31 -08:00
|
|
|
- name: Compile assets
|
|
|
|
run:
|
|
|
|
bundle exec rake assets:precompile
|
2020-04-20 13:02:48 -07:00
|
|
|
- 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] }}"
|
2022-07-09 02:54:23 -07:00
|
|
|
- uses: codecov/codecov-action@v3
|
2020-05-01 01:13:42 -07:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
file: ./coverage/coverage.xml
|