DEV: CI Updates (#30)

This commit is contained in:
Justin DiRose 2020-11-02 11:57:36 -06:00 committed by GitHub
parent be9e9c0117
commit 17bd58afa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 91 additions and 72 deletions

View File

@ -4,4 +4,3 @@
},
"extends": "eslint-config-discourse"
}

View File

@ -1,43 +0,0 @@
name: Linting
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Set up ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7
architecture: 'x64'
- name: Setup bundler
run: gem install bundler -v 2.1.4 --no-doc
- name: Setup gems
run: bundle install --jobs 4
- name: Yarn install
run: yarn install --dev
- name: ESLint
run: yarn eslint --ext .js --ext .es6 assets/javascripts
- name: Prettier
run: |
yarn prettier -v
yarn prettier --list-different \
"assets/stylesheets/**/*.scss" \
"assets/javascripts/**/*.{js,es6}"
- name: Rubocop
run: bundle exec rubocop .

47
.github/workflows/plugin-linting.yml vendored Normal file
View File

@ -0,0 +1,47 @@
name: Linting
on:
push:
branches:
- master
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 12
- name: Set up ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7
- name: Setup bundler
run: gem install bundler -v 2.1.4 --no-doc
- name: Setup gems
run: bundle install --jobs 4
- name: Yarn install
run: yarn install --dev
- name: ESLint
run: yarn eslint --ext .js,.js.es6 --no-error-on-unmatched-pattern assets/javascripts
- name: Prettier
run: |
yarn prettier -v
if [ -d "assets" ]; then \
yarn prettier --list-different "assets/**/*.{scss,js,es6}" ; \
fi
- name: Rubocop
run: bundle exec rubocop .

View File

@ -1,6 +1,11 @@
name: Plugin Tests
on: [push, pull_request]
on:
push:
branches:
- master
- main
pull_request:
jobs:
build:
@ -23,7 +28,7 @@ jobs:
matrix:
build_types: ["BACKEND", "FRONTEND"]
target: ["PLUGINS", "CORE"]
target: ["PLUGINS"]
os: [ubuntu-latest]
ruby: ["2.6"]
postgres: ["12"]
@ -49,18 +54,30 @@ jobs:
with:
repository: discourse/discourse
fetch-depth: 1
- name: Install plugin
uses: actions/checkout@master
with:
path: plugins/${{ github.event.repository.name }}
fetch-depth: 1
fetch-depth: 1
- name: Check spec existence
id: check_spec
uses: andstor/file-existence-action@v1
with:
files: "plugins/${{ github.event.repository.name }}/spec"
- name: Check qunit existence
id: check_qunit
uses: andstor/file-existence-action@v1
with:
files: "plugins/${{ github.event.repository.name }}/test/javascripts"
- name: Setup Git
run: |
git config --global user.email "ci@ci.invalid"
git config --global user.name "Discourse CI"
- name: Setup packages
run: |
sudo apt-get update
@ -91,7 +108,7 @@ jobs:
bundle config without 'development'
- name: Bundler cache
uses: actions/cache@v1
uses: actions/cache@v2
id: bundler-cache
with:
path: vendor/bundle
@ -107,7 +124,7 @@ jobs:
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Yarn cache
uses: actions/cache@v1
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
@ -122,7 +139,7 @@ jobs:
run: |
bin/rake db:create
bin/rake db:migrate
- name: Create parallel databases
if: env.BUILD_TYPE == 'BACKEND' && env.TARGET == 'CORE'
run: |
@ -134,17 +151,17 @@ jobs:
run: |
bin/turbo_rspec
bin/rake plugin:spec
- name: Plugin RSpec
if: env.BUILD_TYPE == 'BACKEND' && env.TARGET == 'PLUGINS'
if: env.BUILD_TYPE == 'BACKEND' && env.TARGET == 'PLUGINS' && steps.check_spec.outputs.files_exists == 'true'
run: bin/rake plugin:spec[${{ github.event.repository.name }}]
- name: Core QUnit
if: env.BUILD_TYPE == 'FRONTEND' && env.TARGET == 'CORE'
run: bundle exec rake qunit:test['1200000']
timeout-minutes: 30
- name: Plugin QUnit # Tests core plugins in TARGET=CORE, and all plugins in TARGET=PLUGINS
if: env.BUILD_TYPE == 'FRONTEND'
- name: Plugin QUnit
if: env.BUILD_TYPE == 'FRONTEND' && env.TARGET == 'PLUGINS' && steps.check_qunit.outputs.files_exists == 'true'
run: bundle exec rake plugin:qunit['${{ github.event.repository.name }}','1200000']
timeout-minutes: 30

8
.gitignore vendored
View File

@ -1,8 +1,2 @@
.DS_Store
node_modules
gems
log
.byebug_history
/.idea
node_modules/
.bundle/
auto_generated

1
.prettierrc Normal file
View File

@ -0,0 +1 @@
{}

4
.template-lintrc.js Normal file
View File

@ -0,0 +1,4 @@
module.exports = {
plugins: ["ember-template-lint-plugin-discourse"],
extends: "discourse:recommended",
};

View File

@ -5,6 +5,6 @@
"author": "Discourse",
"license": "MIT",
"devDependencies": {
"eslint-config-discourse": "latest"
"eslint-config-discourse": "^1.1.3"
}
}

View File

@ -498,10 +498,10 @@ escape-string-regexp@^1.0.5:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
eslint-config-discourse@latest:
version "1.1.3"
resolved "https://registry.yarnpkg.com/eslint-config-discourse/-/eslint-config-discourse-1.1.3.tgz#38b85e810cad72280073d659565bf25611331ac3"
integrity sha512-n6ZRuFPMVn+jHpszZhNQwFRsIG1mRq5LrFdbN/WNDW7ohk+iyYyLkwB8btJFms5CcfHLsiiey92EAh3oNavrpw==
eslint-config-discourse@^1.1.3:
version "1.1.6"
resolved "https://registry.yarnpkg.com/eslint-config-discourse/-/eslint-config-discourse-1.1.6.tgz#3080da848de09a0e533076b817d9cf865df7d571"
integrity sha512-K14qBtyJJeL/5njtksnSgViuTZWk3hjO1kOTqV2iTpukeRlItfJpeOpUhkwm08SBDYEKCH2Ahn/XYWR0RZ75zA==
dependencies:
babel-eslint "^10.1.0"
ember-template-lint "^2.11.0"
@ -511,7 +511,7 @@ eslint-config-discourse@latest:
eslint-plugin-ember "^6.10.0"
eslint-plugin-lodash "^7.1.0"
eslint-plugin-node "^8.0.0"
prettier "^2.1.1"
prettier "2.1.2"
eslint-plugin-discourse-ember@latest:
version "0.0.3"
@ -1204,7 +1204,7 @@ prelude-ls@~1.1.2:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=
prettier@^2.1.1:
prettier@2.1.2:
version "2.1.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.1.2.tgz#3050700dae2e4c8b67c4c3f666cdb8af405e1ce5"
integrity sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==