|
| 1 | +# Flow PHP task runner. |
| 2 | +# Run `just` or `just --list` to see available recipes. |
| 3 | + |
| 4 | +set shell := ["bash", "-cu"] |
| 5 | + |
| 6 | +default: |
| 7 | + @just --list |
| 8 | + |
| 9 | +# Install all dependencies (root + tool dirs via composer post-install-cmd hook). |
| 10 | +install: |
| 11 | + composer install |
| 12 | + |
| 13 | +# Update all dependencies (root + tool dirs via composer post-update-cmd hook). |
| 14 | +update: |
| 15 | + composer update |
| 16 | + |
| 17 | +# Full build pipeline: lint, static analysis, tests, mutation. |
| 18 | +build: lint analyze test test-mutation |
| 19 | + |
| 20 | +# Run PHPUnit. Extra arguments are forwarded (e.g. `just test --filter=foo`). |
| 21 | +test *args: |
| 22 | + tools/phpunit/vendor/bin/phpunit {{args}} |
| 23 | + |
| 24 | +# Run mutation testing with Infection. |
| 25 | +test-mutation *args: |
| 26 | + tools/infection/vendor/bin/infection --threads=max {{args}} |
| 27 | + |
| 28 | +# Run tests for the landing site. |
| 29 | +test-website: |
| 30 | + composer test --working-dir=./web/landing |
| 31 | + |
| 32 | +# Run all linters: Mago format-check + Mago lint + monorepo validation. |
| 33 | +lint: lint-mago lint-monorepo |
| 34 | + |
| 35 | +# Run Mago format check and lint. |
| 36 | +lint-mago: |
| 37 | + tools/mago/vendor/bin/mago format --check |
| 38 | + tools/mago/vendor/bin/mago lint |
| 39 | + |
| 40 | +# Validate the monorepo configuration. |
| 41 | +lint-monorepo: |
| 42 | + tools/monorepo/vendor/bin/monorepo-builder validate |
| 43 | + |
| 44 | +# Lint markdown links across the repository. |
| 45 | +lint-links: |
| 46 | + docker run -t --rm -v $PWD:/app norberttech/md-link-linter --exclude=vendor --exclude=.scratchpad --exclude=documentation . |
| 47 | + |
| 48 | +# Run static analysis (PHPStan). |
| 49 | +analyze *args: |
| 50 | + tools/phpstan/vendor/bin/phpstan analyze -c phpstan.neon --memory-limit=-1 {{args}} |
| 51 | + |
| 52 | +# Auto-fix code style with Mago (format + lint --fix). |
| 53 | +fix: |
| 54 | + tools/mago/vendor/bin/mago format |
| 55 | + tools/mago/vendor/bin/mago lint --fix --potentially-unsafe --format-after-fix |
| 56 | + |
| 57 | +# Build the Flow PHAR archive and copy it into the landing site assets. |
| 58 | +phar: |
| 59 | + bin/build-phar.sh |
| 60 | + cp ./build/flow.phar ./web/landing/assets/wasm/tools/flow.phar |
| 61 | + |
| 62 | +# Build the WASM artifact (also rebuilds the PHAR). |
| 63 | +wasm: && phar |
| 64 | + cd wasm && ./build.sh |
| 65 | + |
| 66 | +# Build the Docker image. |
| 67 | +docker: |
| 68 | + docker buildx build -t flow-php/flow:latest . --progress=plain --load |
| 69 | + |
| 70 | +# Dump DSL and API JSON used by the landing site. |
| 71 | +docs: |
| 72 | + bin/docs.php dsl:dump web/landing/resources/dsl.json |
| 73 | + bin/docs.php api:dump web/landing/resources/api.json |
| 74 | + |
| 75 | +# Generate phpDocumentor API docs for every package config under phpdoc/. |
| 76 | +docs-api: |
| 77 | + for cfg in phpdoc/*.xml; do \ |
| 78 | + ./tools/phpdocumentor/vendor/bin/phpdoc --config="$cfg" || exit 1; \ |
| 79 | + done |
| 80 | + |
| 81 | +# Regenerate Parquet Thrift PHP classes. |
| 82 | +gen-thrift: && fix |
| 83 | + grep -q 'namespace php Flow.Parquet.ThriftModel' src/lib/parquet/src/Flow/Parquet/Resources/Thrift/parquet.thrift || { echo "Flow php namespace not found in thrift definition!"; exit 1; } |
| 84 | + rm src/lib/parquet/src/Flow/Parquet/ThriftModel/*.php |
| 85 | + thrift --gen php --out src/lib/parquet/src src/lib/parquet/src/Flow/Parquet/Resources/Thrift/parquet.thrift |
| 86 | + |
| 87 | +# Regenerate PostgreSQL pg_query Protobuf PHP classes. |
| 88 | +gen-protobuf-pg: && fix |
| 89 | + rm -rf src/lib/postgresql/src/Flow/PostgreSql/Protobuf |
| 90 | + protoc --php_out=src/lib/postgresql/src --proto_path=src/lib/postgresql/resources/proto pg_query.proto |
| 91 | + |
| 92 | +# Regenerate OpenTelemetry OTLP Protobuf PHP classes. |
| 93 | +gen-protobuf-otlp: |
| 94 | + src/bridge/telemetry/otlp/bin/generate-proto.sh |
0 commit comments