add middlewares to autoload lib configuration #125
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Runs zeitwerk:check, rubocop and rspec on push. | |
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@v4 | |
- 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:prepare | |
- name: Check zeitwerk | |
run: bundle exec rails zeitwerk:check | |
lint: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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@v4 | |
- 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 |