86 lines
2.3 KiB
YAML
86 lines
2.3 KiB
YAML
name: Code Style -- Web Components
|
|
run-name: 'Code Style -- Web Components -- ${{ gitea.repository }} ${{ gitea.ref_name }} ${{ gitea.sha }}'
|
|
on:
|
|
push:
|
|
branches:
|
|
- '*'
|
|
paths:
|
|
- '**/*.html'
|
|
- '**/*.css'
|
|
- '**/*.js'
|
|
|
|
jobs:
|
|
style-web:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check Out Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: 'true'
|
|
|
|
- name: Initialize Runner
|
|
uses: actions/setup-node@v4
|
|
|
|
- name: Check and Run `make workflow-init`
|
|
run: |
|
|
if [ ! -f Makefile ]; then
|
|
echo "No Makefile found in root directory. Skipping."
|
|
exit 0
|
|
fi
|
|
if make -n workflow-init >/dev/null 2>&1; then
|
|
echo "Target 'workflow-init' found. Running make workflow-init..."
|
|
make workflow-init
|
|
else
|
|
echo "Target 'workflow-init' does not exist in Makefile. Skipping."
|
|
fi
|
|
|
|
- name: Install Linters
|
|
run: |
|
|
npm install --no-save \
|
|
@eslint/eslintrc \
|
|
@eslint/js \
|
|
eslint \
|
|
globals \
|
|
html-validate \
|
|
stylelint \
|
|
stylelint-config-standard
|
|
|
|
- name: Verify Linters
|
|
run: |
|
|
npx html-validate --version
|
|
npx stylelint --version
|
|
npx eslint --version
|
|
|
|
- name: Run HTMLValidate
|
|
id: style-html
|
|
if: always()
|
|
run: |
|
|
CONFIG_FILE="dev_config/.htmlvalidate.json"
|
|
if [ -f "$CONFIG_FILE" ]; then
|
|
npx html-validate --config $CONFIG_FILE '**/*.html'
|
|
fi
|
|
|
|
- name: Run Stylelint
|
|
id: style-css
|
|
if: always()
|
|
run: |
|
|
CONFIG_FILE="dev_config/.stylelintrc.json"
|
|
if [ -f "$CONFIG_FILE" ]; then
|
|
npx stylelint --config $CONFIG_FILE --formatter verbose '**/*.css'
|
|
fi
|
|
|
|
- name: Run ESLint
|
|
id: style-js
|
|
if: always()
|
|
run: |
|
|
CONFIG_FILE="dev_config/eslint.config.mjs"
|
|
if [ -f "$CONFIG_FILE" ]; then
|
|
npx eslint --config $CONFIG_FILE '**/*.js'
|
|
fi
|
|
|
|
- name: Verify Linters
|
|
if: >
|
|
steps.style-html.outcome != 'success' ||
|
|
steps.style-css.outcome != 'success' ||
|
|
steps.style-js.outcome != 'success'
|
|
run: exit 1 |