Skip to content

Fix specs

Fix specs #297

Workflow file for this run

env:
RUBY_VERSION: 3.3
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: sugar_test
name: Build
on:
push:
branches:
- main
- develop
pull_request:
jobs:
eslint:
name: ESLint
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true
- name: Check code
run: pnpm lint
prettier:
name: Prettier
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true
- name: Check code
run: pnpm prettier
rubocop:
name: Rubocop
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ env.RUBY_VERSION }}
- name: Install system dependencies
run: |
sudo apt-get install -y libvips42
- name: Install Ruby gems
run: |
gem install bundler
bundle config path vendor/bundle
bundle install
- name: Check code
run: bundle exec rubocop --format github
rspec:
name: RSpec
runs-on: ubuntu-latest
timeout-minutes: 15
if: "!contains(github.event.head_commit.message, '[ci skip]')"
services:
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_USER: ${{ env.DB_USER }}
POSTGRES_PASSWORD: ${{ env.DB_PASSWORD }}
POSTGRES_DB: ${{ env.DB_NAME }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ env.RUBY_VERSION }}
- name: Start Solr
run: /usr/bin/docker run -d -v ${{ github.workspace }}/solr/init:/docker-entrypoint-initdb.d/ -p 8983:8983 --name solr solr:8
- name: Install system dependencies
run: |
sudo apt-get install -y libvips42
- name: Build frontend
run: |
pnpm build
pnpm build:css
- name: Create database
env:
# RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
RAILS_ENV: test
SUGAR_DB_HOST: 127.0.0.1
SUGAR_DB_USERNAME: ${{ env.DB_USER }}
SUGAR_DB_PASSWORD: ${{ env.DB_PASSWORD }}
REDIS_URL: redis://localhost:6379/1
run: |
bin/rails db:migrate
- name: Run tests
env:
# RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
SUGAR_DB_HOST: 127.0.0.1
SUGAR_DB_USERNAME: ${{ env.DB_USER }}
SUGAR_DB_PASSWORD: ${{ env.DB_PASSWORD }}
REDIS_URL: redis://localhost:6379/1
SOLR_HOST: localhost
SOLR_PORT: 8983
run: bundle exec rspec
typescript:
name: TypeScript
runs-on: ubuntu-latest
timeout-minutes: 10
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
run_install: true
- name: Check code
run: pnpm tsc --noEmit