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