1
0
mirror of synced 2026-08-04 06:06:55 +00:00

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
9 changed files with 91 additions and 72 deletions
-43
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
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 .
@@ -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