DEV: Update CI workflows (#61)

* DEV: Update CI workflows

* DEV: Fix template linting issues

Co-authored-by: CvX <CvX@users.noreply.github.com>
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
This commit is contained in:
discoursebot 2021-02-11 04:42:26 -06:00 committed by GitHub
parent 6beefdb49d
commit 2e15402cf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 197 additions and 180 deletions

View File

@ -20,13 +20,10 @@ jobs:
node-version: 12 node-version: 12
- name: Set up ruby - name: Set up ruby
uses: actions/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: 2.7 ruby-version: 2.7
- name: Setup bundler
run: gem install bundler -v 2.1.4 --no-doc
- name: Setup gems - name: Setup gems
run: bundle install --jobs 4 run: bundle install --jobs 4
@ -46,5 +43,8 @@ jobs:
yarn prettier --list-different "test/**/*.{js,es6}" ; \ yarn prettier --list-different "test/**/*.{js,es6}" ; \
fi fi
- name: Ember template lint
run: yarn ember-template-lint assets/javascripts
- name: Rubocop - name: Rubocop
run: bundle exec rubocop . run: bundle exec rubocop .

View File

@ -10,7 +10,7 @@ on:
jobs: jobs:
build: build:
name: ${{ matrix.build_type }} name: ${{ matrix.build_type }}
runs-on: ${{ matrix.os }} runs-on: ubuntu-latest
timeout-minutes: 60 timeout-minutes: 60
env: env:
@ -26,8 +26,7 @@ jobs:
matrix: matrix:
build_type: ["backend", "frontend"] build_type: ["backend", "frontend"]
os: [ubuntu-latest] ruby: ["2.7"]
ruby: ["2.6"]
postgres: ["12"] postgres: ["12"]
redis: ["4.x"] redis: ["4.x"]
@ -47,13 +46,13 @@ jobs:
--health-retries 5 --health-retries 5
steps: steps:
- uses: actions/checkout@master - uses: actions/checkout@v2
with: with:
repository: discourse/discourse repository: discourse/discourse
fetch-depth: 1 fetch-depth: 1
- name: Install plugin - name: Install plugin
uses: actions/checkout@master uses: actions/checkout@v2
with: with:
path: plugins/${{ github.event.repository.name }} path: plugins/${{ github.event.repository.name }}
fetch-depth: 1 fetch-depth: 1
@ -94,27 +93,14 @@ jobs:
redis-version: ${{ matrix.redis }} redis-version: ${{ matrix.redis }}
- name: Setup ruby - name: Setup ruby
uses: actions/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: ${{ matrix.ruby }} ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Setup bundler - name: Lint English locale
run: | if: matrix.build_type == 'backend'
gem install bundler -v 2.1.4 --no-doc run: bundle exec ruby script/i18n_lint.rb "plugins/${{ github.event.repository.name }}/locales/{client,server}.en.yml"
bundle config deployment 'true'
bundle config without 'development'
- name: Bundler cache
uses: actions/cache@v2
id: bundler-cache
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gem-
- name: Setup gems
run: bundle install --jobs 4
- name: Get yarn cache directory - name: Get yarn cache directory
id: yarn-cache-dir id: yarn-cache-dir

View File

@ -1,4 +1,4 @@
{{#d-modal-body id="chat_integration_error_modal"}} {{#d-modal-body id="chat_integration_error_modal"}}
<h4>{{i18n model.error_key}}</h4> <h4>{{i18n model.error_key}}</h4>
<pre>{{model.error_info}}</pre> <pre>{{model.error_info}}</pre>
{{/d-modal-body}} {{/d-modal-body}}

View File

@ -2,54 +2,58 @@
<div> <div>
<form {{action "save" on="submit"}}> <form {{action "save" on="submit"}}>
<table> <table>
<tbody>
<tr class="input">
<td class="label"><label for='provider'>{{i18n "chat_integration.edit_channel_modal.provider"}}</label></td>
<td>
{{i18n (concat 'chat_integration.provider.' model.channel.provider '.title')}}
</td>
</tr>
<tr class="chat-instructions">
<td></td>
<td></td>
</tr>
{{#each model.provider.channel_parameters as |param|}}
<tr class="input"> <tr class="input">
<td class="label"><label for='param-{{param.key}}'>{{i18n (concat 'chat_integration.provider.' model.channel.provider '.param.' param.key '.title')}}</label></td> <td class="label"><label for="provider">{{i18n "chat_integration.edit_channel_modal.provider"}}</label></td>
<td> <td>
{{text-field {{i18n (concat "chat_integration.provider." model.channel.provider ".title")}}
name=(concat 'param-' param.key)
value=(mut (get model.channel.data param.key))
}}
&nbsp;
{{#if (get model.channel.data param.key)}}
{{input-tip validation=(get paramValidation param.key)}}
{{/if}}
</td> </td>
</tr> </tr>
<tr class="chat-instructions"> <tr class="chat-instructions">
<td></td> <td></td>
<td><label>{{i18n (concat 'chat_integration.provider.' model.channel.provider '.param.' param.key '.help')}}</label></td> <td></td>
</tr> </tr>
{{/each}}
</table>
{{#each model.provider.channel_parameters as |param|}}
<tr class="input">
<td class="label"><label for="param-{{param.key}}">{{i18n (concat "chat_integration.provider." model.channel.provider ".param." param.key ".title")}}</label></td>
<td>
{{text-field
name=(concat "param-" param.key)
value=(mut (get model.channel.data param.key))
}}
&nbsp;
{{#if (get model.channel.data param.key)}}
{{input-tip validation=(get paramValidation param.key)}}
{{/if}}
</td>
</tr>
<tr class="chat-instructions">
<td></td>
<td><label>{{i18n (concat "chat_integration.provider." model.channel.provider ".param." param.key ".help")}}</label></td>
</tr>
{{/each}}
</tbody>
</table>
</form> </form>
</div> </div>
{{/d-modal-body}} {{/d-modal-body}}
<div class="modal-footer"> <div class="modal-footer">
{{d-button id="save-channel" {{d-button id="save-channel"
class='btn-primary btn-large' class="btn-primary btn-large"
action="save" action="save"
title="chat_integration.edit_channel_modal.save" title="chat_integration.edit_channel_modal.save"
label="chat_integration.edit_channel_modal.save" label="chat_integration.edit_channel_modal.save"
disabled=saveDisabled}} disabled=saveDisabled
}}
{{d-button class="btn-large" {{d-button class="btn-large"
action="cancel" action="cancel"
title="chat_integration.edit_channel_modal.cancel" title="chat_integration.edit_channel_modal.cancel"
label="chat_integration.edit_channel_modal.cancel"}} label="chat_integration.edit_channel_modal.cancel"
}}
</div> </div>

View File

@ -2,110 +2,119 @@
<div> <div>
<form {{action "save" on="submit"}}> <form {{action "save" on="submit"}}>
<table> <table>
<tbody>
<tr class="input">
<td class="label"><label for='provider'>{{i18n "chat_integration.edit_rule_modal.provider"}}</label></td>
<td>
{{i18n (concat 'chat_integration.provider.' model.channel.provider '.title')}}
</td>
</tr>
<tr class="chat-instructions">
<td></td>
<td></td>
</tr>
<tr class="input">
<td class="label"><label for='channel'>{{i18n "chat_integration.edit_rule_modal.channel"}}</label></td>
<td>
{{channel-data provider=model.provider channel=model.channel}}
</td>
</tr>
<tr class="chat-instructions">
<td></td>
<td></td>
</tr>
<tr class="input">
<td class="label"><label for='filter'>{{i18n "chat_integration.edit_rule_modal.type"}}</label></td>
<td>
{{combo-box name="type" content=model.rule.available_types value=model.rule.type}}
</td>
</tr>
<tr class="chat-instructions">
<td></td>
<td><label>{{i18n 'chat_integration.edit_rule_modal.instructions.type'}}</label></td>
</tr>
<tr class="input">
<td class="label"><label for='filter'>{{i18n "chat_integration.edit_rule_modal.filter"}}</label></td>
<td>
{{combo-box name="filter" content=model.rule.available_filters value=model.rule.filter}}
</td>
</tr>
<tr class="chat-instructions">
<td></td>
<td><label>{{i18n 'chat_integration.edit_rule_modal.instructions.filter'}}</label></td>
</tr>
{{#if showCategory}}
<tr class="input"> <tr class="input">
<td class="label"><label for='category'>{{i18n "chat_integration.edit_rule_modal.category"}}</label></td> <td class="label"><label for="provider">{{i18n "chat_integration.edit_rule_modal.provider"}}</label></td>
<td> <td>
{{category-chooser {{i18n (concat "chat_integration.provider." model.channel.provider ".title")}}
name="category"
value=model.rule.category_id
rootNoneLabel="chat_integration.all_categories"
rootNone=true
overrideWidths=false}}
</td> </td>
</tr> </tr>
<tr class="chat-instructions"> <tr class="chat-instructions">
<td></td> <td></td>
<td><label>{{i18n 'chat_integration.edit_rule_modal.instructions.category'}}</label></td> <td></td>
</tr> </tr>
{{else}}
<tr class="input"> <tr class="input">
<td class="label"><label for='group'>{{i18n "chat_integration.edit_rule_modal.group"}}</label></td> <td class="label"><label for="channel">{{i18n "chat_integration.edit_rule_modal.channel"}}</label></td>
<td> <td>
{{combo-box content=model.groups valueAttribute="id" value=model.rule.group_id none="chat_integration.choose_group"}} {{channel-data provider=model.provider channel=model.channel}}
</td> </td>
</tr> </tr>
<tr class="chat-instructions"> <tr class="chat-instructions">
<td></td> <td></td>
<td><label>{{i18n 'chat_integration.edit_rule_modal.instructions.group'}}</label></td> <td></td>
</tr> </tr>
{{/if}}
{{#if siteSettings.tagging_enabled}}
<tr class="input"> <tr class="input">
<td class="label"><label for='tags'>{{i18n "chat_integration.edit_rule_modal.tags"}}</label></td> <td class="label"><label for="filter">{{i18n "chat_integration.edit_rule_modal.type"}}</label></td>
<td> <td>
{{tag-chooser placeholderKey="chat_integration.all_tags" name="tags" tags=model.rule.tags everyTag=true }} {{combo-box name="type" content=model.rule.available_types value=model.rule.type}}
</td> </td>
</tr> </tr>
<tr class="chat-instructions"> <tr class="chat-instructions">
<td></td> <td></td>
<td><label>{{i18n 'chat_integration.edit_rule_modal.instructions.tags'}}</label></td> <td><label>{{i18n "chat_integration.edit_rule_modal.instructions.type"}}</label></td>
</tr> </tr>
{{/if}}
<tr class="input">
<td class="label"><label for="filter">{{i18n "chat_integration.edit_rule_modal.filter"}}</label></td>
<td>
{{combo-box name="filter" content=model.rule.available_filters value=model.rule.filter}}
</td>
</tr>
<tr class="chat-instructions">
<td></td>
<td><label>{{i18n "chat_integration.edit_rule_modal.instructions.filter"}}</label></td>
</tr>
{{#if showCategory}}
<tr class="input">
<td class="label"><label for="category">{{i18n "chat_integration.edit_rule_modal.category"}}</label></td>
<td>
{{category-chooser
name="category"
value=model.rule.category_id
rootNoneLabel="chat_integration.all_categories"
rootNone=true
overrideWidths=false
}}
</td>
</tr>
<tr class="chat-instructions">
<td></td>
<td><label>{{i18n "chat_integration.edit_rule_modal.instructions.category"}}</label></td>
</tr>
{{else}}
<tr class="input">
<td class="label"><label for="group">{{i18n "chat_integration.edit_rule_modal.group"}}</label></td>
<td>
{{combo-box content=model.groups valueAttribute="id" value=model.rule.group_id none="chat_integration.choose_group"}}
</td>
</tr>
<tr class="chat-instructions">
<td></td>
<td><label>{{i18n "chat_integration.edit_rule_modal.instructions.group"}}</label></td>
</tr>
{{/if}}
{{#if siteSettings.tagging_enabled}}
<tr class="input">
<td class="label"><label for="tags">{{i18n "chat_integration.edit_rule_modal.tags"}}</label></td>
<td>
{{tag-chooser placeholderKey="chat_integration.all_tags" name="tags" tags=model.rule.tags everyTag=true }}
</td>
</tr>
<tr class="chat-instructions">
<td></td>
<td><label>{{i18n "chat_integration.edit_rule_modal.instructions.tags"}}</label></td>
</tr>
{{/if}}
</tbody>
</table> </table>
</form> </form>
</div> </div>
{{/d-modal-body}} {{/d-modal-body}}
<div class="modal-footer"> <div class="modal-footer">
{{d-button id="save-rule" {{d-button id="save-rule"
class='btn-primary btn-large' class="btn-primary btn-large"
action="save" action="save"
actionParam=model.rule actionParam=model.rule
title="chat_integration.edit_rule_modal.save" title="chat_integration.edit_rule_modal.save"
label="chat_integration.edit_rule_modal.save" label="chat_integration.edit_rule_modal.save"
disabled=saveDisabled}} disabled=saveDisabled
}}
{{d-button class="btn-large" {{d-button class="btn-large"
action=(route-action "closeModal") action=(route-action "closeModal")
title="chat_integration.edit_rule_modal.cancel" title="chat_integration.edit_rule_modal.cancel"
label="chat_integration.edit_rule_modal.cancel"}} label="chat_integration.edit_rule_modal.cancel"
}}
</div> </div>

View File

@ -2,12 +2,14 @@
<div> <div>
<form {{action "send" on="submit"}}> <form {{action "send" on="submit"}}>
<table> <table>
<tr class="input"> <tbody>
<td class="label"><label for='channel'>{{i18n "chat_integration.test_modal.topic"}}</label></td> <tr class="input">
<td> <td class="label"><label for="channel">{{i18n "chat_integration.test_modal.topic"}}</label></td>
{{choose-topic selectedTopicId=model.topic_id}} <td>
</td> {{choose-topic selectedTopicId=model.topic_id}}
</tr> </td>
</tr>
</tbody>
</table> </table>
</form> </form>
</div> </div>
@ -17,16 +19,18 @@
{{#conditional-loading-spinner condition=loading}} {{#conditional-loading-spinner condition=loading}}
{{d-button {{d-button
id="send-test" id="send-test"
class='btn-primary btn-large' class="btn-primary btn-large"
action=(action "send") action=(action "send")
title="chat_integration.test_modal.send" title="chat_integration.test_modal.send"
label="chat_integration.test_modal.send" label="chat_integration.test_modal.send"
disabled=sendDisabled}} disabled=sendDisabled
}}
{{d-button {{d-button
class="btn-large" class="btn-large"
action=(route-action "closeModal") action=(route-action "closeModal")
title="chat_integration.test_modal.close" title="chat_integration.test_modal.close"
label="chat_integration.test_modal.close"}} label="chat_integration.test_modal.close"
}}
{{/conditional-loading-spinner}} {{/conditional-loading-spinner}}
</div> </div>

View File

@ -1,6 +1,6 @@
{{#if anyErrors}} {{#if anyErrors}}
<div class="error"> <div class="error">
{{d-icon 'exclamation-triangle'}} {{d-icon "exclamation-triangle"}}
<span class="error-message">{{i18n "chat_integration.channels_with_errors"}}</span> <span class="error-message">{{i18n "chat_integration.channels_with_errors"}}</span>
</div> </div>
{{/if}} {{/if}}
@ -14,7 +14,8 @@
test=(action "testChannel") test=(action "testChannel")
createRule=(action "createRule") createRule=(action "createRule")
editRuleWithChannel=(action "editRuleWithChannel") editRuleWithChannel=(action "editRuleWithChannel")
showError=(action "showError")}} showError=(action "showError")
}}
{{/each}} {{/each}}
<div class="table-footer"> <div class="table-footer">
@ -25,6 +26,7 @@
actionParam=model.provider actionParam=model.provider
icon="plus" icon="plus"
title="chat_integration.create_channel" title="chat_integration.create_channel"
label="chat_integration.create_channel"}} label="chat_integration.create_channel"
}}
</div> </div>
</div> </div>

View File

@ -4,9 +4,10 @@
<ul class="nav nav-pills"> <ul class="nav nav-pills">
{{#each model as |provider|}} {{#each model as |provider|}}
{{nav-item {{nav-item
route='adminPlugins.chat.provider' route="adminPlugins.chat.provider"
routeParam=provider.name routeParam=provider.name
label=(concat 'chat_integration.provider.' provider.name '.title')}} label=(concat "chat_integration.provider." provider.name ".title")
}}
{{/each}} {{/each}}
</ul> </ul>
</div> </div>
@ -16,7 +17,8 @@
action=(route-action "showSettings") action=(route-action "showSettings")
icon="cog" icon="cog"
title="chat_integration.settings" title="chat_integration.settings"
label="chat_integration.settings"}} label="chat_integration.settings"
}}
</div> </div>
</div> </div>

View File

@ -1,9 +1,9 @@
{{#each provider.channel_parameters as |param|}} {{#each provider.channel_parameters as |param|}}
{{#unless param.hidden}} {{#unless param.hidden}}
<span class='field-name'> <span class="field-name">
{{i18n (concat 'chat_integration.provider.' channel.provider '.param.' param.key '.title')}}: {{i18n (concat "chat_integration.provider." channel.provider ".param." param.key ".title")}}:
</span> </span>
<span class='field-value'>{{get channel.data param.key}}</span> <span class="field-value">{{get channel.data param.key}}</span>
<br/> <br>
{{/unless}} {{/unless}}
{{/each}} {{/each}}

View File

@ -1,11 +1,12 @@
<div class='channel-header'> <div class="channel-header">
<div class='pull-right'> <div class="pull-right">
{{d-button {{d-button
action=editChannel action=editChannel
actionParam=channel actionParam=channel
icon="pencil-alt" icon="pencil-alt"
title="chat_integration.edit_channel" title="chat_integration.edit_channel"
label="chat_integration.edit_channel"}} label="chat_integration.edit_channel"
}}
{{d-button {{d-button
action=test action=test
@ -13,56 +14,64 @@
icon="rocket" icon="rocket"
title="chat_integration.test_channel" title="chat_integration.test_channel"
label="chat_integration.test_channel" label="chat_integration.test_channel"
class="btn-chat-test"}} class="btn-chat-test"
}}
{{d-button {{d-button
class='cancel' class="cancel"
action=(action "deleteChannel") action=(action "deleteChannel")
actionParam=channel actionParam=channel
icon="trash-alt" icon="trash-alt"
title="chat_integration.delete_channel" title="chat_integration.delete_channel"
label="chat_integration.delete_channel"}} label="chat_integration.delete_channel"
}}
</div> </div>
<span class='channel-title'> <span class="channel-title">
{{#if channel.error_key}} {{#if channel.error_key}}
{{d-button {{d-button
action=showError action=showError
actionParam=channel actionParam=channel
class="delete btn-danger" class="delete btn-danger"
icon="exclamation-triangle"}} icon="exclamation-triangle"
}}
{{/if}} {{/if}}
{{channel-data provider=provider channel=channel}} {{channel-data provider=provider channel=channel}}
</span> </span>
</div> </div>
<div class='channel-body'> <div class="channel-body">
<table> <table>
<tr> <thead>
<th>{{i18n "chat_integration.rule_table.filter"}}</th> <tr>
<th>{{i18n "chat_integration.rule_table.category"}}</th> <th>{{i18n "chat_integration.rule_table.filter"}}</th>
<th>{{i18n "chat_integration.rule_table.category"}}</th>
{{#if siteSettings.tagging_enabled}} {{#if siteSettings.tagging_enabled}}
<th>{{i18n "chat_integration.rule_table.tags"}}</th> <th>{{i18n "chat_integration.rule_table.tags"}}</th>
{{/if}} {{/if}}
<th></th> <th></th>
</tr> </tr>
</thead>
{{#each channel.rules as |rule|}} <tbody>
{{rule-row rule=rule edit=(action "editRule") refresh=refresh}} {{#each channel.rules as |rule|}}
{{/each}} {{rule-row rule=rule edit=(action "editRule") refresh=refresh}}
{{/each}}
</tbody>
</table> </table>
</div> </div>
<div class='channel-footer'> <div class="channel-footer">
<div class='pull-right'> <div class="pull-right">
{{d-button {{d-button
action=createRule action=createRule
actionParam=channel actionParam=channel
icon="plus" icon="plus"
title="chat_integration.create_rule" title="chat_integration.create_rule"
label="chat_integration.create_rule"}} label="chat_integration.create_rule"
}}
</div> </div>
</div> </div>

View File

@ -16,7 +16,6 @@
{{/if}} {{/if}}
</td> </td>
{{#if siteSettings.tagging_enabled}} {{#if siteSettings.tagging_enabled}}
<td> <td>
{{#if rule.tags}} {{#if rule.tags}}
@ -33,12 +32,14 @@
actionParam=rule actionParam=rule
icon="pencil-alt" icon="pencil-alt"
class="edit" class="edit"
title="chat_integration.rule_table.edit_rule"}} title="chat_integration.rule_table.edit_rule"
}}
{{d-button {{d-button
action=(action "delete") action=(action "delete")
actionParam=rule actionParam=rule
icon="far-trash-alt" icon="far-trash-alt"
class="delete" class="delete"
title="chat_integration.rule_table.delete_rule"}} title="chat_integration.rule_table.delete_rule"
}}
</td> </td>