Repository navigation
another fix, maybe #10
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: Monorepo Split Plan | |
| on: | |
| push: | |
| branches: [main] | |
| tags: | |
| - 'v*' | |
| paths: | |
| - '.github/monorepo-split.json' | |
| - '.github/scripts/monorepo-split-plan.php' | |
| - '.github/workflows/monorepo-split-plan.yml' | |
| - 'src/SonsOfPHP/**/composer.json' | |
| - 'src/**' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - '.github/monorepo-split.json' | |
| - '.github/scripts/monorepo-split-plan.php' | |
| - '.github/workflows/monorepo-split-plan.yml' | |
| - 'src/SonsOfPHP/**/composer.json' | |
| - 'src/**' | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| plan: | |
| name: Dry-run split plan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| coverage: none | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22' | |
| cache: false | |
| - name: Install splitsh-lite | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential cmake libssh2-1-dev libssl-dev pkg-config zlib1g-dev | |
| curl -LsSf https://github.com/libgit2/libgit2/archive/refs/tags/v1.5.0.tar.gz | tar -xz | |
| cmake -S libgit2-1.5.0 -B libgit2-1.5.0/build \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_INSTALL_PREFIX=/usr/local/libgit2-1.5 \ | |
| -DBUILD_TESTS=OFF | |
| cmake --build libgit2-1.5.0/build --parallel 2 | |
| sudo cmake --install libgit2-1.5.0/build | |
| echo "PKG_CONFIG_PATH=/usr/local/libgit2-1.5/lib/pkgconfig" >> "$GITHUB_ENV" | |
| echo "LD_LIBRARY_PATH=/usr/local/libgit2-1.5/lib" >> "$GITHUB_ENV" | |
| export PKG_CONFIG_PATH=/usr/local/libgit2-1.5/lib/pkgconfig | |
| export LD_LIBRARY_PATH=/usr/local/libgit2-1.5/lib | |
| GOBIN="$RUNNER_TEMP/bin" go install github.com/splitsh/lite@master | |
| sudo mv "$RUNNER_TEMP/bin/lite" /usr/local/bin/splitsh-lite | |
| splitsh-lite --help | |
| - name: Validate split config | |
| run: php .github/scripts/monorepo-split-plan.php | |
| - name: Plan pull request package splits | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| php .github/scripts/monorepo-split-plan.php \ | |
| --base='${{ github.event.pull_request.base.sha }}' \ | |
| --head='${{ github.event.pull_request.head.sha }}' \ | |
| --origin='${{ github.event.pull_request.head.sha }}' \ | |
| --calculate-splits | |
| - name: Plan mainline package splits | |
| if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| php .github/scripts/monorepo-split-plan.php \ | |
| --base='${{ github.event.before }}' \ | |
| --head='${{ github.sha }}' \ | |
| --origin='${{ github.sha }}' \ | |
| --calculate-splits | |
| - name: Plan release tag package splits | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| php .github/scripts/monorepo-split-plan.php \ | |
| --tag='${{ github.ref_name }}' \ | |
| --origin='${{ github.ref }}' \ | |
| --calculate-splits |