Skip to content

Merge pull request #234 from elektronaut/dependabot/bundler/actiontex… #274

Merge pull request #234 from elektronaut/dependabot/bundler/actiontex…

Merge pull request #234 from elektronaut/dependabot/bundler/actiontex… #274

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
- name: Node modules cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node modules
run: |
yarn install
- name: Check code
run: yarn 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
- name: Node modules cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node modules
run: |
yarn install
- name: Check code
run: yarn prettier
rubocop-test:
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:14
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: 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: Node modules cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node modules
run: |
yarn install
- name: Build frontend
run: |
yarn build
yarn 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