diff --git a/.github/workflows/build_slim_packages.yaml b/.github/workflows/build_slim_packages.yaml index 56d2a6394..eeba6b6e0 100644 --- a/.github/workflows/build_slim_packages.yaml +++ b/.github/workflows/build_slim_packages.yaml @@ -80,7 +80,9 @@ jobs: - uses: actions/upload-artifact@v2 with: name: "${{ matrix.profile }}_schema_dump" - path: _build/*/lib/emqx_dashboard/priv/www/static/schema.json + path: | + scripts/spellcheck + _build/${{ matrix.profile }}/lib/emqx_dashboard/priv/www/static/schema.json windows: runs-on: windows-2019 @@ -205,7 +207,6 @@ jobs: - emqx - emqx-enterprise runs-on: aws-amd64 - container: "ghcr.io/emqx/emqx-schema-validate:0.3.3" steps: - uses: actions/download-artifact@v2 name: Download schema dump @@ -214,9 +215,7 @@ jobs: path: /tmp/ - name: Run spellcheck run: | - cd /LanguageTool - bash start.sh > /dev/null & - ./emqx_schema_validate /tmp/${{ matrix.profile }}/lib/emqx_dashboard/priv/www/static/schema.json + bash /tmp/scripts/spellcheck/spellcheck.sh /tmp/_build/${{ matrix.profile }}/lib/emqx_dashboard/priv/www/static/schema.json allgood_packaging: runs-on: ubuntu-latest diff --git a/scripts/spellcheck b/scripts/spellcheck deleted file mode 100755 index 51d8d2907..000000000 --- a/scripts/spellcheck +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -uo pipefail - -if [ -z "${1:-}" ]; then - SCHEMA="_build/emqx/lib/emqx_dashboard/priv/www/static/schema.json" -else - SCHEMA="$1" -fi - -docker run -d --name langtool "ghcr.io/emqx/emqx-schema-validate:0.3.3" - -docker exec -i langtool ./emqx_schema_validate - < "${SCHEMA}" -success="$?" - -docker kill langtool || true -docker rm langtool || true - -echo "If this script finds a false positive (e.g. when it things that a protocol name is a typo), -make a PR here: https://github.com/emqx/emqx-schema-validate/blob/master/dict/en_spelling_additions.txt" - -exit "$success" diff --git a/scripts/spellcheck/dicts/emqx.txt b/scripts/spellcheck/dicts/emqx.txt new file mode 100644 index 000000000..8355e3d03 --- /dev/null +++ b/scripts/spellcheck/dicts/emqx.txt @@ -0,0 +1,265 @@ +ACL +AES +APIs +BPAPI +BSON +Backplane +CA +CAs +CHACHA +CLI +CMD +CN +CONNACK +CoAP +Cygwin +DES +DN +DNS +DTLS +DevOps +Dialyzer +Diffie +EIP +EMQX +EPMD +ERL +ETS +FIXME +GCM +HMAC +HOCON +HTTPS +JSON +JWK +JWKs +JWT +Kubernetes +LwM +MQTT +Makefile +MitM +Multicast +NIF +OTP +PEM +PINGREQ +PSK +PSK +PSKs +PUBREL +QoS +RESTful +ROADMAP +RSA +Req +Riak +SHA +SMS +Struct +TCP +TLS +TTL +UDP +URI +XMLs +acceptors +ack +acked +addr +api +apiserver +arg +args +async +attr +auth +authenticator +authenticators +authn +authz +autoclean +autoheal +backend +backends +backoff +backplane +backtrace +badarg +badkey +bcrypt +behaviour +bhvr +boolean +bytesize +cacert +cacertfile +certfile +ci +clientid +clientinfo +cmake +coap +conf +config +configs +confirmable +conn +connectionless +cors +cpu +ctx +customizable +datagram +datagrams +desc +dir +dns +downlink +downlink +dtls +ekka +emqx +enablement +enqueue +enqueued +env +eof +epmd +erl +erts +escript +etcd +eval +exe +executables +exhook +exproto +extensibility +formatter +gRPC +github +goto +grpcbox +hocon +hoconsc +hostname +hrl +http +https +iface +img +impl +inet +inflight +ini +init +ip +ipv +jenkins +jq +kb +keepalive +libcoap +lifecycle +localhost +lwm +mnesia +mountpoint +mqueue +mria +msg +multicalls +multicasts +namespace +natively +nodelay +nodetool +nullable +num +os +params +peerhost +peername +perf +powershell +procmem +procs +progname +prometheus +proto +ps +psk +pubsub +pushgateway +qlen +qmode +qos +quic +ratelimit +rebar +recbuf +relup +replayq +replicant +repo +reuseaddr +rh +rlog +rootdir +rpc +runtime +sc +scalable +seg +setcookie +sharded +shareload +sn +sndbuf +sockname +sql +src +ssl +statsd +structs +subprotocol +subprotocols +superset +sys +sysmem +sysmon +tcp +ticktime +tlog +tls +tlsv +travis +trie +ttl +typerefl +udp +uid +un-acked +unsub +uplink +url +utc +util +ver +vm +vsn +wakaama +websocket +ws +wss +xml +HStream +HStreamDB +hstream +hstreamDB +hstream +hstreamdb +SASL +GSSAPI +keytab diff --git a/scripts/spellcheck/spellcheck.sh b/scripts/spellcheck/spellcheck.sh new file mode 100755 index 000000000..a21fc93ec --- /dev/null +++ b/scripts/spellcheck/spellcheck.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# ensure dir +cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/../.." +PROJ_ROOT="$(pwd)" + +if [ -z "${1:-}" ]; then + SCHEMA="${PROJ_ROOT}/_build/emqx/lib/emqx_dashboard/priv/www/static/schema.json" +else + SCHEMA="$(realpath "$1")" +fi + +set +e +docker run --rm -i --name spellcheck \ + -v "${PROJ_ROOT}"/scripts/spellcheck/dicts:/dicts \ + -v "$SCHEMA":/schema.json \ + ghcr.io/emqx/emqx-schema-validate:0.4.0 /schema.json + +result="$?" + +if [ "$result" -eq 0 ]; then + echo "Spellcheck OK" + exit 0 +fi + +echo "If this script finds a false positive (e.g. when it thinks that a protocol name is a typo)," +echo "Add the word to dictionary in scripts/spellcheck/dicts" +exit $result