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

DRAFT: run pronto as a github action #512

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
65 changes: 48 additions & 17 deletions .github/workflows/github-actions-ci-lint.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,60 @@
name: linter
# based on https://github.com/prontolabs/pronto/wiki/GitHub-Actions-Integration#rails-application-example-
on: [pull_request]

on:
push:
branches: [ i_amDisabl_ed]
name: Pronto

jobs:
test:

linters:
name: Linters
runs-on: ubuntu-latest

strategy:
matrix:
ruby-version: [2.7]
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Ruby
- run: |
git fetch --no-tags --prune --depth=10 origin +refs/heads/*:refs/remotes/origin/*

- name: Setup Ruby
uses: ruby/setup-ruby@v1

- name: Ruby gem cache
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-

- name: Install gems
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Find yarn cache location
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: JS package cache
uses: actions/cache@v1
with:
ruby-version: 2.7
bundler-cache: true
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
env:
RAILS_ENV: test
RAILS_GROUPS: build
run: bundle install
- name: Install packages
run: |
yarn install --pure-lockfile
yarn global add eslint

- name: Run linter
run: git diff --name-only origin/master | bundle exec xargs rubocop --force-exclusion --parallel
- name: Run Pronto
run: |
PRONTO_PULL_REQUEST_ID="${{ github.event.pull_request.number }}" PRONTO_GITHUB_ACCESS_TOKEN="${{ github.token }}" bundle exec pronto run -f github_status github_pr -c origin/${{ github.base_ref }}
2 changes: 2 additions & 0 deletions .pronto_eslint_npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# .pronto_eslint_npm.yml
files_to_lint: '(\.js|\.jsx|\.es6)$'
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ end

group :ci do
gem "pronto"
gem "pronto-eslint", require: false
gem "pronto-eslint_npm", require: false
gem "pronto-rubocop", require: false
end

Expand Down
12 changes: 5 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ GEM
railties (>= 3.2)
encryptor (3.0.0)
erubi (1.10.0)
eslintrb (2.1.0)
execjs
multi_json (>= 1.3)
rake
execjs (2.8.1)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -234,6 +230,8 @@ GEM
nio4r (2.5.8)
nokogiri (1.13.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.13.3-x86_64-linux)
racc (~> 1.4)
non-stupid-digest-assets (1.0.9)
sprockets (>= 2.0)
notiffany (0.1.3)
Expand Down Expand Up @@ -273,8 +271,7 @@ GEM
rexml (~> 3.2)
rugged (>= 0.23.0, < 1.1.0)
thor (>= 0.20.3, < 2.0)
pronto-eslint (0.11.0)
eslintrb (~> 2.0, >= 2.0.0)
pronto-eslint_npm (0.11.0)
pronto (~> 0.11.0)
pronto-rubocop (0.11.1)
pronto (~> 0.11.0)
Expand Down Expand Up @@ -461,6 +458,7 @@ GEM

PLATFORMS
x86_64-darwin-21
x86_64-linux

DEPENDENCIES
apartment-activejob-que
Expand Down Expand Up @@ -501,7 +499,7 @@ DEPENDENCIES
omniauth-canvas (~> 1.0.2)
pg
pronto
pronto-eslint
pronto-eslint_npm
pronto-rubocop
puma
que
Expand Down
4 changes: 4 additions & 0 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
class Ability
include CanCan::Ability

def linterShouldCatchThis

end

def initialize(user, context_id = nil)
# Define abilities for the passed in user here. For example:
#
Expand Down
3 changes: 3 additions & 0 deletions client/apps/hello_world/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import initResizeHandler from '../../common/libs/resize_iframe';

import './styles/styles';

function linter_should_catch_this() {
}

// Polyfill es6 promises for IE
es6Promise.polyfill();

Expand Down