Skip to content

Commit a4106a4

Browse files
committed
refactor: migrate composer scripts into just
1 parent b2005a1 commit a4106a4

20 files changed

Lines changed: 175 additions & 273 deletions

File tree

.github/actions/setup-php-env/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ runs:
7070
coverage: ${{ inputs.coverage != '' && inputs.coverage || null }}
7171
env: ${{ inputs.php-env != '' && fromJSON(inputs.php-env) || fromJSON('{}') }}
7272

73+
- name: "Install just"
74+
shell: bash
75+
run: |
76+
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin
77+
just --version
78+
7379
- name: "Install PIE"
7480
if: ${{ inputs.pie-extensions != '' }}
7581
shell: bash

.github/workflows/baseline.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
pie-extensions: "flow-php/pg-query-ext:1.x-dev"
4646

4747
- name: "Build PHAR file"
48-
run: "composer build:phar"
48+
run: "just phar"
4949

5050
- name: "Validate Flow PHAR"
5151
run: |
@@ -121,10 +121,10 @@ jobs:
121121
pie-extensions: "flow-php/pg-query-ext:1.x-dev"
122122

123123
- name: "Generate documentation"
124-
run: "composer build:docs"
124+
run: "just docs"
125125

126126
- name: "Build latest version Flow Phar for playground"
127-
run: "composer build:phar"
127+
run: "just phar"
128128

129129
- name: "Install Landing dependencies"
130130
run: "composer install --no-interaction --no-progress "
@@ -143,7 +143,7 @@ jobs:
143143
working-directory: "web/landing"
144144

145145
- name: "Generate Api References"
146-
run: "composer build:docs:api"
146+
run: "just docs-api"
147147

148148
- name: "Setup Node.js"
149149
uses: actions/setup-node@v4

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ jobs:
3333
cache-key-suffix: "-locked"
3434

3535
- name: "Build Docs"
36-
run: "composer build:docs"
36+
run: "just docs"
3737

3838
- name: Check for uncommitted changes
3939
run: |
4040
if [[ -n "$(git status --porcelain)" ]]; then
41-
echo "Uncommitted changes detected, please run `composer build:docs` and commit the changes."
41+
echo "Uncommitted changes detected, please run `just docs` and commit the changes."
4242
git status
4343
exit 1
4444
else

.github/workflows/job-arrow-extension.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
run: composer install --no-interaction --no-progress
9292

9393
- name: Run Parquet Integration Tests with Arrow
94-
run: composer test -- --testsuite=lib-parquet-integration
94+
run: just test --testsuite=lib-parquet-integration
9595

9696
- name: Upload to Codecov
9797
if: ${{ !cancelled() && matrix.php == '8.3' && matrix.os == 'ubuntu-latest' }}

.github/workflows/job-extension-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ jobs:
3838
cache-key-suffix: "-extensions"
3939

4040
- name: "Test Brotli"
41-
run: "composer test -- --group brotli-extension"
41+
run: "just test --group brotli-extension"
4242

4343
- name: "Test LZ4"
44-
run: "composer test -- --group lz4-extension"
44+
run: "just test --group lz4-extension"
4545

4646
- name: "Test ZSTD"
47-
run: "composer test -- --group zstd-extension"
47+
run: "just test --group zstd-extension"
4848

4949
- name: "Test Snappy"
50-
run: "composer test -- --group snappy-extension"
50+
run: "just test --group snappy-extension"
5151

5252
- name: Upload to Codecov
5353
if: ${{ !cancelled() && matrix.php-version == '8.3' }}

.github/workflows/job-mutation-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: "Mutation Tests"
4343
run: |
4444
if [ "${{ github.event_name }}" = "pull_request" ]; then
45-
composer test:mutation -- --git-diff-filter=AM --git-diff-base=origin/${{ github.base_ref }} --logger-github=false --log-verbosity=none
45+
just test-mutation --git-diff-filter=AM --git-diff-base=origin/${{ github.base_ref }} --logger-github=false --log-verbosity=none
4646
else
47-
composer test:mutation -- --logger-github=false --log-verbosity=none
47+
just test-mutation --logger-github=false --log-verbosity=none
4848
fi

.github/workflows/job-static-analyze.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,8 @@ jobs:
3838
restore-keys: |
3939
php-${{ matrix.php-version }}-cache-phpstan-
4040
41-
- name: "Monorepo Validate"
42-
run: "composer test:monorepo"
41+
- name: "Lint"
42+
run: "just lint"
4343

44-
- name: "Static Analyze - Mago"
45-
run: "composer static:analyze:mago"
46-
47-
- name: "Static Analyze - PHPStan"
48-
run: "composer static:analyze:phpstan -- --error-format=github"
44+
- name: "Static Analyze"
45+
run: "just analyze --error-format=github"

.github/workflows/job-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120

121121
- name: "Test"
122122
timeout-minutes: 10
123-
run: "composer test -- --coverage-clover=./var/phpunit/coverage/clover/coverage.xml --log-junit ./var/phpunit/logs/junit.xml"
123+
run: "just test --coverage-clover=./var/phpunit/coverage/clover/coverage.xml --log-junit ./var/phpunit/logs/junit.xml"
124124
env:
125125
PGSQL_DATABASE_URL: pgsql://postgres:postgres@127.0.0.1:${{ job.services.postgres.ports[5432] }}/postgres?serverVersion=11&charset=utf8
126126
MYSQL_DATABASE_URL: mysql://mysql:mysql@127.0.0.1:${{ job.services.mysql.ports[3306] }}/mysql

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
pie-extensions: "flow-php/pg-query-ext:1.x-dev"
3333

3434
- name: "Build PHAR file"
35-
run: "composer build:phar"
35+
run: "just phar"
3636

3737
- name: "Validate Flow PHAR"
3838
run: |

Justfile

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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

Comments
 (0)