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
9 changes: 9 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ jobs:
timeout-minutes: 6
run: make test-ndebug

- name: Test Tools (make test-tools)
timeout-minutes: 3
run: make test-tools

# Run lint only for target version
- name: Install golangci-lint
if: matrix.go == 'go.mod'
Expand All @@ -90,3 +94,8 @@ jobs:
if: matrix.go == 'go.mod'
timeout-minutes: 5
run: pre-commit run --all-files --show-diff-on-failure

- name: Run license check
if: matrix.go == 'go.mod'
timeout-minutes: 2
run: make license-check
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ jobs:
- name: Generate test coverage report
run: make coverage

- name: Run license check
timeout-minutes: 2
run: make license-check

- name: Run tools test suite
timeout-minutes: 3
run: make test-tools

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0
with:
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ make test
# Fast focused testing (bypasses ANTLR codegen)
go test ./test/printer/...
go test -v ./test/printer -run TestAssertStatement
go test ./test/... ./cmd/... ./pkg/... ./tools/... # Never run 'go test ./...' from root (scans ./venv)
go test ./test/... ./cmd/... ./pkg/... # Never run 'go test ./...' from root (scans ./venv)

# Build binaries (outputs to build/bin/dmlfmt, build/bin/dmlast)
make build/bin/dmlfmt
Expand Down
620 changes: 301 additions & 319 deletions LICENSE

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ $(DMLEX_GENERATED_FLAG): $(G4_GENERATED_FLAG) $(BUILD_ENV_DIR)
$(DMLEX_GENERATED_FLAG):
rm -f ./pkg/dmlex/dml_parser*.go
cp $(filter-out $(G4_DML_DIR)/dml_parser.go,$(G4_GENERATED_FILES)) ./pkg/dmlex/
$(GO) run ./tools/baker -out ./pkg/dmlex $(G4_DML_DIR)/dml_parser.go > /dev/null
(cd tools/baker && $(GO) run . -out $(realpath .)/pkg/dmlex $(realpath .)/$(G4_DML_DIR)/dml_parser.go > /dev/null)
rm -f $(G4_GENERATED_FILES)
ifneq ($(filter-out 0 false FALSE no NO,$(CI)),)
@$(CHECK_GENERATED_CLEAN)
Expand Down Expand Up @@ -175,10 +175,10 @@ web: build-wasm
$(PYTHON) -m http.server --directory cmd/dml-web-format --bind 127.0.0.1 8080

test: build-gocache
$(GO) test -timeout 60s ./test/... ./cmd/... ./pkg/... ./tools/...
$(GO) test -timeout 60s ./test/... ./cmd/... ./pkg/...

test-ndebug: build-gocache
$(GO) test -tags dmltools.ndebug -timeout 60s ./test/... ./cmd/... ./pkg/... ./tools/...
$(GO) test -tags dmltools.ndebug -timeout 60s ./test/... ./cmd/... ./pkg/...

coverage: build-gocache
$(GO) test -timeout 60s -coverprofile=coverage.out -coverpkg=./pkg/...,./cmd/... ./test/... ./cmd/... ./pkg/...
Expand Down Expand Up @@ -235,4 +235,11 @@ doc-web:
@open "http://localhost:6060/pkg/github.com/timoschenko/dmltools/" 2>/dev/null || true
-$(GODOC) -http=:6060

.PHONY: format generate test test-ndebug coverage clean-coverage clean clean-gocache clean-go-testcache clean-go-fuzzcache web goreleaser-check goreleaser-build goreleaser-snapshot web-dist doc doc-web
license-check:
(cd tools/licensecheck && $(GO) run . -root ../..)

test-tools:
(cd tools/licensecheck && $(GO) test -v ./...)
(cd tools/baker && $(GO) test -v ./...)

.PHONY: format generate test test-ndebug coverage clean-coverage clean clean-gocache clean-go-testcache clean-go-fuzzcache web goreleaser-check goreleaser-build goreleaser-snapshot web-dist doc doc-web license-check test-tools
24 changes: 19 additions & 5 deletions tools/baker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,29 @@ It can either:

## Usage

### From inside `tools/baker`:

```bash
cd tools/baker

# Print JSON to stdout
go run ./tools/baker <path/to/file.go>
go run . <path/to/file.go>

# Print compact JSON to stdout
go run ./tools/baker -compact <path/to/file.go>
go run . -compact <path/to/file.go>

# Generate split Go files in a folder and print filenames to stdout
go run ./tools/baker -out ./pkg/dmlex/split <path/to/file.go>
go run . -out ../../pkg/dmlex/split <path/to/file.go>
```

### From repository root:

```bash
# Print JSON to stdout
(cd tools/baker && go run . "$(realpath <path/to/file.go>)")

# Generate split Go files
(cd tools/baker && go run . -out "$(realpath ./pkg/dmlex/split)" "$(realpath <path/to/file.go>)")
```

## Exit Codes
Expand Down Expand Up @@ -75,8 +89,8 @@ go run ./tools/baker -out ./pkg/dmlex/split <path/to/file.go>

```bash
# Run unit tests
go test -v ./tools/baker/...
(cd tools/baker && go test -v ./...)

# Run linter
golangci-lint run ./tools/baker/...
(cd tools/baker && golangci-lint run)
```
3 changes: 3 additions & 0 deletions tools/baker/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module tools/baker

go 1.23
5 changes: 5 additions & 0 deletions tools/licensecheck/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module tools/licensecheck

go 1.23

require github.com/google/licensecheck v0.3.1
2 changes: 2 additions & 0 deletions tools/licensecheck/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/google/licensecheck v0.3.1 h1:QoxgoDkaeC4nFrtGN1jV7IPmDCHFNIVh54e5hSt6sPs=
github.com/google/licensecheck v0.3.1/go.mod h1:ORkR35t/JjW+emNKtfJDII0zlciG9JgbT7SmsohlHmY=
Loading
Loading