DEV: Update CI workflows (#23)

Updates CI from discourse/.github

Co-authored-by: justindirose <justindirose@users.noreply.github.com>
This commit is contained in:
discoursebot 2021-01-11 14:45:20 -06:00 committed by GitHub
parent 25d3fbdfed
commit 0d396f921e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 60 deletions

View File

@ -34,7 +34,7 @@ jobs:
run: yarn install --dev run: yarn install --dev
- name: ESLint - name: ESLint
run: yarn eslint --ext .js,.js.es6 --no-error-on-unmatched-pattern assets/javascripts run: yarn eslint --ext .js,.js.es6 --no-error-on-unmatched-pattern {test,assets}/javascripts
- name: Prettier - name: Prettier
run: | run: |
@ -42,6 +42,9 @@ jobs:
if [ -d "assets" ]; then \ if [ -d "assets" ]; then \
yarn prettier --list-different "assets/**/*.{scss,js,es6}" ; \ yarn prettier --list-different "assets/**/*.{scss,js,es6}" ; \
fi fi
if [ -d "test" ]; then \
yarn prettier --list-different "test/**/*.{js,es6}" ; \
fi
- name: Rubocop - name: Rubocop
run: bundle exec rubocop . run: bundle exec rubocop .

View File

@ -9,15 +9,13 @@ on:
jobs: jobs:
build: build:
name: "${{ matrix.target }}-${{ matrix.build_types }}" name: ${{ matrix.build_type }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
timeout-minutes: 60 timeout-minutes: 60
env: env:
DISCOURSE_HOSTNAME: www.example.com DISCOURSE_HOSTNAME: www.example.com
RUBY_GLOBAL_METHOD_CACHE_SIZE: 131072 RUBY_GLOBAL_METHOD_CACHE_SIZE: 131072
BUILD_TYPE: ${{ matrix.build_types }}
TARGET: ${{ matrix.target }}
RAILS_ENV: test RAILS_ENV: test
PGHOST: localhost PGHOST: localhost
PGUSER: discourse PGUSER: discourse
@ -27,8 +25,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
build_types: ["BACKEND", "FRONTEND"] build_type: ["backend", "frontend"]
target: ["PLUGINS"]
os: [ubuntu-latest] os: [ubuntu-latest]
ruby: ["2.6"] ruby: ["2.6"]
postgres: ["12"] postgres: ["12"]
@ -85,7 +82,7 @@ jobs:
wget -qO- https://raw.githubusercontent.com/discourse/discourse_docker/master/image/base/install-pngquant | sudo sh wget -qO- https://raw.githubusercontent.com/discourse/discourse_docker/master/image/base/install-pngquant | sudo sh
- name: Update imagemagick - name: Update imagemagick
if: env.BUILD_TYPE == 'BACKEND' if: matrix.build_type == 'backend'
run: | run: |
wget https://raw.githubusercontent.com/discourse/discourse_docker/master/image/base/install-imagemagick wget https://raw.githubusercontent.com/discourse/discourse_docker/master/image/base/install-imagemagick
chmod +x install-imagemagick chmod +x install-imagemagick
@ -140,28 +137,11 @@ jobs:
bin/rake db:create bin/rake db:create
bin/rake db:migrate bin/rake db:migrate
- name: Create parallel databases
if: env.BUILD_TYPE == 'BACKEND' && env.TARGET == 'CORE'
run: |
bin/rake parallel:create
bin/rake parallel:migrate
- name: Core RSpec
if: env.BUILD_TYPE == 'BACKEND' && env.TARGET == 'CORE'
run: |
bin/turbo_rspec
bin/rake plugin:spec
- name: Plugin RSpec - name: Plugin RSpec
if: env.BUILD_TYPE == 'BACKEND' && env.TARGET == 'PLUGINS' && steps.check_spec.outputs.files_exists == 'true' if: matrix.build_type == 'backend' && steps.check_spec.outputs.files_exists == 'true'
run: bin/rake plugin:spec[${{ github.event.repository.name }}] 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 - name: Plugin QUnit
if: env.BUILD_TYPE == 'FRONTEND' && env.TARGET == 'PLUGINS' && steps.check_qunit.outputs.files_exists == 'true' if: matrix.build_type == 'frontend' && steps.check_qunit.outputs.files_exists == 'true'
run: bundle exec rake plugin:qunit['${{ github.event.repository.name }}','1200000'] run: bundle exec rake plugin:qunit['${{ github.event.repository.name }}','1200000']
timeout-minutes: 30 timeout-minutes: 30

View File

@ -1,32 +1,32 @@
import { acceptance, queryAll } from 'helpers/qunit-helpers'; import { acceptance, queryAll } from "helpers/qunit-helpers";
import docsFixtures from '../fixtures/docs'; import docsFixtures from "../fixtures/docs";
acceptance('Knowledge Explorer', function (needs) { acceptance("Knowledge Explorer", function (needs) {
needs.user(); needs.user();
needs.settings({ needs.settings({
knowledge_explorer_enabled: true, knowledge_explorer_enabled: true,
}); });
needs.pretender((server, helper) => { needs.pretender((server, helper) => {
server.get('/docs.json', () => helper.response(docsFixtures)); server.get("/docs.json", () => helper.response(docsFixtures));
}); });
test('index page', async function (assert) { test("index page", async function (assert) {
await visit('/'); await visit("/");
await click('#toggle-hamburger-menu'); await click("#toggle-hamburger-menu");
await click('.knowledge-explorer-link'); await click(".knowledge-explorer-link");
assert.equal( assert.equal(
queryAll('.knowledge-explorer-category')[0].innerText.trim(), queryAll(".knowledge-explorer-category")[0].innerText.trim(),
'bug 119' "bug 119"
); );
assert.equal( assert.equal(
queryAll('.knowledge-explorer-tag')[0].innerText.trim(), queryAll(".knowledge-explorer-tag")[0].innerText.trim(),
'something 74' "something 74"
); );
assert.equal( assert.equal(
queryAll('.knowledge-explorer-topic-link')[0].innerText.trim(), queryAll(".knowledge-explorer-topic-link")[0].innerText.trim(),
'Importing from Software X' "Importing from Software X"
); );
}); });
}); });

View File

@ -1,7 +1,7 @@
export default { export default {
tags: [ tags: [
{ {
id: 'something', id: "something",
count: 74, count: 74,
active: false, active: false,
}, },
@ -17,34 +17,34 @@ export default {
users: [ users: [
{ {
id: 2, id: 2,
username: 'cvx', username: "cvx",
name: 'Jarek', name: "Jarek",
avatar_template: '/letter_avatar/cvx/{size}/2.png', avatar_template: "/letter_avatar/cvx/{size}/2.png",
}, },
], ],
primary_groups: [], primary_groups: [],
topic_list: { topic_list: {
can_create_topic: true, can_create_topic: true,
draft: null, draft: null,
draft_key: 'new_topic', draft_key: "new_topic",
draft_sequence: 94, draft_sequence: 94,
per_page: 30, per_page: 30,
top_tags: ['something'], top_tags: ["something"],
topics: [ topics: [
{ {
id: 54881, id: 54881,
title: 'Importing from Software X', title: "Importing from Software X",
fancy_title: 'Importing from Software X', fancy_title: "Importing from Software X",
slug: 'importing-from-software-x', slug: "importing-from-software-x",
posts_count: 112, posts_count: 112,
reply_count: 72, reply_count: 72,
highest_post_number: 122, highest_post_number: 122,
image_url: null, image_url: null,
created_at: '2016-12-28T14:59:29.396Z', created_at: "2016-12-28T14:59:29.396Z",
last_posted_at: '2020-11-14T16:21:35.720Z', last_posted_at: "2020-11-14T16:21:35.720Z",
bumped: true, bumped: true,
bumped_at: '2020-11-14T16:21:35.720Z', bumped_at: "2020-11-14T16:21:35.720Z",
archetype: 'regular', archetype: "regular",
unseen: false, unseen: false,
pinned: false, pinned: false,
unpinned: null, unpinned: null,
@ -53,11 +53,11 @@ export default {
archived: false, archived: false,
bookmarked: null, bookmarked: null,
liked: null, liked: null,
tags: ['something'], tags: ["something"],
views: 15222, views: 15222,
like_count: 167, like_count: 167,
has_summary: true, has_summary: true,
last_poster_username: 'cvx', last_poster_username: "cvx",
category_id: 1, category_id: 1,
pinned_globally: false, pinned_globally: false,
featured_link: null, featured_link: null,
@ -65,19 +65,19 @@ export default {
posters: [ posters: [
{ {
extras: null, extras: null,
description: 'Original Poster', description: "Original Poster",
user_id: 2, user_id: 2,
primary_group_id: null, primary_group_id: null,
}, },
{ {
extras: null, extras: null,
description: 'Frequent Poster', description: "Frequent Poster",
user_id: 2, user_id: 2,
primary_group_id: null, primary_group_id: null,
}, },
{ {
extras: 'latest', extras: "latest",
description: 'Most Recent Poster', description: "Most Recent Poster",
user_id: 2, user_id: 2,
primary_group_id: null, primary_group_id: null,
}, },
@ -85,7 +85,7 @@ export default {
}, },
], ],
}, },
load_more_url: '/docs.json?page=1', load_more_url: "/docs.json?page=1",
}, },
search_count: null, search_count: null,
}; };