DEV: Update CI workflows (#210)

* DEV: Update CI workflows
* DEV: Fix prettier errors in tests

Co-authored-by: CvX <CvX@users.noreply.github.com>
Co-authored-by: Jarek Radosz <jradosz@gmail.com>
This commit is contained in:
discoursebot 2021-09-20 09:52:26 -04:00 committed by GitHub
parent 85fa1f90aa
commit ac0f8a6ee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 85 additions and 82 deletions

View File

@ -37,11 +37,10 @@ jobs:
shell: bash
run: |
yarn prettier -v
shopt -s extglob
if ls assets/**/*.@(scss|js|es6) &> /dev/null; then
if [ 0 -lt $(find assets -type f \( -name "*.scss" -or -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
yarn prettier --list-different "assets/**/*.{scss,js,es6}"
fi
if ls test/**/*.@(js|es6) &> /dev/null; then
if [ 0 -lt $(find test -type f \( -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
yarn prettier --list-different "test/**/*.{js,es6}"
fi

View File

@ -29,7 +29,6 @@ jobs:
build_type: ["backend", "frontend"]
ruby: ["2.7"]
postgres: ["13"]
redis: ["4.x"]
services:
postgres:
@ -63,10 +62,9 @@ jobs:
git config --global user.email "ci@ci.invalid"
git config --global user.name "Discourse CI"
- name: Setup redis
uses: shogo82148/actions-setup-redis@v1
with:
redis-version: ${{ matrix.redis }}
- name: Start redis
run: |
redis-server /etc/redis/redis.conf &
- name: Bundler cache
uses: actions/cache@v2
@ -113,8 +111,7 @@ jobs:
id: check_spec
shell: bash
run: |
shopt -s extglob
if ls plugins/${{ github.event.repository.name }}/spec/**/*.@(rb) &> /dev/null; then
if [ 0 -lt $(find plugins/${{ github.event.repository.name }}/spec -type f -name "*.rb" 2> /dev/null | wc -l) ]; then
echo "::set-output name=files_exist::true"
fi
@ -126,8 +123,7 @@ jobs:
id: check_qunit
shell: bash
run: |
shopt -s extglob
if ls plugins/${{ github.event.repository.name }}/test/javascripts/**/*.@(js|es6) &> /dev/null; then
if [ 0 -lt $(find plugins/${{ github.event.repository.name }}/test/javascripts -type f \( -name "*.js" -or -name "*.es6" \) 2> /dev/null | wc -l) ]; then
echo "::set-output name=files_exist::true"
fi

View File

@ -1,7 +1,4 @@
import {
acceptance,
exists
} from "discourse/tests/helpers/qunit-helpers";
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";

View File

@ -7,33 +7,36 @@ import { click, currentURL, visit } from "@ember/test-helpers";
import AssignedTopics from "../fixtures/assigned-topics-fixtures";
import { test } from "qunit";
acceptance("Discourse Assign | Quick access assignments panel", function (needs) {
needs.user();
needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });
acceptance(
"Discourse Assign | Quick access assignments panel",
function (needs) {
needs.user();
needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });
needs.pretender((server, helper) => {
const messagesPath = "/topics/messages-assigned/eviltrout.json";
const assigns = AssignedTopics[messagesPath];
server.get(messagesPath, () => helper.response(assigns));
});
needs.pretender((server, helper) => {
const messagesPath = "/topics/messages-assigned/eviltrout.json";
const assigns = AssignedTopics[messagesPath];
server.get(messagesPath, () => helper.response(assigns));
});
test("Quick access assignments panel", async (assert) => {
updateCurrentUser({ can_assign: true });
test("Quick access assignments panel", async (assert) => {
updateCurrentUser({ can_assign: true });
await visit("/");
await click("#current-user.header-dropdown-toggle");
await visit("/");
await click("#current-user.header-dropdown-toggle");
await click(".widget-button.assigned");
const assignment = query(".quick-access-panel li a");
await click(".widget-button.assigned");
const assignment = query(".quick-access-panel li a");
assert.ok(assignment.innerText.includes("Greetings!"));
assert.ok(assignment.href.includes("/t/greetings/10/5"));
assert.ok(assignment.innerText.includes("Greetings!"));
assert.ok(assignment.href.includes("/t/greetings/10/5"));
await click(".widget-button.assigned");
assert.equal(
currentURL(),
"/u/eviltrout/activity/assigned",
"a second click should redirect to the full assignments page"
);
});
});
await click(".widget-button.assigned");
assert.equal(
currentURL(),
"/u/eviltrout/activity/assigned",
"a second click should redirect to the full assignments page"
);
});
}
);

View File

@ -1,8 +1,5 @@
import selectKit from "discourse/tests/helpers/select-kit-helper";
import {
acceptance,
query,
} from "discourse/tests/helpers/qunit-helpers";
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
import { fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";

View File

@ -1,47 +1,58 @@
import selectKit from "discourse/tests/helpers/select-kit-helper";
import {acceptance, count, exists} from "discourse/tests/helpers/qunit-helpers";
import {visit} from "@ember/test-helpers";
import {
acceptance,
count,
exists,
} from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import AssignedTopics from "../fixtures/assigned-topics-fixtures";
import {test} from "qunit";
import { test } from "qunit";
acceptance("Discourse Assign | UnAssign/Re-assign from the topics list", function (needs) {
needs.user();
needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });
needs.pretender((server, helper) => {
const messagesPath = "/topics/messages-assigned/eviltrout.json";
const assigns = AssignedTopics[messagesPath];
server.get(messagesPath, () => helper.response(assigns));
});
acceptance(
"Discourse Assign | UnAssign/Re-assign from the topics list",
function (needs) {
needs.user();
needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });
needs.pretender((server, helper) => {
const messagesPath = "/topics/messages-assigned/eviltrout.json";
const assigns = AssignedTopics[messagesPath];
server.get(messagesPath, () => helper.response(assigns));
});
test("Unassign/Re-assign options are visible", async (assert) => {
const options = selectKit(".assign-actions-dropdown");
test("Unassign/Re-assign options are visible", async (assert) => {
const options = selectKit(".assign-actions-dropdown");
await visit("/u/eviltrout/activity/assigned");
await options.expand();
await visit("/u/eviltrout/activity/assigned");
await options.expand();
assert.equal(count("li[data-value='unassign']"), 1);
assert.equal(count("li[data-value='reassign']"), 1);
});
});
assert.equal(count("li[data-value='unassign']"), 1);
assert.equal(count("li[data-value='reassign']"), 1);
});
}
);
acceptance("Discourse Assign | A user doesn't have assignments", function (needs) {
needs.user();
needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });
needs.pretender((server, helper) => {
const assignments = AssignedTopics["/topics/messages-assigned/eviltrout.json"];
assignments.topic_list.topics = [];
server.get(
"/topics/messages-assigned/eviltrout.json",
() => helper.response(assignments));
});
acceptance(
"Discourse Assign | A user doesn't have assignments",
function (needs) {
needs.user();
needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });
needs.pretender((server, helper) => {
const assignments =
AssignedTopics["/topics/messages-assigned/eviltrout.json"];
assignments.topic_list.topics = [];
server.get("/topics/messages-assigned/eviltrout.json", () =>
helper.response(assignments)
);
});
test("It renders the empty state panel", async function (assert) {
await visit("/u/eviltrout/activity/assigned");
assert.ok(exists("div.empty-state"));
});
test("It renders the empty state panel", async function (assert) {
await visit("/u/eviltrout/activity/assigned");
assert.ok(exists("div.empty-state"));
});
test("It does not render the search form", async function (assert) {
await visit("/u/eviltrout/activity/assigned");
assert.notOk(exists("div.topic-search-div"));
});
});
test("It does not render the search form", async function (assert) {
await visit("/u/eviltrout/activity/assigned");
assert.notOk(exists("div.topic-search-div"));
});
}
);