2021-02-22 04:28:32 -05:00
|
|
|
name: Linting
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
2021-11-25 15:44:40 -05:00
|
|
|
concurrency:
|
2021-11-25 17:31:05 -05:00
|
|
|
group: linting-${{ format('{0}-{1}', github.head_ref || github.run_number, github.job) }}
|
2021-11-25 15:44:40 -05:00
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-07-30 11:22:03 -04:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2021-02-22 04:28:32 -05:00
|
|
|
jobs:
|
|
|
|
build:
|
2023-05-12 08:00:04 -04:00
|
|
|
if: github.event_name == 'pull_request' || github.repository != 'discourse/discourse-private-mirror'
|
2021-02-22 04:28:32 -05:00
|
|
|
name: run
|
2024-09-29 23:18:20 -04:00
|
|
|
runs-on: ${{ (github.repository != 'discourse/discourse' && 'ubuntu-latest') || 'debian-12' }}
|
2021-12-14 13:30:25 -05:00
|
|
|
container: discourse/discourse_test:slim
|
2021-02-22 04:28:32 -05:00
|
|
|
timeout-minutes: 30
|
|
|
|
|
|
|
|
steps:
|
2023-02-02 07:34:39 -05:00
|
|
|
- name: Set working directory owner
|
|
|
|
run: chown root:root .
|
|
|
|
|
2023-09-11 05:42:02 -04:00
|
|
|
- uses: actions/checkout@v4
|
2021-02-22 04:28:32 -05:00
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
|
|
|
|
- name: Setup Git
|
|
|
|
run: |
|
|
|
|
git config --global user.email "ci@ci.invalid"
|
|
|
|
git config --global user.name "Discourse CI"
|
|
|
|
|
|
|
|
- name: Bundler cache
|
2024-01-22 05:50:56 -05:00
|
|
|
uses: actions/cache@v4
|
2021-02-22 04:28:32 -05:00
|
|
|
with:
|
|
|
|
path: vendor/bundle
|
|
|
|
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
|
2023-05-12 08:00:04 -04:00
|
|
|
restore-keys: ${{ runner.os }}-gem-
|
2021-02-22 04:28:32 -05:00
|
|
|
|
|
|
|
- name: Setup gems
|
|
|
|
run: |
|
2022-01-12 16:50:04 -05:00
|
|
|
gem install bundler --conservative -v $(awk '/BUNDLED WITH/ { getline; gsub(/ /,""); print $0 }' Gemfile.lock)
|
2021-02-22 04:28:32 -05:00
|
|
|
bundle config --local path vendor/bundle
|
|
|
|
bundle config --local deployment true
|
|
|
|
bundle config --local without development
|
|
|
|
bundle install --jobs 4
|
|
|
|
bundle clean
|
|
|
|
|
2024-09-03 05:51:07 -04:00
|
|
|
- name: pnpm install
|
|
|
|
run: pnpm install --frozen-lockfile
|
2021-02-22 04:28:32 -05:00
|
|
|
|
|
|
|
- name: Rubocop
|
2022-09-21 09:32:21 -04:00
|
|
|
if: ${{ !cancelled() }}
|
2022-07-07 01:29:14 -04:00
|
|
|
run: bundle exec rubocop --parallel .
|
2021-02-22 04:28:32 -05:00
|
|
|
|
2023-01-07 06:11:08 -05:00
|
|
|
- name: syntax_tree
|
|
|
|
if: ${{ !cancelled() }}
|
2023-02-02 07:34:39 -05:00
|
|
|
run: |
|
|
|
|
set -E
|
2023-08-10 07:59:13 -04:00
|
|
|
bundle exec stree check Gemfile $(git ls-files '*.rb') $(git ls-files '*.rake') $(git ls-files '*.thor')
|
2023-01-07 06:11:08 -05:00
|
|
|
|
2021-02-22 04:28:32 -05:00
|
|
|
- name: ESLint (core)
|
2022-09-21 09:32:21 -04:00
|
|
|
if: ${{ !cancelled() }}
|
2024-09-03 05:51:07 -04:00
|
|
|
run: pnpm lint:js
|
2021-02-22 04:28:32 -05:00
|
|
|
|
|
|
|
- name: ESLint (core plugins)
|
2022-09-21 09:32:21 -04:00
|
|
|
if: ${{ !cancelled() }}
|
2024-09-03 05:51:07 -04:00
|
|
|
run: pnpm lint:js-plugins
|
2021-02-22 04:28:32 -05:00
|
|
|
|
|
|
|
- name: Prettier
|
2022-09-21 09:32:21 -04:00
|
|
|
if: ${{ !cancelled() }}
|
2021-02-22 04:28:32 -05:00
|
|
|
run: |
|
2024-09-03 05:51:07 -04:00
|
|
|
pnpm prettier -v
|
|
|
|
pnpm lint:prettier
|
2021-02-22 04:28:32 -05:00
|
|
|
|
|
|
|
- name: Ember template lint
|
2022-09-21 09:32:21 -04:00
|
|
|
if: ${{ !cancelled() }}
|
2024-09-03 05:51:07 -04:00
|
|
|
run: pnpm lint:hbs
|
2021-02-22 04:28:32 -05:00
|
|
|
|
|
|
|
- name: English locale lint (core)
|
2022-09-21 09:32:21 -04:00
|
|
|
if: ${{ !cancelled() }}
|
2021-02-22 04:28:32 -05:00
|
|
|
run: bundle exec ruby script/i18n_lint.rb "config/**/locales/{client,server}.en.yml"
|
|
|
|
|
|
|
|
- name: English locale lint (core plugins)
|
2022-09-21 09:32:21 -04:00
|
|
|
if: ${{ !cancelled() }}
|
2021-02-22 04:28:32 -05:00
|
|
|
run: bundle exec ruby script/i18n_lint.rb "plugins/**/locales/{client,server}.en.yml"
|
2024-10-29 12:55:31 -04:00
|
|
|
|
|
|
|
- name: Glint
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
run: pnpm glint -p jsconfig.json
|