New Fly.io and Action Cable architecture, including AnyCable #45
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake | |
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby | |
name: CI | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
jobs: | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_DB: flyweight_test | |
POSTGRES_USER: flyweight | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- "5432:5432" | |
redis: | |
image: redis | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- "6379:6379" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Create test database | |
env: | |
POSTGRES_DB: flyweight_test | |
POSTGRES_USER: flyweight | |
POSTGRES_PASSWORD: postgres | |
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} | |
run: | | |
sudo apt-get install libpq-dev | |
RAILS_ENV=test bin/rails db:setup | |
- name: Run unit tests | |
env: | |
POSTGRES_DB: flyweight_test | |
POSTGRES_USER: flyweight | |
POSTGRES_PASSWORD: postgres | |
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} | |
run: bundle exec rspec spec | |
lint: | |
name: Linters | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Run Rubocop | |
run: | | |
gem install rubocop-rails rubocop-rspec rubocop-performance rubocop-md rubocop-rake rubocop-graphql rubocop-rspec_rails rubocop-sidekiq rubocop-yard rubocop-factory_bot | |
git clone https://gist.github.com/65e21b9e8b0d1db285dcb4fc627b98fa.git .rubocop | |
cp .rubocop/.rubocop.yml .rubocop-ruby.yml | |
git clone https://gist.github.com/14cfa24d53c12bf385871e9b93b95c37.git .rubocop-rspec | |
cp .rubocop-rspec/.rubocop-rspec.yml . | |
git clone https://gist.github.com/9f3bb94ef794f92dd480cffa019e91a4.git .rubocop-rails | |
cp .rubocop-rails/.rubocop-rails.yml . | |
cat .rubocop.yml | sed -e 's/~\/.rubocop/.rubocop/' | sed -e 's/.rubocop.yml/.rubocop-ruby.yml/' > .rubocop2.yml | |
mv .rubocop2.yml .rubocop.yml | |
rubocop --parallel -f github | |
- name: Run Brakeman | |
run: bin/brakeman --no-pager |