Skip to content

Commit 6601d0c

Browse files
committed
Run RuboCop in CI
1 parent 9769be2 commit 6601d0c

File tree

3 files changed

+66
-25
lines changed

3 files changed

+66
-25
lines changed

.github/workflows/lint.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: "RuboCop"
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
rubocop:
9+
name: "RuboCop Analysis"
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: "Checkout the repository"
13+
uses: actions/checkout@v4
14+
with:
15+
ref: ${{ github.event.pull_request.head.sha }}
16+
fetch-depth: 2
17+
18+
- name: "Update and Install Dependencies"
19+
run: |
20+
sudo apt update
21+
sudo apt install libcurl4 libcurl4-openssl-dev
22+
23+
- name: "Setting up Ruby"
24+
uses: ruby/setup-ruby@v1
25+
with:
26+
bundler-cache: true
27+
28+
- name: "Configure Bundle testing and install gems"
29+
run: |
30+
bundle config unset --local without
31+
bundle config set --local with 'development'
32+
bundle install
33+
34+
- name: "Run RuboCop"
35+
run: |
36+
bundle exec rubocop --display-only-safe-correctable
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,57 @@
1-
name: 'BrowserStack Test'
1+
name: "BrowserStack Test"
22

33
on:
44
pull_request_target:
5-
branches: [ master ]
6-
7-
jobs:
5+
branches: [master]
6+
7+
jobs:
88
ubuntu-job:
9-
name: 'BrowserStack Test on Ubuntu'
10-
runs-on: ubuntu-latest # Can be self-hosted runner also
9+
name: "BrowserStack Test on Ubuntu"
10+
runs-on: ubuntu-latest # Can be self-hosted runner also
1111
environment:
1212
name: Integrate Pull Request
13-
env:
13+
env:
1414
GITACTIONS: true
1515
steps:
16-
17-
- name: 'BrowserStack Env Setup' # Invokes the setup-env action
16+
- name: "BrowserStack Env Setup" # Invokes the setup-env action
1817
uses: browserstack/github-actions/setup-env@master
1918
with:
20-
username: ${{ secrets.BROWSERSTACK_USERNAME }}
19+
username: ${{ secrets.BROWSERSTACK_USERNAME }}
2120
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
2221

23-
- name: 'BrowserStack Local Tunnel Setup' # Invokes the setup-local action
22+
- name: "BrowserStack Local Tunnel Setup" # Invokes the setup-local action
2423
uses: browserstack/github-actions/setup-local@master
2524
with:
2625
local-testing: start
2726
local-identifier: random
2827

29-
- name: 'Checkout the repository'
28+
- name: "Checkout the repository"
3029
uses: actions/checkout@v4
3130
with:
3231
ref: ${{ github.event.pull_request.head.sha }}
3332
fetch-depth: 2
3433

35-
- name: 'Setting up Ruby'
36-
uses: ruby/setup-ruby@v1
37-
# Ruby version is defined in .ruby-version file
38-
39-
- name: 'Update and Install Dependencies'
34+
- name: "Update and Install Dependencies"
4035
run: |
4136
sudo apt update
4237
sudo apt install libcurl4 libcurl4-openssl-dev
43-
- name: 'Configure Bundle testing and install gems'
38+
39+
- name: "Setting up Ruby"
40+
uses: ruby/setup-ruby@v1
41+
with:
42+
bundler-cache: true
43+
44+
- name: "Configure Bundle testing and install gems"
4445
run: |
4546
bundle config unset --local without
46-
bundle config set --local with 'test' 'development'
47+
bundle config set --local with 'test'
4748
bundle install
48-
- name: 'Run BrowserStack simple verification'
49+
50+
- name: "Run BrowserStack simple verification"
4951
run: |
5052
bundle exec rake browserstack --trace
5153
52-
- name: 'BrowserStackLocal Stop' # Terminating the BrowserStackLocal tunnel connection
54+
- name: "BrowserStackLocal Stop" # Terminating the BrowserStackLocal tunnel connection
5355
uses: browserstack/github-actions/setup-local@master
5456
with:
55-
local-testing: stop
57+
local-testing: stop

Gemfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# See the file 'doc/COPYING' for copying permission
55
#
66

7+
source 'https://rubygems.org'
8+
79
gem 'net-smtp', require: false
810
gem 'json'
911

@@ -24,7 +26,6 @@ gem 'rake', '~> 13.3'
2426
gem 'activerecord', '~> 8.1'
2527
gem 'otr-activerecord', '~> 2.6.0'
2628
gem 'sqlite3', '~> 2.8'
27-
gem 'rubocop', '~> 1.81.7', require: false
2829

2930
# Geolocation support
3031
group :geoip do
@@ -59,6 +60,10 @@ group :ext_qrcode do
5960
gem 'qr4r', '~> 0.6.1'
6061
end
6162

63+
group :development do
64+
gem 'rubocop', '~> 1.81.7', require: false
65+
end
66+
6267
# For running unit tests
6368
group :test do
6469
gem 'test-unit-full', '~> 0.0.5'
@@ -86,5 +91,3 @@ group :test do
8691
# sudo port install libxml2 libxslt
8792
gem 'capybara', '~> 3.40'
8893
end
89-
90-
source 'https://rubygems.org'

0 commit comments

Comments
 (0)