| name: PHP Extension Tests |
| |
| on: |
| workflow_call: |
| inputs: |
| safe-checkout: |
| required: true |
| description: "The SHA key for the commit we want to run over" |
| type: string |
| |
| permissions: |
| contents: read # to fetch code (actions/checkout) |
| |
| jobs: |
| build-php: |
| name: Build |
| runs-on: ubuntu-latest |
| container: ${{ matrix.php-image }} |
| strategy: |
| matrix: |
| php-image: |
| - php:7.4-cli |
| - php:8.1-cli |
| # TODO(b/266868629) Dockerize these instead of installing all the |
| # dependencies on each run. |
| steps: |
| - name: Install python3 |
| run: | |
| apt-get update -q |
| apt-get install -qy python3 |
| - name: Install bazel |
| run: | |
| apt-get install -qy wget |
| mkdir $HOME/bin |
| wget -O $HOME/bin/bazel https://github.com/bazelbuild/bazel/releases/download/5.3.2/bazel-5.3.2-linux-x86_64 |
| chmod a+x $HOME/bin/bazel |
| - name: Install git |
| run: | |
| apt-get install -qy --no-install-recommends git |
| - name: Checkout |
| uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 |
| with: |
| ref: ${{ inputs.safe-checkout }} |
| submodules: recursive |
| - name: Create package |
| run: | |
| cd $GITHUB_WORKSPACE |
| rm -rf bazel-bin/php/protobuf-*.tgz |
| $HOME/bin/bazel build php:release |
| - name: Compile extension |
| run: | |
| cd /tmp |
| MAKE="make -j$(nproc)" pecl install $GITHUB_WORKSPACE/bazel-bin/php/protobuf-*.tgz |
| - name: Enable extension |
| run: docker-php-ext-enable protobuf |
| - name: Inspect extension |
| run: php --ri protobuf |