2020-09-25 12:47:02 -04:00
|
|
|
name: Linting
|
|
|
|
|
2020-10-09 11:09:43 -04:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
pull_request:
|
2020-09-25 12:47:02 -04:00
|
|
|
|
2022-01-25 05:39:43 -05:00
|
|
|
concurrency:
|
|
|
|
group: plugin-linting-${{ format('{0}-{1}', github.head_ref || github.run_number, github.job) }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-09-25 12:47:02 -04:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2022-03-22 09:03:16 -04:00
|
|
|
- uses: actions/checkout@v3
|
2020-09-25 12:47:02 -04:00
|
|
|
|
2020-10-09 11:09:43 -04:00
|
|
|
- name: Set up Node.js
|
2022-03-22 09:03:16 -04:00
|
|
|
uses: actions/setup-node@v3
|
2020-10-09 11:09:43 -04:00
|
|
|
with:
|
2022-11-07 13:32:48 -05:00
|
|
|
node-version: 18
|
2021-12-16 11:18:12 -05:00
|
|
|
cache: yarn
|
|
|
|
|
|
|
|
- name: Yarn install
|
|
|
|
run: yarn install
|
2020-09-25 12:47:02 -04:00
|
|
|
|
2020-10-09 11:09:43 -04:00
|
|
|
- name: Set up ruby
|
2021-07-05 14:58:19 -04:00
|
|
|
uses: ruby/setup-ruby@v1
|
2020-10-09 11:09:43 -04:00
|
|
|
with:
|
|
|
|
ruby-version: 2.7
|
2021-07-05 14:58:19 -04:00
|
|
|
bundler-cache: true
|
2020-09-25 12:47:02 -04:00
|
|
|
|
2020-10-09 11:09:43 -04:00
|
|
|
- name: ESLint
|
2022-11-07 13:32:48 -05:00
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
run: yarn eslint --ext .js,.js.es6 --no-error-on-unmatched-pattern {test,assets,admin/assets}/javascripts
|
2020-09-25 12:47:02 -04:00
|
|
|
|
2020-10-09 11:09:43 -04:00
|
|
|
- name: Prettier
|
2022-11-07 13:32:48 -05:00
|
|
|
if: ${{ !cancelled() }}
|
2021-07-05 14:58:19 -04:00
|
|
|
shell: bash
|
2020-10-09 11:09:43 -04:00
|
|
|
run: |
|
|
|
|
yarn prettier -v
|
2022-11-07 13:32:48 -05:00
|
|
|
if [ 0 -lt $(find assets admin/assets -type f \( -name "*.scss" -or -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
|
2021-07-05 14:58:19 -04:00
|
|
|
yarn prettier --list-different "assets/**/*.{scss,js,es6}"
|
2020-10-09 15:03:10 -04:00
|
|
|
fi
|
2021-09-15 13:45:44 -04:00
|
|
|
if [ 0 -lt $(find test -type f \( -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
|
2021-07-05 14:58:19 -04:00
|
|
|
yarn prettier --list-different "test/**/*.{js,es6}"
|
2021-01-04 15:12:20 -05:00
|
|
|
fi
|
2020-09-25 12:47:02 -04:00
|
|
|
|
2021-07-05 14:58:19 -04:00
|
|
|
- name: Ember template lint
|
2022-11-07 13:32:48 -05:00
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
run: yarn ember-template-lint --no-error-on-unmatched-pattern assets/javascripts admin/assets/javascripts
|
2021-07-05 14:58:19 -04:00
|
|
|
|
2020-10-09 11:09:43 -04:00
|
|
|
- name: Rubocop
|
2022-11-07 13:32:48 -05:00
|
|
|
if: ${{ !cancelled() }}
|
2020-10-09 11:09:43 -04:00
|
|
|
run: bundle exec rubocop .
|
2022-12-29 07:31:29 -05:00
|
|
|
|
|
|
|
- name: Syntax Tree
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
run: |
|
|
|
|
if test -f .streerc; then
|
|
|
|
bundle exec stree check Gemfile $(git ls-files '*.rb') $(git ls-files '*.rake')
|
|
|
|
else
|
|
|
|
echo "Stree config not detected for this repository. Skipping."
|
|
|
|
fi
|