Skip to content

Add address generator and associated files #42

Add address generator and associated files

Add address generator and associated files #42

# Runs zeitwerk:check, rubocop and rspec on push.
# The CI has 3 jobs, build, lint and test.
name: build, lint and test
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: rails_api_test
DATABASE_URL: postgres://postgres:postgres@localhost/rails_api_test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:latest
ports:
- 6379:6379
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Install libvips
run: |
sudo apt-get update
sudo apt-get install -y libvips
- name: Install dependencies
run: bundle install
- name: Setup database
run: |
bundle exec rails db:create
bundle exec rails db:migrate
- name: Check zeitwerk
run: bundle exec rails zeitwerk:check
lint:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Install libvips
run: |
sudo apt-get update
sudo apt-get install -y libvips
- name: Install dependencies
run: bundle install
- name: Run linter
run: bundle exec rubocop
test:
needs: build
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ env.POSTGRES_DB }}
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:latest
ports:
- 6379:6379
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Install libvips
run: |
sudo apt-get update
sudo apt-get install -y libvips
- name: Install dependencies
run: bundle install
- name: load schema
run: bundle exec rails db:schema:load
- name: Run tests
run: bundle exec rspec