Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev tools upgrade #12

Merged
merged 5 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
46 changes: 31 additions & 15 deletions .dockerdev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ ARG DISTRO_NAME=bullseye

FROM ruby:$RUBY_VERSION-slim-$DISTRO_NAME

ARG PG_MAJOR
ARG DISTRO_NAME
ARG NODE_MAJOR
ARG BUNDLER_VERSION
ARG YARN_VERSION

RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
Expand All @@ -21,38 +17,58 @@ RUN apt-get update -qq \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log

# Add PostgreSQL to sources list
ARG PG_MAJOR
RUN curl -sSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo deb http://apt.postgresql.org/pub/repos/apt/ $DISTRO_NAME-pgdg main $PG_MAJOR > /etc/apt/sources.list.d/pgdg.list
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
libpq-dev \
postgresql-client-$PG_MAJOR \
&& apt-get clean \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log

# Add NodeJS to sources list
ARG NODE_MAJOR
RUN curl -sL https://deb.nodesource.com/setup_$NODE_MAJOR.x | bash -
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
nodejs \
&& apt-get clean \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& truncate -s 0 /var/log/*log

ARG YARN_VERSION
RUN npm install -g yarn@$YARN_VERSION

# Application dependencies
# External Aptfile for that
COPY Aptfile /tmp/Aptfile
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
$(grep -Ev '^\s*#' /tmp/Aptfile | xargs) \
libpq-dev \
postgresql-client-$PG_MAJOR \
nodejs && \
$(grep -Ev '^\s*#' /tmp/Aptfile | xargs) && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
truncate -s 0 /var/log/*log

RUN npm install -g yarn@$YARN_VERSION

# Configure bundler
ENV LANG=C.UTF-8 \
BUNDLE_JOBS=4 \
BUNDLE_RETRY=3

ENV PATH /app/bin:$PATH
# Upgrade RubyGems and install required Bundler version
# Store Bundler settings in the project's root
ENV BUNDLE_APP_CONFIG=.bundle

# Upgrade RubyGems and install latest Bundler
RUN gem update --system && \
gem install bundler:$BUNDLER_VERSION
gem install bundler

# Create a directory for the app code
RUN mkdir -p /app
WORKDIR app

# Document that we're going to expose port 3000
EXPOSE 3000
# Use Bash as the default command
CMD ["/usr/bin/bash"]
1 change: 0 additions & 1 deletion .dockerdev/docker-compose.yml → .dockerdev/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ x-app: &app
PG_MAJOR: '14'
NODE_MAJOR: '16'
YARN_VERSION: '1.22.17'
BUNDLER_VERSION: 2.3.6
image: anycasts-demo-dev:1.0.0
environment: &env
NODE_ENV: ${NODE_ENV:-development}
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
name: Lint

on:
push:
branches:
- main
pull_request:

jobs:
pronto:
rubocop:
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: gemfiles/rubocop.gemfile
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
steps:
- name: Checkout code
uses: actions/checkout@v2
# Pronto requires this
- run: |
git fetch --no-tags --prune --depth=30 origin +refs/heads/*:refs/remotes/origin/*
- name: Setup Ruby with Bundler
uses: ruby/setup-ruby@v1
with:
bundler: 2.3.6
bundler-cache: true
env:
BUNDLE_GEMFILE: gemfiles/linters.gemfile
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
- name: Run Pronto
env:
PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
PRONTO_GITHUB_ACCESS_TOKEN: "${{ github.token }}"
BUNDLE_GEMFILE: gemfiles/linters.gemfile
run: bundle exec pronto run -f github_status github_pr -c origin/${{ github.base_ref }}
- name: Run Rubocop
run: bundle exec rubocop
palkan marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions .github/workflows/rspec_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ jobs:
run: dip bundle
- name: Run specs
run: |
dip RAILS_ENV="test" rails db:setup
dip rails db:test:prepare
dip rspec
dip rspec systems
dip rspec system
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@
/app/assets/builds/*
!/app/assets/builds/.keep
spec/examples.txt
gemfiles/*.lock
13 changes: 8 additions & 5 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
inherit_from:
- .rubocop/rails.yml
- .rubocop/rspec.yml
- .rubocop/custom.yml
- .rubocop_todo.yml
- .rubocop/strict.yml

AllCops:
NewCops: disable
TargetRubyVersion: 3.1
Expand All @@ -14,9 +21,5 @@ require:
inherit_gem:
standard: config/base.yml

inherit_from:
- .rubocop_rails.yml
- .rubocop_rspec.yml
- .rubocop_custom.yml
- .rubocop_strict.yml


2 changes: 1 addition & 1 deletion .rubocop_custom.yml → .rubocop/custom.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require:
- ./lib/rubocop/cops
- ../lib/rubocop/cops

Lint/Env:
Enabled: true
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion .rubocop_rspec.yml → .rubocop/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ RSpec/MissingExampleGroupArgument:
RSpec/ReceiveCounts:
Enabled: true

Rspec/Capybara/CurrentPathExpectation:
RSpec/Capybara/CurrentPathExpectation:
Enabled: true

RSpec/FactoryBot/AttributeDefinedStatically:
Expand Down
File renamed without changes.
88 changes: 88 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 10000`
# on 2022-03-22 07:19:54 UTC using RuboCop version 1.26.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
GraphQL/ArgumentDescription:
Exclude:
- 'app/graphql/types/query_type.rb'

# Offense count: 5
GraphQL/ObjectDescription:
Exclude:
- 'app/graphql/types/channel_type.rb'
- 'app/graphql/types/message_type.rb'
- 'app/graphql/types/mutation_type.rb'
- 'app/graphql/types/node_type.rb'
- 'app/graphql/types/query_type.rb'

# Offense count: 4
# This cop supports safe auto-correction (--auto-correct).
Layout/SpaceInsidePercentLiteralDelimiters:
Exclude:
- 'Gemfile'

# Offense count: 1
# Configuration parameters: EnforcedStyle.
# SupportedStyles: slashes, arguments
Rails/FilePath:
Exclude:
- 'config/environments/development.rb'

# Offense count: 1
# Configuration parameters: IgnoreScopes, Include.
# Include: app/models/**/*.rb
Rails/InverseOf:
Exclude:
- 'app/models/channel.rb'

# Offense count: 2
# Configuration parameters: ForbiddenMethods, AllowedMethods.
# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all
Rails/SkipsModelValidations:
Exclude:
- 'db/seeds.rb'

# Offense count: 26
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: always, always_true, never
Style/FrozenStringLiteralComment:
Exclude:
- 'Gemfile'
- 'Rakefile'
- 'app/channels/application_cable/channel.rb'
- 'app/channels/application_cable/connection.rb'
- 'app/controllers/channels_controller.rb'
- 'app/controllers/messages_controller.rb'
- 'app/helpers/application_helper.rb'
- 'app/helpers/channels_helper.rb'
- 'app/jobs/application_job.rb'
- 'app/models/application_record.rb'
- 'app/models/channel.rb'
- 'app/models/message.rb'
- 'config.ru'
- 'config/application.rb'
- 'config/boot.rb'
- 'config/environment.rb'
- 'config/importmap.rb'
- 'config/initializers/content_security_policy.rb'
- 'config/initializers/filter_parameter_logging.rb'
- 'config/initializers/permissions_policy.rb'
- 'config/puma.rb'
- 'db/migrate/20211221124950_create_channels.rb'
- 'db/migrate/20211221150342_create_messages.rb'
- 'db/seeds.rb'
- 'gemfiles/rubocop.gemfile'
- 'lib/rubocop/cops/lint_env.rb'

# Offense count: 2
# This cop supports unsafe auto-correction (--auto-correct-all).
# Configuration parameters: SafeForConstants.
Style/RedundantFetchBlock:
Exclude:
- 'config/puma.rb'
Loading