docs(queue): Broker\Nats control connection is inertia, not intent #591
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| packages: | |
| description: 'Space-separated package names (default: all)' | |
| required: false | |
| default: '' | |
| jobs: | |
| changed: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.changed.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # ratchet:actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - id: changed | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| CHANGED="${{ inputs.packages }}" | |
| [ -n "$CHANGED" ] || CHANGED=$(ls packages) | |
| else | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| RANGE="origin/${{ github.base_ref }}...HEAD" | |
| elif git rev-parse -q --verify "${{ github.event.before }}" > /dev/null; then | |
| RANGE="${{ github.event.before }}..HEAD" | |
| else | |
| RANGE="HEAD~1..HEAD" | |
| fi | |
| CHANGED=$(git diff --name-only "$RANGE" -- packages/ | cut -d/ -f2) | |
| # tooling changes affect every package | |
| if git diff --name-only "$RANGE" | grep -qE '^(bin/|\.github/|composer\.json|pint\.json)'; then | |
| CHANGED=$(ls packages) | |
| fi | |
| fi | |
| CHANGED=$(echo "$CHANGED" | tr ' ' '\n' | sort -u \ | |
| | while read -r package; do [ -d "packages/$package" ] && echo "$package"; done) | |
| # docs-only change: no packages to test | |
| if [ -z "$CHANGED" ]; then | |
| echo "matrix=[]" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| # Dependents of changed packages run linked (siblings resolved from | |
| # the local checkout); changed packages run registry-resolved — | |
| # unless a sibling they depend on also changed, which makes the | |
| # registry combination unbuildable until that sibling releases. | |
| LINKED=$(bin/monorepo dependents $CHANGED) | |
| MATRIX=$( | |
| { | |
| for package in $LINKED; do | |
| printf '{"package":"%s","linked":true}\n' "$package" | |
| done | |
| for package in $CHANGED; do | |
| case " $(echo $LINKED) " in | |
| *" $package "*) ;; | |
| *) printf '{"package":"%s","linked":false}\n' "$package" ;; | |
| esac | |
| done | |
| } | jq --compact-output --slurp 'unique' | |
| ) | |
| echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT" | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # ratchet:actions/checkout@v6 | |
| - run: bin/monorepo validate | |
| - name: Enforce pinned workflow actions | |
| run: > | |
| docker run --rm -v "$PWD:$PWD" -w "$PWD" ghcr.io/sethvargo/ratchet:0.11.4 | |
| lint .github/workflows/*.yml | |
| - name: Lint documentation | |
| uses: vale-cli/vale-action@85f9f7f2c5f449ac0ae5b66662961bae3f77ca6a # ratchet:vale-cli/vale-action@v2.1.2 | |
| with: | |
| version: 3.15.1 | |
| files: '["README.md", "docs", "packages"]' | |
| fail_on_error: true | |
| filter_mode: nofilter | |
| test: | |
| name: test (${{ matrix.package }}${{ matrix.linked && ', linked' || '' }}) | |
| needs: changed | |
| if: needs.changed.outputs.matrix != '[]' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJson(needs.changed.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # ratchet:actions/checkout@v6 | |
| - id: meta | |
| run: | | |
| EXTENSIONS=$(jq -r '[(.require, ."require-dev", .suggest | select(. != null)) | keys[] | select(startswith("ext-")) | ltrimstr("ext-")] | unique | join(", ")' packages/${{ matrix.package }}/composer.json) | |
| echo "extensions=$EXTENSIONS" >> "$GITHUB_OUTPUT" | |
| # Test each package on the higher of its declared PHP floor and the | |
| # baseline 8.4, so a package that requires a newer PHP (e.g. >=8.5) | |
| # is tested there without dropping siblings below the baseline. | |
| FLOOR=$(jq -r '.require.php // ""' packages/${{ matrix.package }}/composer.json | grep -oE '[0-9]+\.[0-9]+' | head -1) | |
| PHP=$(printf '%s\n8.4\n' "$FLOOR" | grep -E '^[0-9]+\.[0-9]+$' | sort -V | tail -1) | |
| echo "php=$PHP" >> "$GITHUB_OUTPUT" | |
| - uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # ratchet:shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ steps.meta.outputs.php }} | |
| extensions: ${{ steps.meta.outputs.extensions }} | |
| coverage: none | |
| - if: ${{ !matrix.linked }} | |
| run: bin/monorepo check ${{ matrix.package }} | |
| - run: bin/monorepo test ${{ matrix.package }} ${{ matrix.linked && '--linked' || '' }} |