diff --git a/.github/workflows/gmssl-centos.yml b/.github/workflows/gmssl-centos.yml new file mode 100644 index 0000000..68a7c9a --- /dev/null +++ b/.github/workflows/gmssl-centos.yml @@ -0,0 +1,61 @@ +name: Build GmSSL for PHP on Windows and CentOS + +on: + # push: + # branches: + # - main + workflow_dispatch: + +jobs: + build-linux: + name: Build on CentOS (PHP ${{ matrix.php }}) + runs-on: ubuntu-latest + strategy: + matrix: + php: [8.1.0] + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # - name: Install dependencies for CentOS + # run: | + # sudo yum -y install gcc gcc-c++ cmake make wget php-devel libssl-dev + # sudo yum -y groupinstall "Development Tools" + - name: Install dependencies for Ubuntu + run: | + sudo apt-get update + sudo apt-get install -y gcc g++ cmake make wget php-dev libssl-dev + sudo apt-get install -y build-essential + + - name: Download and compile PHP ${{ matrix.php }} + run: | + wget https://www.php.net/distributions/php-${{ matrix.php }}.tar.gz + tar -xf php-${{ matrix.php }}.tar.gz + cd php-${{ matrix.php }} + ./configure --prefix=$HOME/php-${{ matrix.php }} --disable-all + make -j$(nproc) + make install + + - name: Download and compile GmSSL (static library) + run: | + git clone https://github.com/guanzhi/GmSSL.git + cd GmSSL + cmake -DBUILD_SHARED_LIBS=OFF . + make -j$(nproc) + # ls -lh bin/libgmssl.a + ls -lh # Add debugging output to check if libgmssl.a exists + + - name: Build GmSSL PHP extension for PHP ${{ matrix.php }} + run: | + cd php-${{ matrix.php }} + $HOME/php-${{ matrix.php }}/bin/phpize + ./configure --with-php-config=$HOME/php-${{ matrix.php }}/bin/php-config --with-gmssl + make -j$(nproc) + # ls -lh modules/gmssl.so + ls -lh # Add debugging output to check if libgmssl.a exists + + - name: Upload Linux Artifacts + uses: actions/upload-artifact@v3 + with: + name: gmssl-linux-php-${{ matrix.php }} + path: php-${{ matrix.php }}/modules/gmssl.so diff --git a/.github/workflows/gmssl.yml b/.github/workflows/gmssl.yml deleted file mode 100644 index a3adb52..0000000 --- a/.github/workflows/gmssl.yml +++ /dev/null @@ -1,112 +0,0 @@ -name: Build GmSSL for PHP on Windows and CentOS - -on: - # push: - # branches: - # - main - workflow_dispatch: - -jobs: - build-linux: - name: Build on CentOS (PHP ${{ matrix.php }}) - runs-on: ubuntu-latest - strategy: - matrix: - php: [8.1.0] - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - # - name: Install dependencies for CentOS - # run: | - # sudo yum -y install gcc gcc-c++ cmake make wget php-devel libssl-dev - # sudo yum -y groupinstall "Development Tools" - - name: Install dependencies for Ubuntu - run: | - sudo apt-get update - sudo apt-get install -y gcc g++ cmake make wget php-dev libssl-dev - sudo apt-get install -y build-essential - - - name: Download and compile PHP ${{ matrix.php }} - run: | - wget https://www.php.net/distributions/php-${{ matrix.php }}.tar.gz - tar -xf php-${{ matrix.php }}.tar.gz - cd php-${{ matrix.php }} - ./configure --prefix=$HOME/php-${{ matrix.php }} --disable-all - make -j$(nproc) - make install - - - name: Download and compile GmSSL (static library) - run: | - git clone https://github.com/guanzhi/GmSSL.git - cd GmSSL - cmake -DBUILD_SHARED_LIBS=OFF . - make -j$(nproc) - ls -lh libgmssl.a - - - name: Build GmSSL PHP extension for PHP ${{ matrix.php }} - run: | - cd php-${{ matrix.php }} - $HOME/php-${{ matrix.php }}/bin/phpize - ./configure --with-php-config=$HOME/php-${{ matrix.php }}/bin/php-config --with-gmssl - make -j$(nproc) - ls -lh modules/gmssl.so - - - name: Upload Linux Artifacts - uses: actions/upload-artifact@v3 - with: - name: gmssl-linux-php-${{ matrix.php }} - path: php-${{ matrix.php }}/modules/gmssl.so - - build-windows: - name: Build on Windows (PHP ${{ matrix.php }}) - runs-on: windows-latest - strategy: - matrix: - php: [8.0.0] - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Install dependencies for Windows - run: | - choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' - choco install visualstudio2022buildtools --package-parameters "--includeRecommended" - - - name: Download and compile PHP ${{ matrix.php }} - env: - PHP_8_0_VS: '"Visual Studio 16 2019"' - PHP_8_1_VS: '"Visual Studio 16 2019"' - PHP_8_2_VS: '"Visual Studio 17 2022"' - run: | - $VisualStudio = if (${{ matrix.php }} -eq '8.0.0') { $env:PHP_8_0_VS } ` - elseif (${{ matrix.php }} -eq '8.1.0') { $env:PHP_8_1_VS } ` - else { $env:PHP_8_2_VS } - curl -O https://windows.php.net/downloads/releases/archives/php-${{ matrix.php }}-src.zip - Expand-Archive php-${{ matrix.php }}-src.zip -DestinationPath php-src - cd php-src - buildconf --force - configure --disable-all --enable-cli --with-vs=$VisualStudio - nmake - - - name: Download and compile GmSSL (static library) - run: | - git clone https://github.com/guanzhi/GmSSL.git - cd GmSSL - cmake -G $VisualStudio -A x64 -DBUILD_SHARED_LIBS=OFF . - cmake --build . --config Release - dir Release\libgmssl.lib - - - name: Build GmSSL PHP extension for PHP ${{ matrix.php }} - run: | - cd php-src - .\buildconf.bat - .\configure --with-php-config=$env:PHP_CONFIG --with-gmssl - nmake - dir Release\gmssl.dll - - - name: Upload Windows Artifacts - uses: actions/upload-artifact@v3 - with: - name: gmssl-windows-php-${{ matrix.php }} - path: php-src\Release\gmssl.dll