Build gRPC PHP (Ubuntu 24.04 Multi-Arch) #3
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: Build gRPC PHP (Ubuntu 24.04 Multi-Arch) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| grpc_version: | |
| description: 'Versi gRPC di PECL (contoh: 1.80.0RC1)' | |
| required: true | |
| default: '1.80.0RC1' | |
| php_version: | |
| description: 'Versi PHP (contoh: 8.3)' | |
| required: true | |
| default: '8.3' | |
| jobs: | |
| build-pecl: | |
| name: Build on ${{ matrix.arch }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-24.04 | |
| arch: amd64 | |
| - os: ubuntu-24.04-arm | |
| arch: arm64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: 1. Update Sistem & Install Dependensi Dasar | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y software-properties-common curl build-essential zlib1g-dev binutils | |
| - name: 2. Tambahkan PPA Ondřej & Install PHP + PEAR + XML | |
| # Kunci perbaikannya ada di baris paling bawah ini (menambahkan paket php-xml) | |
| run: | | |
| sudo add-apt-repository -y ppa:ondrej/php | |
| sudo apt-get update | |
| sudo apt-get install -y php${{ github.event.inputs.php_version }}-dev php${{ github.event.inputs.php_version }}-cli php-pear php${{ github.event.inputs.php_version }}-xml | |
| - name: 3. Compile gRPC via PECL | |
| run: | | |
| sudo pecl install grpc-${{ github.event.inputs.grpc_version }} | |
| - name: 4. Ambil dan strip File grpc.so | |
| run: | | |
| EXT_DIR=$(php-config --extension-dir) | |
| echo "File grpc.so berhasil dibuat di direktori: $EXT_DIR" | |
| strip --strip-debug -o ./grpc.so $EXT_DIR/grpc.so | |
| - name: 5. Upload File grpc.so sebagai Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: grpc-${{ matrix.arch }}-ubuntu22.04-php${{ github.event.inputs.php_version }}-v${{ github.event.inputs.grpc_version }} | |
| path: ./grpc.so |