DEV: Update CI workflows (#210)

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

diff --git a/.github/workflows/plugin-linting.yml b/.github/workflows/plugin-linting.yml
index 51b9b82..92c6e3e 100644
--- a/.github/workflows/plugin-linting.yml
+++ b/.github/workflows/plugin-linting.yml
@@ -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
 
diff --git a/.github/workflows/plugin-tests.yml b/.github/workflows/plugin-tests.yml
index b28d0e2..a5eff7c 100644
--- a/.github/workflows/plugin-tests.yml
+++ b/.github/workflows/plugin-tests.yml
@@ -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
 
diff --git a/test/javascripts/acceptance/category-test.js.es6 b/test/javascripts/acceptance/category-test.js.es6
index 2b64cea..abbb0f0 100644
--- a/test/javascripts/acceptance/category-test.js.es6
+++ b/test/javascripts/acceptance/category-test.js.es6
@@ -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";
diff --git a/test/javascripts/acceptance/quick-access-assignments-test.js.es6 b/test/javascripts/acceptance/quick-access-assignments-test.js.es6
index ca379e4..2864dda 100644
--- a/test/javascripts/acceptance/quick-access-assignments-test.js.es6
+++ b/test/javascripts/acceptance/quick-access-assignments-test.js.es6
@@ -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"
+      );
+    });
+  }
+);
diff --git a/test/javascripts/acceptance/search-full-test.js.es6 b/test/javascripts/acceptance/search-full-test.js.es6
index 31695a0..cbf710a 100644
--- a/test/javascripts/acceptance/search-full-test.js.es6
+++ b/test/javascripts/acceptance/search-full-test.js.es6
@@ -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";
 
diff --git a/test/javascripts/acceptance/user-assignments-list.js.es6 b/test/javascripts/acceptance/user-assignments-list.js.es6
index 6d4f58d..ee81082 100644
--- a/test/javascripts/acceptance/user-assignments-list.js.es6
+++ b/test/javascripts/acceptance/user-assignments-list.js.es6
@@ -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) => {

[... diff too long, it was truncated ...]

GitHub sha: ac0f8a6ee33e274edad9191a029c31d5b0a1764d

This commit appears in #210 which was approved by eviltrout. It was merged by CvX.