Skip to content

Commit f0f6cd9

Browse files
committed
CI: Lint code on GH actions
Linting runs parallel to testing and circle ci is slow and our free plan has limited resources. Also GH actions are better integrated and has better dev feedback. (cherry picked from commit 7275966) # Conflicts: # .circleci/config.yml
1 parent d97e4e9 commit f0f6cd9

File tree

2 files changed

+62
-29
lines changed

2 files changed

+62
-29
lines changed

.circleci/config.yml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -235,34 +235,6 @@ commands:
235235
bundle exec rake -rrails -rspree/testing_support/extension_rake -e'Rake::Task["extension:test_app"].invoke'
236236
237237
jobs:
238-
lint_code:
239-
docker:
240-
- image: cimg/ruby:3.2-node
241-
environment:
242-
BUNDLE_ONLY: "lint"
243-
ESLINT_USE_FLAT_CONFIG: false
244-
steps:
245-
- checkout
246-
- run: 'bundle install'
247-
- run:
248-
name: Check Ruby
249-
command: |
250-
bundle exec rubocop --parallel --format junit --out "$PWD/test-results/rubocop-results.xml" --format progress
251-
- run:
252-
name: Check ERB
253-
command: |
254-
# enable recursive globbing with "**"
255-
shopt -s globstar
256-
257-
# we're only interested in errors
258-
bundle exec erb-format **/*.html.erb > /dev/null
259-
- run:
260-
name: Check JavaScript
261-
command: |
262-
npx -y eslint "**/*.js"
263-
- store_test_results:
264-
path: test-results
265-
266238
solidus_installer:
267239
executor:
268240
name: sqlite
@@ -345,7 +317,6 @@ jobs:
345317
workflows:
346318
build:
347319
jobs:
348-
- lint_code
349320
- solidus_installer
350321

351322
# Only test with coverage support with the default versions

.github/workflows/lint.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Lint
2+
3+
on: [pull_request]
4+
5+
concurrency:
6+
group: lint-${{ github.ref_name }}
7+
cancel-in-progress: ${{ github.ref_name != 'main' }}
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
BUNDLE_ONLY: "lint"
14+
15+
jobs:
16+
ruby:
17+
name: Check Ruby
18+
runs-on: ubuntu-22.04
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
- name: Install Ruby and gems
23+
uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: "3.2"
26+
bundler-cache: true
27+
- name: Lint Ruby files
28+
run: bin/rake lint:rb
29+
- name: Store test results
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: rubocop-results
33+
path: test-results
34+
35+
erb:
36+
name: Check ERB
37+
runs-on: ubuntu-22.04
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v3
41+
- name: Install Ruby and gems
42+
uses: ruby/setup-ruby@v1
43+
with:
44+
ruby-version: "3.2"
45+
bundler-cache: true
46+
- name: Lint ERB files
47+
run: bin/rake lint:erb
48+
49+
javascript:
50+
name: Check JavaScript
51+
runs-on: ubuntu-22.04
52+
env:
53+
ESLINT_USE_FLAT_CONFIG: false
54+
steps:
55+
- uses: actions/checkout@v3
56+
- name: Install Ruby and gems
57+
uses: ruby/setup-ruby@v1
58+
with:
59+
ruby-version: "3.2"
60+
bundler-cache: true
61+
- name: Lint JS files
62+
run: bin/rake lint:js

0 commit comments

Comments
 (0)