From 7445acd3eb7cab4cfb815e115391c6a79fb152cb Mon Sep 17 00:00:00 2001 From: SergeySeroshtan Date: Thu, 25 Apr 2024 23:09:52 -0400 Subject: [PATCH] Extend PHP builds to github actions 3 --- .github/workflows/build-linux-php.yml | 53 +++++++++++++++++++ .../{build-php.yml => build-macos-php.yml} | 17 +++--- 2 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/build-linux-php.yml rename .github/workflows/{build-php.yml => build-macos-php.yml} (84%) diff --git a/.github/workflows/build-linux-php.yml b/.github/workflows/build-linux-php.yml new file mode 100644 index 000000000..fb8648f73 --- /dev/null +++ b/.github/workflows/build-linux-php.yml @@ -0,0 +1,53 @@ +name: build-php-linux +on: + push: + branches: + - "**" + tags: + - "*" +jobs: + build-php: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + php-version: ["8.2", "8.3", "8.4"] + arch: [x86_64] + name: PHP ${{ matrix.php-version }} build on ${{ matrix.os }} for arch ${{ matrix.arch }} + steps: + - name: Install PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + - name: Check PHP Version + run: php -v + - uses: actions/checkout@v3 + - name: Configure toolchain + run: | + cmake --version + python3 --version + pip3 list --outdated + pip3 install -U protobuf grpcio-tools + - name: Configure project + run: > + cmake -Cconfigs/php-config.cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DVIRGIL_PACKAGE_PLATFORM_ARCH=${{ matrix.arch }} \ + -DVIRGIL_PACKAGE_LANGUAGE_VERSION=${{ matrix.php-version }} \ + -DCPACK_OUTPUT_FILE_PREFIX=php \ + -DENABLE_CLANGFORMAT=OFF \ + -DED25519_REF10=OFF -DED25519_AMD64_RADIX_64_24K=ON \ + -Bbuild -S. + - name: Build project + run: cmake --build build -- -j$(nproc) + - name: Test project + working-directory: build + run: ctest --verbose + - name: Package project + working-directory: build + run: cpack + - name: Attach artifacts to the release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: build/php/*.tar.gz diff --git a/.github/workflows/build-php.yml b/.github/workflows/build-macos-php.yml similarity index 84% rename from .github/workflows/build-php.yml rename to .github/workflows/build-macos-php.yml index 9cc478e89..386a1e24f 100644 --- a/.github/workflows/build-php.yml +++ b/.github/workflows/build-macos-php.yml @@ -1,4 +1,4 @@ -name: build-php +name: build-php-macos on: push: branches: @@ -6,17 +6,17 @@ on: tags: - "*" jobs: - build-php: + build-php-macos: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [macos-latest] php-version: ["8.2", "8.3", "8.4"] + arch: [x86_64, arm64] include: - arch: x86_64 optimizations: -DED25519_REF10=OFF -DED25519_AMD64_RADIX_64_24K=ON - - os: macos-latest - arch: arm64 + - arch: arm64 optimizations: -DED25519_REF10=ON name: PHP ${{ matrix.php-version }} build on ${{ matrix.os }} for arch ${{ matrix.arch }} steps: @@ -31,13 +31,12 @@ jobs: run: | cmake --version python3 --version - pip3 list --outdated - pip3 install -U protobuf grpcio-tools - php --version + pip3 install protobuf grpcio-tools - name: Configure project run: > cmake -Cconfigs/php-config.cmake \ -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \ -DVIRGIL_PACKAGE_PLATFORM_ARCH=${{ matrix.arch }} \ -DVIRGIL_PACKAGE_LANGUAGE_VERSION=${{ matrix.php-version }} \ -DCPACK_OUTPUT_FILE_PREFIX=php \ @@ -45,7 +44,7 @@ jobs: ${{ matrix.optimizations }} \ -Bbuild -S. - name: Build project - run: cmake --build build -- -j$(nproc) + run: cmake --build build -- -j$(sysctl -n hw.physicalcpu) - name: Test project working-directory: build run: ctest --verbose