Skip to content

Commit

Permalink
Version 3 (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
top4ek committed Mar 6, 2022
1 parent 9b9fa8a commit 4206f69
Show file tree
Hide file tree
Showing 276 changed files with 7,028 additions and 2,512 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.go]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
29 changes: 29 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
RAILS_SECRET_KEY_BASE=865a7ffac1ee450bd7cd4162f136de03bacdb73644f463512db8da81e21e24e6885b76c104cbb3d0513112e47dc102ce9909a25c62c2061d27b134e29a61e55d
RAILS_ENV=test

PUMA_MIN_THREADS=2
PUMA_MAX_THREADS=5
WEB_CONCURRENCY=0

DATABASE_HOST=postgres
DATABASE_NAME=shizoid
DATABASE_PASSWORD=WoZ7w2e3
DATABASE_PORT=5432
DATABASE_USERNAME=shizoid
DB_POOL_SIZE=40

SIDEKIQ_CONCURRENCY=25
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_SIDEKIQ_DB=1
REDIS_CONTEXT_DB=2
# REDIS_PASSWORD=
CONTEXT_SIZE=50

WEBHOOK_URL=https://localhost
TELEGRAM_TOKEN=111111111:11111111111111111111111111111111111
BOT_OWNERS=11111,222222
# ALLOW_TO_ALL=true

#SENTRY_DSN=
STOPCOVID_URL=https://xn--80aesfpebagmfblc0a.xn--p1ai
1 change: 1 addition & 0 deletions .gemrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
install: --no-document
79 changes: 79 additions & 0 deletions .github/workflows/shizoid.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Shizoid
on:
- push
- pull_request

jobs:
rspec:
name: Perform specs
runs-on: ubuntu-latest
services:
postgres:
image: postgres:alpine
env:
POSTGRES_USER: shizoid
POSTGRES_PASSWORD: WoZ7w2e3
POSTGRES_DB: shizoid_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:alpine
ports:
- 6379:6379
options: --entrypoint redis-server
steps:
- name: 'Checkout repository'
uses: actions/checkout@v2
- name: 'Setup Ruby'
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
- name: "Install required system packages"
run: sudo apt-get update -y && sudo apt-get install openssh-client rsync libpq-dev cmake -y
- name: "Bundle install"
run: |
gem install bundler && bundle update --bundler && bundle -v
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: "Rails test"
run: |
export $(grep -v '#' .env.test | grep '=' | xargs)
export DATABASE_HOST=127.0.0.1
export REDIS_HOST=127.0.0.1
bundle exec rails db:setup --trace
bundle exec rails test
bundle exec rspec
bundle exec rails zeitwerk:check
build:
name: Build and upload image
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/master' }}
needs: rspec
steps:
- uses: actions/checkout@v2

- name: Save current version to file
run: git rev-parse --short HEAD > .version

- name: Buildah Action
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: shizoid
tags: latest ${{ github.sha }}
containerfiles: ./config/deploy/Containerfile

- name: Push to docker hub
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: docker.io/${{ secrets.DOCKER_USER }}
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
19 changes: 12 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
/.bundle
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
.byebug_history
config/secrets.yml
config/database.yml
config/deploy.rb
config/newrelic.yml
.idea
.vagrant
.version
*.sublime-project
*.sublime-workspace
/.bundle
/log/*
/tmp/*
coverage
db/backups
receiver/tmp
.env
8 changes: 0 additions & 8 deletions .localer.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
--color
--format d
--require spec_helper
--require rails_helper
--order rand
35 changes: 32 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
inherit_from: .rubocop_todo.yml

require:
- rubocop-performance
- rubocop-rspec
- rubocop-rails

AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 3.1
Exclude:
- db/schema.rb
- bin/*

Documentation:
Enabled: false

Metrics/LineLength:
Max: 120
Max: 130

Metrics/MethodLength:
Metrics/BlockLength:
Max: 50
ExcludedMethods:
- describe
- context
- path
- get
- patch
- put
- post
- delete

Style/NumericPredicate:
Exclude:
- spec/**/*

Metrics/AbcSize:
Max: 30
Loading

0 comments on commit 4206f69

Please sign in to comment.