Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,13 @@ on:
push:
branches: [ main ]
paths:
- 'cmd/**'
- 'internal/**'
- 'go.mod'
- 'go.sum'
- 'cli/**'
- 'examples/**'
- '.github/workflows/cli.yml'
pull_request:
branches: [ main ]
paths:
- 'cmd/**'
- 'internal/**'
- 'go.mod'
- 'go.sum'
- 'cli/**'
- 'examples/**'
- '.github/workflows/cli.yml'
workflow_dispatch:
Expand All @@ -32,7 +26,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache-dependency-path: go.sum
cache-dependency-path: cli/go.sum

- name: Install linters
run: make lint-install
Expand All @@ -54,21 +48,21 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache-dependency-path: go.sum
cache-dependency-path: cli/go.sum

- name: Download dependencies
run: go mod download
run: cd cli && go mod download

- name: Check formatting
if: matrix.os == 'ubuntu-latest'
run: |
test -z "$(gofmt -l cmd internal)" || (echo "Files not formatted:"; gofmt -l cmd internal; exit 1)
test -z "$(gofmt -l cli/cmd cli/internal)" || (echo "Files not formatted:"; gofmt -l cli/cmd cli/internal; exit 1)

- name: Build
run: go build -o ./bin/yapi ./cmd/yapi
run: cd cli && go build -o ./bin/yapi ./cmd/yapi

- name: Test
run: go test ./...
run: cd cli && go test ./...

# - name: Fuzz tests
# run: go run ./scripts/fuzz.go
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/github-action-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build Github Action

on:
push:
paths:
- 'integrations/github-action/**'
pull_request:
paths:
- 'integrations/github-action/**'

jobs:
check-dist:
name: Check dist is up to date
runs-on: ubuntu-latest

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

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Install dependencies
working-directory: integrations/github-action
run: pnpm install --frozen-lockfile

- name: Build
working-directory: integrations/github-action
run: pnpm run build

- name: Check for uncommitted changes
working-directory: integrations/github-action
run: |
if [ -n "$(git status --porcelain dist/)" ]; then
echo "::error::dist/ is out of date. Run 'pnpm run build' in integrations/github-action/ and commit the changes."
echo ""
echo "Changed files:"
git status --porcelain dist/
echo ""
echo "Diff:"
git diff dist/
exit 1
fi
echo "dist/ is up to date"
2 changes: 1 addition & 1 deletion .github/workflows/vscode-extension-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: vscode-extension
path: extensions/vscode-extension/*.vsix
path: integrations/vscode/*.vsix
retention-days: 30
12 changes: 5 additions & 7 deletions .github/workflows/web-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ on:
paths:
- 'apps/web/**'
- 'packages/**'
- 'cmd/**'
- 'internal/**'
- 'cli/**'
- '.github/workflows/web-tests.yml'
pull_request:
branches: [ main ]
paths:
- 'apps/web/**'
- 'packages/**'
- 'cmd/**'
- 'internal/**'
- 'cli/**'
- '.github/workflows/web-tests.yml'
workflow_dispatch:

Expand Down Expand Up @@ -52,14 +50,14 @@ jobs:
- name: Build & Install Yapi CLI
run: |
make build
sudo cp ./bin/yapi /usr/local/bin/yapi
sudo cp ./cli/bin/yapi /usr/local/bin/yapi
yapi version

- name: Run yapi integration tests
uses: ./action # jamierpond/yapi/action@main
uses: ./integrations/github-action
with:
skip-install: true
start: pnpm --filter web start --port 3000
start: pnpm --filter @yapi/web start --port 3000
wait-on: http://localhost:3000/healthz
command: yapi test ./apps/web/yapi -a -p 16

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ unipmorted.txt
aur_ed25519
aur_ed25519.pub
dist
!integrations/github-action/dist
.env*.local
apps/web/icons
coverage.out
cli/bin/yapi
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "apps/web/madea-blog-core"]
path = apps/web/madea-blog-core
[submodule "packages/madea-blog-core"]
path = packages/madea-blog-core
url = https://github.com/jamierpond/madea-blog-core.git
1 change: 1 addition & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ project_name: yapi

builds:
- id: yapi
dir: cli
main: ./cmd/yapi
binary: yapi
ldflags:
Expand Down
46 changes: 23 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LDFLAGS := -X main.version=$(VERSION) -X main.commit=$(COMMIT) -X main.date=$(DA

install: build
@echo "Installing yapi to $$(go env GOPATH)/bin..."
@cp ./bin/yapi $$(go env GOPATH)/bin/yapi
@cp ./cli/bin/yapi $$(go env GOPATH)/bin/yapi
@codesign --sign - --force $$(go env GOPATH)/bin/yapi 2>/dev/null || true
@echo "Done! Ensure $$(go env GOPATH)/bin is in your PATH."

Expand All @@ -18,8 +18,8 @@ kore:


fuzz-cover:
@go test ./... -run=Fuzz -coverprofile=fuzz.cov
@go tool cover -func=fuzz.cov
@cd cli && go test ./... -run=Fuzz -coverprofile=fuzz.cov
@cd cli && go tool cover -func=fuzz.cov

# Install linting tools
lint-install:
Expand All @@ -30,56 +30,56 @@ lint-install:
# Quick lint (go vet + fmt check)
lint-quick:
@echo "Running go vet..."
@go vet ./...
@cd cli && go vet ./...
@echo "Checking gofmt..."
@test -z "$$(gofmt -s -l cmd internal)" || (echo "Files need formatting:"; gofmt -s -l cmd internal; exit 1)
@test -z "$$(gofmt -s -l cli/cmd cli/internal)" || (echo "Files need formatting:"; gofmt -s -l cli/cmd cli/internal; exit 1)

# Standard lint (golangci-lint with all enabled linters)
lint:
@echo "Running golangci-lint..."
@golangci-lint run ./...
@cd cli && golangci-lint run ./...

# Full lint (includes vulnerability check)
lint-full: lint
@echo "Running govulncheck..."
@govulncheck ./...
@cd cli && govulncheck ./...

build:
@echo "Building yapi CLI..."
@go build -ldflags "$(LDFLAGS)" -o ./bin/yapi ./cmd/yapi
@codesign --sign - --force ./bin/yapi 2>/dev/null || true
@cd cli && go build -ldflags "$(LDFLAGS)" -o ./bin/yapi ./cmd/yapi
@codesign --sign - --force ./cli/bin/yapi 2>/dev/null || true

run:
@echo "Running yapi CLI..."
@go run ./cmd/yapi
@cd cli && go run ./cmd/yapi

run-print-analytics: build
@echo "Running yapi CLI with analytics printing..."
@YAPI_PRINT_ANALYTICS=1 ./bin/yapi $(RUN_ARGS)
@YAPI_PRINT_ANALYTICS=1 ./cli/bin/yapi $(RUN_ARGS)

test:
@echo "Running all tests..."
@go test -cover -coverprofile=coverage.out ./...
@cd cli && go test -cover -coverprofile=coverage.out ./...
@echo ""
@echo "Coverage summary:"
@go tool cover -func=coverage.out | grep total | awk '{print "Total coverage: " $$3}'
@rm -f coverage.out
@cd cli && go tool cover -func=coverage.out | grep total | awk '{print "Total coverage: " $$3}'
@rm -f cli/coverage.out

fuzz:
@go run ./scripts/fuzz.go
@cd cli && go run ./scripts/fuzz.go

fmt:
@echo "Formatting code..."
@gofmt -w .
@gofmt -w ./cli

fmt-check:
@echo "Checking formatting..."
@test -z "$$(gofmt -l cmd internal)" || (echo "Files not formatted:"; gofmt -l cmd internal; exit 1)
@test -z "$$(gofmt -l cli/cmd cli/internal)" || (echo "Files not formatted:"; gofmt -l cli/cmd cli/internal; exit 1)

clean:
@echo "Cleaning up..."
@rm -f ./bin/yapi
@go clean
@rm -f ./cli/bin/yapi
@cd cli && go clean


web:
Expand All @@ -92,13 +92,13 @@ web-run:
docker run --name yapi -p 3000:3000 ${NAME}:latest

bump-patch:
@./scripts/bump.sh patch
@./cli/scripts/bump.sh patch

bump-minor:
@./scripts/bump.sh minor
@./cli/scripts/bump.sh minor

bump-major:
@./scripts/bump.sh major
@./cli/scripts/bump.sh major

release:
@BRANCH=$$(git rev-parse --abbrev-ref HEAD); \
Expand All @@ -116,7 +116,7 @@ release:

gen-docs:
@echo "Generating CLI documentation..."
@go run scripts/gendocs.go
@cd cli && go run scripts/gendocs.go


gh-action:
Expand Down
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"ajv": "^8.17.1",
"highlight.js": "^11.11.1",
"madea-blog-core": "workspace:*",
"simple-git": "^3.22.0",
"monaco-editor": "^0.52.0",
"monaco-yaml": "^5.4.0",
"next": "16.1.1",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions scripts/vercel-build.sh → cli/scripts/vercel-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ LDFLAGS="-X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE


echo "Building yapi CLI..."
cd cli
go build -ldflags "${LDFLAGS}" -o ./bin/yapi ./cmd/yapi

echo "Installing yapi to /usr/local/bin..."
Expand All @@ -51,6 +52,7 @@ yapi version 2>/dev/null || true

echo "Generating CLI documentation..."
go run scripts/gendocs.go
cd ..

echo "Building madea-blog-core..."
pnpm --filter madea-blog-core build
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading
Loading