From d800e5ffc3774b06b488f1af97d54a87fc7058b1 Mon Sep 17 00:00:00 2001 From: Daniel Mohns Date: Thu, 22 Aug 2024 11:41:20 +0200 Subject: [PATCH 1/2] Add generic linters and checks --- .editorconfig | 6 +++ .github/workflows/check-generic.yaml | 40 ++++++++++++++++ .github/workflows/check.yaml | 69 ++++++++++++++++++++++++++++ .github/workflows/ci.yml | 35 -------------- .markdownlint-cli2.yaml | 15 ++++++ .yamllint | 16 +++++++ 6 files changed, 146 insertions(+), 35 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/workflows/check-generic.yaml create mode 100644 .github/workflows/check.yaml delete mode 100644 .github/workflows/ci.yml create mode 100644 .markdownlint-cli2.yaml create mode 100644 .yamllint diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..30e849c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +# EditorConfig is awesome: https://EditorConfig.org + +[*] +# Ensure consistent file encoding in UNIX style +charset = utf-8 +end_of_line = lf diff --git a/.github/workflows/check-generic.yaml b/.github/workflows/check-generic.yaml new file mode 100644 index 0000000..edae412 --- /dev/null +++ b/.github/workflows/check-generic.yaml @@ -0,0 +1,40 @@ +# Generic checks to ease collaboration: +# - consistent file encoding in UNIX style +# - whitespaces in all purposes files like markdown, yaml, etc +name: Check Generic + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + editorconfig-checker: + name: Run editorconfig-checker + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run editorconfig-checker + run: docker run --rm --volume=$PWD:/check mstruebing/editorconfig-checker + + markdownlint: + name: Run markdownlint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run markdownlint-cli2 + uses: DavidAnson/markdownlint-cli2-action@v16 + + yamllint: + name: Run yamllint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run yamllint + run: yamllint . diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml new file mode 100644 index 0000000..0c9cb00 --- /dev/null +++ b/.github/workflows/check.yaml @@ -0,0 +1,69 @@ +name: Check Code Quality and Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + lint-eslint: + name: Lint ESLint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ">=18.x" + + - name: Install dependencies + run: npm install + working-directory: ./Website/ui + + - name: Run ESLint + run: npm run lint + working-directory: ./Website/ui + + lint-prettier: + name: Lint Prettier + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ">=18.x" + + - name: Install dependencies + run: npm install + + - name: Run Prettier + run: npm run prettier + + test: + name: Run Tests + runs-on: ubuntu-latest + needs: + - lint-eslint + - lint-prettier + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: ">=18.x" + + - name: Install dependencies + run: npm install + + - name: Run Tests + run: npm run test diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 4dbc546..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: CI Test - -on: - push: - branches: ["main"] - pull_request: - branches: ["main"] - -jobs: - lint: - name: Lint - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: ">=18.x" - - run: npm install - - run: npm run lint - - test: - name: Test - runs-on: ubuntu-latest - needs: lint - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: ">=18.x" - - run: npm install - - run: npm run test diff --git a/.markdownlint-cli2.yaml b/.markdownlint-cli2.yaml new file mode 100644 index 0000000..5b31747 --- /dev/null +++ b/.markdownlint-cli2.yaml @@ -0,0 +1,15 @@ +# Disable some built-in rules +config: + line-length: false + no-inline-html: false + first-line-h1: false + code-block-style: false # conflicts with MkDocs Admontions: https://squidfunk.github.io/mkdocs-material/reference/admonitions/ + code-fence-style: + style: backtick + +# Define glob expressions to use (only valid at root) +globs: + - "**/*.md" + +# Ignore files that are not part of version control +gitignore: true diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..a0e07de --- /dev/null +++ b/.yamllint @@ -0,0 +1,16 @@ +extends: default + +ignore-from-file: .gitignore + +rules: + document-start: disable + indentation: + spaces: 2 + line-length: disable + quoted-strings: + quote-type: double + required: only-when-needed + allow-quoted-quotes: true + check-keys: true + truthy: + check-keys: false From 027cb2b59160df4ce0956feae3f3138bc77a0dd8 Mon Sep 17 00:00:00 2001 From: Daniel Mohns Date: Thu, 22 Aug 2024 11:41:58 +0200 Subject: [PATCH 2/2] Fix copy/paste --- .github/workflows/check.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 0c9cb00..277113f 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -23,11 +23,9 @@ jobs: - name: Install dependencies run: npm install - working-directory: ./Website/ui - name: Run ESLint run: npm run lint - working-directory: ./Website/ui lint-prettier: name: Lint Prettier