From 031986921258b46e595b4867035199435c4685e3 Mon Sep 17 00:00:00 2001 From: Jack Date: Sun, 17 Nov 2024 19:28:25 +0800 Subject: [PATCH] De-centralize YAML and Markdown stylecheck --- .github/workflows/ci-cd.yml | 43 ++++++++++++++++--- .lycheeignore | 3 -- .mdlrc | 2 + .yamllint | 23 ++++++++++ README.md | 5 +-- .../ci-setup/action.yml => markdownlint.rb | 14 +++--- 6 files changed, 70 insertions(+), 20 deletions(-) create mode 100644 .mdlrc create mode 100644 .yamllint rename .github/actions/ci-setup/action.yml => markdownlint.rb (72%) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 067c995..496c29f 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. --- -name: Template CI/CD +name: CI/CD "on": pull_request: @@ -27,17 +27,48 @@ env: EMAIL: jack20220723@gmail.com jobs: - yml-md-style-and-link-checks: - uses: QubitPi/hashistack/.github/workflows/yml-md-style-and-link-checks.yml@master + cancel-previous: + name: Cancel Previous Runs In Order to Allocate Action Resources Immediately for Current Run + if: github.ref != 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - name: Cancel previous + uses: styfle/cancel-workflow-action@0.10.1 + with: + access_token: ${{ github.token }} + + yaml-lint: + name: YAML Style Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actionshub/yamllint@main + + markdown-lint: + name: Markdown Style Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actionshub/markdownlint@main + + linkChecker: + name: Link Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Link Checker + uses: lycheeverse/lychee-action@v1.9.0 + with: + fail: true tests: name: Unit & Integration Tests - needs: yml-md-style-and-link-checks + needs: [yaml-lint, markdown-lint, linkChecker] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Test environment setup - uses: ./.github/actions/ci-setup + - name: Set up JDK + uses: QubitPi/jersey-webservice-deployment-actions/.github/actions/jdk-setup@master - name: Set up Docker for Integration Tests uses: docker-practice/actions-setup-docker@master - name: Run unit & integration tests diff --git a/.lycheeignore b/.lycheeignore index 86a6cfa..d5d0a59 100644 --- a/.lycheeignore +++ b/.lycheeignore @@ -1,5 +1,2 @@ file:///* -https://querydsl.com/* -https://uel.java.net/ -https://www.openapis.org/ https://api.paion-data.dev/* diff --git a/.mdlrc b/.mdlrc new file mode 100644 index 0000000..a52d9c5 --- /dev/null +++ b/.mdlrc @@ -0,0 +1,2 @@ +rules "~MD002", "~MD003", "~MD005", "~MD007", "~MD013", "~MD022", "~MD024", "~MD027", "~MD028", "~MD029", "~MD033", "~MD034", "~MD036", "~MD041", "~MD055", "~MD057" +style "#{File.dirname(__FILE__)}/markdownlint.rb" diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..6584a13 --- /dev/null +++ b/.yamllint @@ -0,0 +1,23 @@ +--- +extends: default +rules: + line-length: + max: 256 + level: warning + document-start: disable + braces: + forbid: false + min-spaces-inside: 0 + max-spaces-inside: 1 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + commas: + max-spaces-before: -1 + min-spaces-after: 1 + max-spaces-after: -1 + brackets: + max-spaces-inside: -1 + empty-lines: + max: 3 + indentation: + spaces: 2 diff --git a/README.md b/README.md index b690ca8..51ddd68 100644 --- a/README.md +++ b/README.md @@ -36,8 +36,7 @@ mvn clean verify Deployment ---------- -This is a one-person project. Agility outplays team scaling, so deployment is manual and pretty much follows -[jetty-start.sh](./jetty-start.sh) +At this moment deployment is manual and pretty much follows [jetty-start.sh](./jetty-start.sh) ### Sending Logs to ELK Cloud @@ -76,7 +75,7 @@ curl -i -k -X POST https://api.paion-data.dev:8444/services/wilhelm-ws-search/ro We should see `HTTP/1.1 201 Created` as signs of success. -#### Example requests: +#### Example requests - vocabulary count: https://api.paion-data.dev/wilhelm/languages/german?perPage=100&page=1 - query vocabulary paged: https://api.paion-data.dev/wilhelm/languages/german/count diff --git a/.github/actions/ci-setup/action.yml b/markdownlint.rb similarity index 72% rename from .github/actions/ci-setup/action.yml rename to markdownlint.rb index cda8314..d03c8b2 100644 --- a/.github/actions/ci-setup/action.yml +++ b/markdownlint.rb @@ -12,11 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 'setup' -description: 'CI setup, such as installing JDK' - -runs: - using: "composite" - steps: - - name: Set up JDK - uses: QubitPi/jersey-webservice-deployment-actions/.github/actions/jdk-setup@master +all +rule 'MD003', style: :setext_with_atx +rule 'MD004', style: :sublist +rule 'MD013', line_length: 120 +rule 'MD029', style: :ordered +rule 'MD026', punctuation: ".,;:!?"