]> git.openstreetmap.org Git - rails.git/blob - .github/workflows/lint.yml
Move more api-related helper methods to ApiController
[rails.git] / .github / workflows / lint.yml
1 name: Lint
2 on:
3   - push
4   - pull_request
5 concurrency:
6   group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
7   cancel-in-progress: true
8 env:
9   os: ubuntu-20.04
10   ruby: '2.7'
11 jobs:
12   rubocop:
13     name: RuboCop
14     runs-on: ubuntu-20.04
15     steps:
16     - name: Check out code
17       uses: actions/checkout@v3
18     - name: Setup ruby
19       uses: ruby/setup-ruby@v1
20       with:
21         ruby-version: ${{ env.ruby }}
22         bundler-cache: true
23     - name: Run rubocop
24       run: bundle exec rubocop --format fuubar
25   erblint:
26     name: ERB Lint
27     runs-on: ubuntu-20.04
28     steps:
29     - name: Check out code
30       uses: actions/checkout@v3
31     - name: Setup ruby
32       uses: ruby/setup-ruby@v1
33       with:
34         ruby-version: ${{ env.ruby }}
35         bundler-cache: true
36     - name: Run erblint
37       run: bundle exec erblint .
38   eslint:
39     name: ESLint
40     runs-on: ubuntu-20.04
41     steps:
42     - name: Check out code
43       uses: actions/checkout@v3
44     - name: Setup ruby
45       uses: ruby/setup-ruby@v1
46       with:
47         ruby-version: ${{ env.ruby }}
48         bundler-cache: true
49     - name: Cache node modules
50       uses: actions/cache@v3
51       with:
52         path: node_modules
53         key: yarn-${{ env.os }}-${{ hashFiles('yarn.lock') }}
54         restore-keys: |
55           yarn-${{ env.os }}-
56     - name: Install node modules
57       run: bundle exec rails yarn:install
58     - name: Create dummy database configuration
59       run: cp config/example.database.yml config/database.yml
60     - name: Run eslint
61       run: bundle exec rails eslint
62   brakeman:
63     name: Brakeman
64     runs-on: ubuntu-20.04
65     steps:
66     - name: Check out code
67       uses: actions/checkout@v3
68     - name: Setup ruby
69       uses: ruby/setup-ruby@v1
70       with:
71         ruby-version: ${{ env.ruby }}
72         bundler-cache: true
73     - name: Run brakeman
74       run: bundle exec brakeman -q