about/.github/workflows/lint.yml
2025-09-15 12:11:14 +03:00

100 lines
2.5 KiB
YAML

name: Lint
on:
push:
branches: [ master, dev ]
pull_request:
branches: [ master, dev ]
jobs:
golangci:
name: Go Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout=5m
frontend:
name: Frontend Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install dependencies
run: |
npm init -y
npm install --save-dev eslint jshint csslint
- name: Lint JavaScript
run: |
# Create basic .eslintrc.json if it doesn't exist
if [ ! -f .eslintrc.json ]; then
cat > .eslintrc.json << EOL
{
"env": {
"browser": true,
"es6": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
"no-unused-vars": "warn",
"no-undef": "warn"
}
}
EOL
fi
# Lint JavaScript files
find static/js -name "*.js" -type f | head -10 | xargs npx eslint || echo "ESLint found issues but continuing..."
- name: Lint CSS
run: |
# Basic CSS validation
find static/css -name "*.css" -type f | head -10 | while read file; do
echo "Checking $file"
npx csslint "$file" || echo "CSS issues found in $file but continuing..."
done
- name: Check static assets structure
run: |
# Verify expected directory structure
test -d static/css || (echo "Missing static/css directory" && exit 1)
test -d static/js || (echo "Missing static/js directory" && exit 1)
test -d static/icons || echo "Warning: static/icons directory not found"
test -d static/images || echo "Warning: static/images directory not found"
# Check for common files
test -f static/css/master.css || echo "Warning: main.css not found"
echo "Static asset structure check completed"
markdown:
name: Markdown Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint markdown files
uses: DavidAnson/markdownlint-cli2-action@v13
with:
globs: '**/*.md'
separator: '\n'