forked from e621ng/e621ng
[CI] Run rubocop and add rubocop-todo
There's no point in building the Dockerfile just for rubocop, but doing it this way allows for easy integration of a test action in the future.
This commit is contained in:
parent
1f6d674177
commit
f00e781b3b
19
.github/prepare-docker-image/action.yml
vendored
Normal file
19
.github/prepare-docker-image/action.yml
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
name: Load Docker Image
|
||||
description: Load Docker Image
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
cache-from: type=gha
|
||||
load: true
|
||||
tags: e621:test
|
||||
|
||||
- name: Set docker run command
|
||||
run: echo "DOCKER_RUN=docker run --rm --network host -e POSTGRES_HOST=localhost -e RAILS_ENV=test -e CI=true -v $PWD:/app e621:test" >> "$GITHUB_ENV"
|
||||
shell: bash
|
38
.github/workflows/checks.yml
vendored
Normal file
38
.github/workflows/checks.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
name: Checks
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
docker-build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Build
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
tags: e621:test
|
||||
|
||||
rubocop:
|
||||
runs-on: ubuntu-latest
|
||||
needs: docker-build
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/prepare-docker-image
|
||||
|
||||
- name: Run Rubocop
|
||||
run: $DOCKER_RUN bundle exec rubocop --format github
|
12
.rubocop.yml
12
.rubocop.yml
@ -1,3 +1,10 @@
|
||||
<% if ENV["CI"] %>
|
||||
inherit_from: .rubocop_todo.yml
|
||||
inherit_mode:
|
||||
merge:
|
||||
- Exclude
|
||||
<% end %>
|
||||
|
||||
require:
|
||||
- rubocop-rails
|
||||
|
||||
@ -34,6 +41,8 @@ Metrics/BlockLength:
|
||||
- concerning
|
||||
- context
|
||||
- create_table
|
||||
- factory
|
||||
- FactoryBot.define
|
||||
- should
|
||||
Exclude:
|
||||
- config/routes.rb
|
||||
@ -73,7 +82,8 @@ Rails/InverseOf:
|
||||
|
||||
Rails/Output:
|
||||
Exclude:
|
||||
- db/*.rb
|
||||
- db/seeds.rb
|
||||
- db/fixes/*.rb
|
||||
|
||||
Rails/ReversibleMigration:
|
||||
Enabled: false
|
||||
|
3132
.rubocop_todo.yml
Normal file
3132
.rubocop_todo.yml
Normal file
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,7 @@ Try this:
|
||||
|
||||
`docker compose run --rm tests` to execute the test suite.
|
||||
|
||||
`docker compose run --rm rubocop` to run the linter. Run it against changed files only, there are too many existing violations at the moment.
|
||||
`docker compose run --rm rubocop` to run the linter. You will see a truckload of violations but CI will ignore these.
|
||||
|
||||
The postgres server accepts outside connections which you can use to access it with a local client. Use `localhost:34517` to connect to a database named `danbooru2` with the user `danbooru`. Leave the password blank, anything will work.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user