Skip to content

Commit

Permalink
Configure CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
woarewe committed Mar 28, 2023
1 parent 3c1b6df commit 7d7864b
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
DATABASE_HOST=localhost
DATABASE_PASSWORD=password
DATABASE_PORT=5432
DATABASE_USERNAME=postgres
DATABASE_USER=postgres
# Required only for production
DATABASE_NAME=production_db

Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
push:
branches:
- main

pull_request:
branches:
- main

env:
BUNDLE_WITHOUT: development
DATABASE_USER: ci
DATABASE_PASSWORD: password
RAILS_ENV: test

jobs:
ci:
runs-on: ubuntu-latest

services:
database:
image: postgres:15.2-alpine
env:
POSTGRES_USER: ${{ env.DATABASE_USER }}
POSTGRES_PASSWORD: ${{ env.DATABASE_PASSWORD }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/[email protected]
with:
ruby-version: 3.1.3
bundler-cache: true

- name: Setting up DB
run: bin/rails db:create db:schema:load

- name: Checking constants consistency
run: bin/rails zeitwerk:check

- name: Checking code style
run: bin/rubocop

- name: Tests
run: bin/rails test
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ require:
- rubocop-performance

AllCops:
TargetRubyVersion: 3.1.2
TargetRubyVersion: 3.1.3
NewCops: enable
Exclude:
- bin/**/*
- db/schema.rb
- vendor/**/*

Style/StringLiterals:
EnforcedStyle: double_quotes
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.1
3.1.3
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.2.1"
ruby "3.1.3"

gem "dotenv-rails", "~> 2.8", ">= 2.8.1", require: "dotenv/rails-now"

Expand Down
12 changes: 11 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ GEM
crass (1.0.6)
date (3.3.3)
debug (1.7.1)
irb (>= 1.5.0)
reline (>= 0.3.1)
dotenv (2.8.1)
dotenv-rails (2.8.1)
dotenv (= 2.8.1)
Expand All @@ -83,6 +85,9 @@ GEM
activesupport (>= 5.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
io-console (0.6.0)
irb (1.6.3)
reline (>= 0.3.0)
json (2.6.3)
loofah (2.19.1)
crass (~> 1.0.2)
Expand All @@ -109,6 +114,8 @@ GEM
nio4r (2.5.8)
nokogiri (1.14.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.14.2-x86_64-linux)
racc (~> 1.4)
parallel (1.22.1)
parser (3.2.1.1)
ast (~> 2.4.1)
Expand Down Expand Up @@ -148,6 +155,8 @@ GEM
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.7.0)
reline (0.3.3)
io-console (~> 0.5)
rexml (3.2.5)
rubocop (1.48.1)
json (~> 2.3)
Expand Down Expand Up @@ -181,6 +190,7 @@ GEM

PLATFORMS
arm64-darwin-22
x86_64-linux

DEPENDENCIES
bootsnap
Expand All @@ -195,7 +205,7 @@ DEPENDENCIES
tzinfo-data

RUBY VERSION
ruby 3.2.1p31
ruby 3.1.3p185

BUNDLED WITH
2.4.10
2 changes: 1 addition & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ default: &default
pool: <%= ENV.fetch("RAILS_MAX_THREADS", 5) %>
host: <%= ENV.fetch("DATABASE_HOST") { "localhost" } %>
password: <%= ENV["DATABASE_PASSWORD"] %>
username: <%= ENV["DATABASE_USERNAME"] %>
username: <%= ENV["DATABASE_USER"] %>
timeout: <%= ENV.fetch("DATABASE_TIMEOUT") { 5000 } %>
port: <%= ENV.fetch("DATABASE_PORT") { 5432 } %>
database: <%= ENV["DATABASE_NAME"] %>
Expand Down

0 comments on commit 7d7864b

Please sign in to comment.