add static analysis action
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
name: Static Analysis -- Golang
|
||||||
|
run-name: 'Static Analysis -- Golang -- ${{ gitea.repository }} ${{ gitea.ref_name }} ${{ gitea.sha }}'
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check Out Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: 'true'
|
||||||
|
|
||||||
|
- name: Initialize Runner
|
||||||
|
uses: actions/setup-go@v7
|
||||||
|
with:
|
||||||
|
go-version-file: 'go.mod'
|
||||||
|
|
||||||
|
- name: Initialize Go
|
||||||
|
run: make build-web && go get .
|
||||||
|
|
||||||
|
- name: Run Go Vet
|
||||||
|
id: static_govet
|
||||||
|
if: always()
|
||||||
|
run: go vet ./...
|
||||||
|
|
||||||
|
- name: Verify Static Analysis
|
||||||
|
if: >
|
||||||
|
steps.static_govet.outcome != 'success'
|
||||||
|
run: exit 1
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
name: ProxmoxAAS-Dashboard Code Style Check
|
name: Code Style -- Web Components
|
||||||
run-name: Code style check on ${{ gitea.repository }} ${{ gitea.ref_name }} ${{ gitea.sha }}
|
run-name: 'Code Style -- Web Components -- ${{ gitea.repository }} ${{ gitea.ref_name }} ${{ gitea.sha }}'
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "*"
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint-check:
|
lint-check:
|
||||||
@@ -34,12 +34,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Run HTMLValidate
|
- name: Run HTMLValidate
|
||||||
id: html_lint
|
id: html_lint
|
||||||
run: npx html-validate --config dev_config/.htmlvalidate.json "web/html/**/*"
|
run: npx html-validate --config dev_config/.htmlvalidate.json 'web/html/**/*'
|
||||||
|
|
||||||
- name: Run Stylelint
|
- name: Run Stylelint
|
||||||
id: style_lint
|
id: style_lint
|
||||||
if: always()
|
if: always()
|
||||||
run: npx stylelint --config dev_config/.stylelintrc.json --formatter verbose --fix "web/css/**/*.css"
|
run: npx stylelint --config dev_config/.stylelintrc.json --formatter verbose --fix 'web/css/**/*.css'
|
||||||
|
|
||||||
- name: Run ESLint
|
- name: Run ESLint
|
||||||
id: js_lint
|
id: js_lint
|
||||||
@@ -49,21 +49,8 @@ jobs:
|
|||||||
run: npx eslint --config dev_config/eslint.config.mjs --fix web/scripts/
|
run: npx eslint --config dev_config/eslint.config.mjs --fix web/scripts/
|
||||||
|
|
||||||
- name: Verify Linters
|
- name: Verify Linters
|
||||||
if: always()
|
if: >
|
||||||
run: |
|
steps.html_lint.outcome != 'success' ||
|
||||||
FAILED=0
|
steps.style_lint.outcome != 'success' ||
|
||||||
if [ "${{ steps.html_lint.outcome }}" != "success" ]; then
|
steps.js_lint.outcome != 'success'
|
||||||
echo "HTML Linter failed"
|
run: exit 1
|
||||||
FAILED=1
|
|
||||||
fi
|
|
||||||
if [ "${{ steps.style_lint.outcome }}" != "success" ]; then
|
|
||||||
echo "Style Linter failed"
|
|
||||||
FAILED=1
|
|
||||||
fi
|
|
||||||
if [ "${{ steps.js_lint.outcome }}" != "success" ]; then
|
|
||||||
echo "JS Linter failed"
|
|
||||||
FAILED=1
|
|
||||||
fi
|
|
||||||
if [ $FAILED -eq 1 ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
.PHONY: build test clean wfa-js
|
.PHONY: build test clean wfa-js
|
||||||
|
|
||||||
build: clean build-wfa-js
|
build: clean ensure-dist build-web build-wfa-js
|
||||||
@echo "======================== Building Binary ======================="
|
@echo "======================== Building Binary ======================="
|
||||||
mkdir -p dist
|
|
||||||
# resolve symbolic links in web by copying it into dist/web/
|
# resolve symbolic links in web by copying it into dist/web/
|
||||||
cp -rL web/ dist/web/
|
|
||||||
CGO_ENABLED=0 go build -tags release -ldflags="-s -w" -v -o dist/ .
|
CGO_ENABLED=0 go build -tags release -ldflags="-s -w" -v -o dist/ .
|
||||||
|
|
||||||
build-wfa-js:
|
ensure-dist:
|
||||||
|
mkdir -p dist
|
||||||
|
|
||||||
|
build-web: ensure-dist
|
||||||
|
cp -rL web/ dist/web/
|
||||||
|
|
||||||
|
build-wfa-js: ensure-dist
|
||||||
$(MAKE) -C WFA-JS
|
$(MAKE) -C WFA-JS
|
||||||
cp -f WFA-JS/dist/* web/modules
|
cp -f WFA-JS/dist/* web/modules
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user