From c00d6ecca7923ebf678a4d0d9b182b098ae3ac83 Mon Sep 17 00:00:00 2001 From: Gustavo Maronato Date: Thu, 21 Sep 2023 22:56:01 -0300 Subject: [PATCH] better build and stuff --- .github/workflows/{go.yml => check.yml} | 19 ++++++++++++++++--- Makefile | 13 +++++++++++-- frontend/package.json | 1 + 3 files changed, 28 insertions(+), 5 deletions(-) rename .github/workflows/{go.yml => check.yml} (54%) diff --git a/.github/workflows/go.yml b/.github/workflows/check.yml similarity index 54% rename from .github/workflows/go.yml rename to .github/workflows/check.yml index 1e57907..3fbac3e 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/check.yml @@ -1,4 +1,4 @@ -name: Go +name: Check on: push: branches: @@ -20,13 +20,26 @@ jobs: go-version: "1.21" cache: false - - name: golangci-lint + - uses: actions/setup-node@v3 + with: + node-version: "18" + + - name: install deps + run: make install + + - name: lint frontend + run: make lint-frontend + + - name: create fake frontend file for backend linting + run: mkdir frontend/dist && touch frontend/dist/index.html + + - name: lint backend uses: golangci/golangci-lint-action@v3 with: version: v1.54 - name: build - run: make build + run: make all - name: test run: make test diff --git a/Makefile b/Makefile index 32e33f3..b503c4e 100644 --- a/Makefile +++ b/Makefile @@ -24,8 +24,17 @@ serve: dev: go run goshort.go dev -lint: +lint-frontend: + VITE_API_URL=/api npm run --prefix frontend lint + +lint-frontend-fix: + VITE_API_URL=/api npm run --prefix frontend lint:fix + +lint-backend: golangci-lint run -lint-fix: +lint-backend-fix: golangci-lint run --fix + +test: + go test -v ./... diff --git a/frontend/package.json b/frontend/package.json index f63e079..b6563a6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -7,6 +7,7 @@ "dev": "vite", "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", + "lint:fix": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix", "preview": "vite preview" }, "dependencies": {