Skip to content

Commit

Permalink
feat: add better linting targets and CI
Browse files Browse the repository at this point in the history
Signed-off-by: tylerslaton <[email protected]>
  • Loading branch information
tylerslaton committed Oct 17, 2024
1 parent 905d667 commit 415ea18
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 35 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: admin

on:
pull_request:
branches:
- main
paths:
- ui/admin/**

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.17.0"

- name: Install dependencies
run: |
cd ui/admin
npm install
- name: Run linter
run: make lint-admin

- name: Verify no changes
run: make no-changes
27 changes: 27 additions & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: api

on:
pull_request:
branches:
- main
paths:
- "**/*.go"

jobs:
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.22.3"

- name: Run linter
run: make lint-api

- name: Verify no changes
run: make no-changes
31 changes: 0 additions & 31 deletions .github/workflows/main.yml

This file was deleted.

22 changes: 21 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,24 @@ dev: ui
@echo "Starting dev otto server and admin UI..."
./dev.sh

.PHONY: ui build all clean dev
# Lint the project
lint: lint-admin lint-api

lint-api:
go fmt ./... && \
go vet ./...

lint-admin:
cd ui/admin && \
npm run format && \
npm run lint

no-changes:
@if [ -n "$$(git status --porcelain)" ]; then \
git status --porcelain; \
git --no-pager diff; \
echo "Encountered dirty repo!"; \
exit 1; \
fi

.PHONY: ui build all clean dev lint lint-ui no-changes
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/a-h/templ v0.2.778 // indirect
github.com/a8m/envsubst v1.4.2 // indirect
github.com/acorn-io/broadcaster v0.0.0-20240105011354-bfadd4a7b45d // indirect
github.com/alecthomas/chroma/v2 v2.8.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63n
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78=
github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/a-h/templ v0.2.778 h1:VzhOuvWECrwOec4790lcLlZpP4Iptt5Q4K9aFxQmtaM=
github.com/a-h/templ v0.2.778/go.mod h1:lq48JXoUvuQrU0VThrK31yFwdRjTCnIE5bcPCM9IP1w=
github.com/a8m/envsubst v1.4.2 h1:4yWIHXOLEJHQEFd4UjrWDrYeYlV7ncFWJOCBRLOZHQg=
github.com/a8m/envsubst v1.4.2/go.mod h1:MVUTQNGQ3tsjOOtKCNd+fl8RzhsXcDvvAEzkhGtlsbY=
github.com/acorn-io/baaah v0.0.0-20240912163758-8f7c537609d1 h1:JobENeM/SoGMlR1/K6DCirRRwBA90FRlynqqqYchOXQ=
Expand Down

0 comments on commit 415ea18

Please sign in to comment.