Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: ["**"]

jobs:
tests:
services:
postgres:
image: postgres:18
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

mysql:
image: mysql:8
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sequel:
- "~> 3.38"
- "~> 4.0"
- "~> 5.0"
ruby:
- "3.0"
- "3.1"
- "3.2"
- "3.3"
- "3.4"
- "4.0"

name: Ruby ${{ matrix.ruby }}, Sequel ${{ matrix.sequel }}

env:
SEQUEL: "${{ matrix.sequel }}"
BUNDLE_GEMFILE: "ci/Gemfile.ci"
steps:
- uses: actions/checkout@v3
- name: Install db dependencies and check connections
run: |
DEBIAN_FRONTEND="noninteractive" sudo apt-get install -yqq mysql-client libmysqlclient-dev postgresql-client libpq-dev
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -proot -e "SHOW GRANTS FOR 'root'@'localhost'"
env PGPASSWORD=postgres psql -h localhost -p ${{ job.services.postgres.ports[5432] }} -U postgres -l
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Create databases
run: |
mysql -e 'create database delayed_jobs_test;' --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -proot
env PGPASSWORD=postgres psql -c 'create database delayed_jobs_test;' -U postgres -h localhost -p ${{ job.services.postgres.ports[5432] }}
- name: Run PostgreSQL tests
run: bundle exec rspec
env:
TEST_ADAPTER: postgresql
TEST_DATABASE: delayed_jobs_test
TEST_DATABASE_HOST: localhost
TEST_DATABASE_PORT: ${{ job.services.postgres.ports[5432] }}
TEST_USERNAME: postgres
TEST_PASSWORD: postgres
- name: Run MySQL2 tests
run: bundle exec rspec
env:
TEST_ADAPTER: mysql2
TEST_DATABASE: delayed_jobs_test
TEST_DATABASE_HOST: 127.0.0.1
TEST_DATABASE_PORT: ${{ job.services.mysql.ports[3306] }}
TEST_USERNAME: root
TEST_PASSWORD: root
TEST_ENCODING: "utf8"
- name: Run SQLite tests
run: bundle exec rspec
env:
TEST_ADAPTER: "sqlite3"
TEST_DATABASE: "db/database.sqlite3"
- name: Lint
run: bundle exec rubocop
22 changes: 22 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
inherit_from: .rubocop_todo.yml

AllCops:
Include:
- '**/Gemfile'
- '**/config.ru'
- '**/Rakefile'
- '**/*.rake'
- '**/*.gemfile'
- '**/*.gemspec'
- '**/*.rb'
Exclude:
- 'ci/**/*'
- 'vendor/bundle/**/*'
SuggestExtensions: false
NewCops: disable

Style/HashSyntax:
EnforcedStyle: ruby19

Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
Loading
Loading