Merge pull request #223 from peterfication/dependabot/bundler/dockerf… #526
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
name: CI | |
on: push | |
jobs: | |
spellcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: "yarn" | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: ./node_modules | |
key: module-${{ hashFiles('yarn.lock') }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Run Spellchecker | |
run: yarn spellcheck | |
before: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
lint: | |
needs: [before] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Run Rubocop | |
run: bundle exec rubocop | |
- name: Run HAML lint | |
run: bundle exec haml-lint app/**/*.haml | |
format: | |
needs: [before] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Run Prettier | |
run: bundle exec rbprettier --check '**/*.{rb,yml,json,js,md,graphql,haml}' | |
db-doctor: | |
needs: [before] | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_DB: peak-tracker-auth_test | |
POSTGRES_PASSWORD: postgres | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/peak-tracker-auth_test | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Set up the test database | |
run: | | |
bundle exec rails db:create | |
bundle exec rails db:schema:load | |
- name: Run ActiveRecord Doctor | |
run: bundle exec rake active_record_doctor | |
message-bus-check: | |
needs: [before] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check message bus setup | |
run: scripts/message_bus_check.sh | |
eager-load: | |
needs: [before] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: "Try to eager load the app to check for errors" | |
run: bundle exec rails zeitwerk:check DATABASE_URL=postgres://user:password@invalid:5432/not-needed | |
test: | |
needs: [before] | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
env: | |
POSTGRES_DB: peak-tracker-auth_test | |
POSTGRES_PASSWORD: postgres | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/peak-tracker-auth_test | |
REDIS_URL: redis://localhost:6379/0 | |
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} | |
RAILS_ENV: test | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Set up the test database | |
run: | | |
bundle exec rails db:create | |
bundle exec rails db:schema:load | |
- name: Precompile the assets for the request specs | |
run: bundle exec rake assets:precompile | |
- name: Lint the test factories | |
run: bundle exec rake factory_bot:lint | |
- name: Run RSpec | |
run: bundle exec rspec | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: .resultset.json | |
directory: coverage |