| 1 |
# Licensed to the Apache Software Foundation (ASF) under one or more |
| 2 |
# contributor license agreements. See the NOTICE file distributed with |
| 3 |
# this work for additional information regarding copyright ownership. |
| 4 |
# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 5 |
# (the "License"); you may not use this file except in compliance with |
| 6 |
# the License. You may obtain a copy of the License at |
| 7 |
# |
| 8 |
# https://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
# |
| 10 |
# Unless required by applicable law or agreed to in writing, software |
| 11 |
# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
# See the License for the specific language governing permissions and |
| 14 |
# limitations under the License. |
| 15 |
|
| 16 |
name: 'Test PHP' |
| 17 |
on: |
| 18 |
workflow_dispatch: |
| 19 |
push: |
| 20 |
branches: [ main ] |
| 21 |
pull_request: |
| 22 |
branches: [ main ] |
| 23 |
paths: |
| 24 |
- .github/workflows/test-lang-php.yml |
| 25 |
- lang/php/** |
| 26 |
|
| 27 |
defaults: |
| 28 |
run: |
| 29 |
working-directory: lang/php |
| 30 |
|
| 31 |
concurrency: |
| 32 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 33 |
cancel-in-progress: true |
| 34 |
|
| 35 |
jobs: |
| 36 |
test: |
| 37 |
runs-on: ${{ matrix.os }} |
| 38 |
strategy: |
| 39 |
matrix: |
| 40 |
os: |
| 41 |
- ubuntu-latest |
| 42 |
- ubuntu-24.04-arm |
| 43 |
php: |
| 44 |
- '7.3' |
| 45 |
- '7.4' |
| 46 |
- '8.0' |
| 47 |
|
| 48 |
steps: |
| 49 |
- uses: actions/checkout@v5 |
| 50 |
|
| 51 |
- name: Setup PHP |
| 52 |
uses: shivammathur/setup-php@v2 |
| 53 |
with: |
| 54 |
php-version: ${{ matrix.php }} |
| 55 |
tools: composer:2.2.5 |
| 56 |
|
| 57 |
- name: Get Composer Cache Directory |
| 58 |
id: composer-cache |
| 59 |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 60 |
|
| 61 |
- uses: actions/cache@v4 |
| 62 |
with: |
| 63 |
path: ${{ steps.composer-cache.outputs.dir }} |
| 64 |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 65 |
restore-keys: | |
| 66 |
${{ runner.os }}-composer- |
| 67 |
|
| 68 |
- name: Lint |
| 69 |
run: ./build.sh lint |
| 70 |
|
| 71 |
- name: Test |
| 72 |
run: ./build.sh test |
| 73 |
|
| 74 |
interop: |
| 75 |
runs-on: ${{ matrix.os }} |
| 76 |
strategy: |
| 77 |
matrix: |
| 78 |
os: |
| 79 |
- ubuntu-latest |
| 80 |
- ubuntu-24.04-arm |
| 81 |
php: |
| 82 |
- '7.3' |
| 83 |
- '7.4' |
| 84 |
- '8.0' |
| 85 |
|
| 86 |
steps: |
| 87 |
- uses: actions/checkout@v5 |
| 88 |
|
| 89 |
- name: Setup PHP |
| 90 |
uses: shivammathur/setup-php@v2 |
| 91 |
with: |
| 92 |
php-version: ${{ matrix.php }} |
| 93 |
tools: composer:2.2.5 |
| 94 |
|
| 95 |
- name: Cache Local Maven Repository |
| 96 |
uses: actions/cache@v4 |
| 97 |
with: |
| 98 |
path: ~/.m2/repository |
| 99 |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 100 |
restore-keys: | |
| 101 |
${{ runner.os }}-maven- |
| 102 |
|
| 103 |
- name: 'Setup Temurin JDK 8, 11, 17 & 21' |
| 104 |
uses: actions/setup-java@v5 |
| 105 |
with: |
| 106 |
distribution: 'temurin' |
| 107 |
java-version: | |
| 108 |
8 |
| 109 |
11 |
| 110 |
17 |
| 111 |
21 |
| 112 |
|
| 113 |
- name: 'Setup Maven 3.9.6' |
| 114 |
uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5 |
| 115 |
with: |
| 116 |
maven-version: 3.9.6 |
| 117 |
|
| 118 |
- name: Install Java Avro for Interop Test |
| 119 |
working-directory: . |
| 120 |
run: mvn -B install -PskipQuality |
| 121 |
|
| 122 |
- name: Create Interop Data Directory |
| 123 |
working-directory: . |
| 124 |
run: mkdir -p build/interop/data |
| 125 |
|
| 126 |
- name: Generate Interop Resources |
| 127 |
working-directory: lang/java/avro |
| 128 |
run: mvn -B -P interop-data-generate generate-resources |
| 129 |
|
| 130 |
- uses: actions/checkout@v5 |
| 131 |
with: |
| 132 |
repository: kjdev/php-ext-zstd |
| 133 |
path: lang/php/php-ext-zstd |
| 134 |
|
| 135 |
- name: Install php-ext-zstd |
| 136 |
working-directory: lang/php/php-ext-zstd |
| 137 |
run: | |
| 138 |
sudo apt-get install -qqy --no-install-recommends libzstd-dev libbz2-dev |
| 139 |
phpize |
| 140 |
./configure --with-libzstd |
| 141 |
make |
| 142 |
sudo make install |
| 143 |
echo "extension=zstd.so" | sudo tee -a /etc/php/${{ matrix.php }}/cli/conf.d/10-zstd.ini |
| 144 |
php -m |
| 145 |
|
| 146 |
- uses: actions/checkout@v5 |
| 147 |
with: |
| 148 |
repository: kjdev/php-ext-snappy |
| 149 |
path: lang/php/php-ext-snappy |
| 150 |
submodules: true |
| 151 |
|
| 152 |
|
| 153 |
- name: Install php-ext-snappy |
| 154 |
working-directory: lang/php/php-ext-snappy |
| 155 |
run: | |
| 156 |
sudo apt-get install -qqy --no-install-recommends libsnappy-dev |
| 157 |
phpize |
| 158 |
./configure --with-libsnappy |
| 159 |
make |
| 160 |
sudo make install |
| 161 |
echo "extension=snappy.so" | sudo tee -a /etc/php/${{ matrix.php }}/cli/conf.d/10-snappy.ini |
| 162 |
php -m |
| 163 |
|
| 164 |
- name: Generate Interop Data |
| 165 |
run: ./build.sh interop-data-generate |
| 166 |
|
| 167 |
- name: Run Interop Tests |
| 168 |
run: ./build.sh test-interop |