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

View File

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

View File

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

View File

@ -7,7 +7,9 @@ import { click, currentURL, visit } from "@ember/test-helpers";
import AssignedTopics from "../fixtures/assigned-topics-fixtures"; import AssignedTopics from "../fixtures/assigned-topics-fixtures";
import { test } from "qunit"; import { test } from "qunit";
acceptance("Discourse Assign | Quick access assignments panel", function (needs) { acceptance(
"Discourse Assign | Quick access assignments panel",
function (needs) {
needs.user(); needs.user();
needs.settings({ assign_enabled: true, assigns_user_url_path: "/" }); needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });
@ -36,4 +38,5 @@ acceptance("Discourse Assign | Quick access assignments panel", function (needs)
"a second click should redirect to the full assignments page" "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 selectKit from "discourse/tests/helpers/select-kit-helper";
import { import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
acceptance,
query,
} from "discourse/tests/helpers/qunit-helpers";
import { fillIn, visit } from "@ember/test-helpers"; import { fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit"; import { test } from "qunit";

View File

@ -1,10 +1,16 @@
import selectKit from "discourse/tests/helpers/select-kit-helper"; import selectKit from "discourse/tests/helpers/select-kit-helper";
import {acceptance, count, exists} from "discourse/tests/helpers/qunit-helpers"; import {
import {visit} from "@ember/test-helpers"; acceptance,
count,
exists,
} from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import AssignedTopics from "../fixtures/assigned-topics-fixtures"; 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) { acceptance(
"Discourse Assign | UnAssign/Re-assign from the topics list",
function (needs) {
needs.user(); needs.user();
needs.settings({ assign_enabled: true, assigns_user_url_path: "/" }); needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });
needs.pretender((server, helper) => { needs.pretender((server, helper) => {
@ -22,17 +28,21 @@ acceptance("Discourse Assign | UnAssign/Re-assign from the topics list", functio
assert.equal(count("li[data-value='unassign']"), 1); assert.equal(count("li[data-value='unassign']"), 1);
assert.equal(count("li[data-value='reassign']"), 1); assert.equal(count("li[data-value='reassign']"), 1);
}); });
}); }
);
acceptance("Discourse Assign | A user doesn't have assignments", function (needs) { acceptance(
"Discourse Assign | A user doesn't have assignments",
function (needs) {
needs.user(); needs.user();
needs.settings({ assign_enabled: true, assigns_user_url_path: "/" }); needs.settings({ assign_enabled: true, assigns_user_url_path: "/" });
needs.pretender((server, helper) => { needs.pretender((server, helper) => {
const assignments = AssignedTopics["/topics/messages-assigned/eviltrout.json"]; const assignments =
AssignedTopics["/topics/messages-assigned/eviltrout.json"];
assignments.topic_list.topics = []; assignments.topic_list.topics = [];
server.get( server.get("/topics/messages-assigned/eviltrout.json", () =>
"/topics/messages-assigned/eviltrout.json", helper.response(assignments)
() => helper.response(assignments)); );
}); });
test("It renders the empty state panel", async function (assert) { test("It renders the empty state panel", async function (assert) {
@ -44,4 +54,5 @@ acceptance("Discourse Assign | A user doesn't have assignments", function (needs
await visit("/u/eviltrout/activity/assigned"); await visit("/u/eviltrout/activity/assigned");
assert.notOk(exists("div.topic-search-div")); assert.notOk(exists("div.topic-search-div"));
}); });
}); }
);