From 0e33cbb11485458737bf38e37121dcc8733386fd Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 11 Oct 2026 16:12:24 +0000 Subject: [PATCH] (0.10.x) - Add GitHub Actions CI workflow Set up a GitHub Actions matrix to build and load the extension on Ubuntu and macOS across PHP 8.4/8.5 in both NTS and ZTS modes. Box2D 3.1.1 is vendored and compiled into the module, so no system library install is needed. Also add a CI status badge to the README. Co-authored-by: Angel Gonzalez --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 41 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1b49805 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + build: + name: PHP ${{ matrix.php }} ${{ matrix.ts }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-24.04, macos-15] + php: ['8.4', '8.5'] + ts: [nts, zts] + + steps: + - uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: none + env: + phpts: ${{ matrix.ts == 'zts' && 'ts' || 'nts' }} + + - name: Build + # Box2D 3.1.1 is vendored under lib/box2d/ and compiled into the module. + run: | + phpize + ./configure --enable-box2d + make -j"$(nproc 2>/dev/null || sysctl -n hw.ncpu)" + + - name: Load + run: | + php -n -d extension="$PWD/modules/box2d.so" -r 'exit(extension_loaded("box2d") ? 0 : 1);' + php -n -d extension="$PWD/modules/box2d.so" --ri box2d diff --git a/README.md b/README.md index 1fdbe4a..16e5804 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # ext-box2d +[![CI](https://img.shields.io/github/actions/workflow/status/php-io-extensions/box2d/ci.yml?style=flat-square&label=CI)](https://github.com/php-io-extensions/box2d/actions/workflows/ci.yml) [![Latest Version on Packagist](https://img.shields.io/packagist/v/php-io-extensions/box2d.svg)](https://packagist.org/packages/php-io-extensions/box2d) [![License](https://img.shields.io/packagist/l/php-io-extensions/box2d.svg)](LICENSE)