Skip to content

Merge pull request #464 from php/1.3.x #821

Merge pull request #464 from php/1.3.x

Merge pull request #464 from php/1.3.x #821

name: "Continuous Integration"
on:
pull_request:
push:
permissions:
contents: read
jobs:
unit-tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system:
- ubuntu-latest
- windows-latest
php-versions:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: intl, sodium, zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v6
- uses: ramsey/composer-install@v3
- name: GH token (non-Windows)
if: matrix.operating-system != 'windows-latest'
run: sudo composer config --global --auth github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: GH token (Windows)
if: matrix.operating-system == 'windows-latest'
run: composer config --global --auth github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Run PHPUnit on Windows
if: matrix.operating-system == 'windows-latest'
run: vendor/bin/phpunit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run PHPUnit on non-Windows
if: matrix.operating-system != 'windows-latest'
run: sudo vendor/bin/phpunit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
bundled-php-extension-tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system:
- ubuntu-latest
php-versions:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'
steps:
- name: "Purge built-in PHP version"
run: |
echo "libmemcached11 php* hhvm libhashkit2" | xargs -n 1 sudo apt-get purge --assume-yes || true
sudo apt-add-repository --remove ppa:ondrej/php -y
- name: Install platform dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
g++ gcc make autoconf libtool bison re2c pkg-config unzip \
libcurl4-openssl-dev \
liblmdb-dev \
libdb-dev \
libqdbm-dev \
libenchant-2-dev \
libexif-dev \
libgd-dev \
libpng-dev \
libtiff-dev \
libfreetype-dev \
libfreetype6 \
libfontconfig1-dev \
libgmp-dev \
libssl-dev \
libsodium-dev \
libxml2-dev \
libonig-dev \
libldap-dev \
libedit-dev \
libsnmp-dev \
libtidy-dev \
libxslt1-dev \
libsasl2-dev \
libpq-dev \
libsqlite3-dev \
libbz2-dev \
libzip-dev
- name: "Set php-src download URL"
run: |
DIST_URL=`curl -fsSL "https://www.php.net/releases/index.php?json&max=1&version=${{ matrix.php-versions }}" | jq -r '.[].source[]|select(.filename|endswith(".gz")).filename'`
echo "php_src_download_url=https://www.php.net/distributions/$DIST_URL" >> $GITHUB_ENV
- name: "Install PHP ${{ matrix.php-versions }}"
run: |
mkdir -p /tmp/php
mkdir -p /tmp/php.ini.d
cd /tmp/php
echo "Downloading release from ${{ env.php_src_download_url }} ..."
wget -O php.tgz ${{ env.php_src_download_url }}
tar zxf php.tgz
rm php.tgz
ls -l
cd *
ls -l
./buildconf --force
./configure --disable-dom --disable-xml --disable-xmlreader --disable-xmlwriter --disable-json --with-openssl --with-config-file-scan-dir=/tmp/php.ini.d
make -j$(nproc)
sudo make install
cd $GITHUB_WORKSPACE
- uses: actions/checkout@v6
- name: Composer Install
run: composer install --ignore-platform-reqs
- name: Run bundled PHP install test
run: sudo php test/install-bundled-php-exts.php php-config
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
behaviour-tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system:
- ubuntu-latest
php-versions:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
# Fixes `git describe` picking the wrong tag - see https://github.com/php/pie/issues/307
- run: git fetch --tags --force
# Ensure some kind of previous tag exists, otherwise box fails
- run: git describe --tags HEAD || git tag 0.0.0
- uses: ramsey/composer-install@v3
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: docker buildx build --file .github/pie-behaviour-tests/Dockerfile --secret id=GITHUB_TOKEN,env=GITHUB_TOKEN --build-arg PHP_VERSION=${{ matrix.php-versions }} -t pie-behat-test .
- name: Run Behat
run: docker run --volume .:/github/workspace pie-behat-test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
coding-standards:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: intl, sodium, zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v6
- uses: ramsey/composer-install@v3
- name: Run PHPCS
run: vendor/bin/phpcs
static-analysis:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: intl, sodium, zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v6
- uses: ramsey/composer-install@v3
- name: Validate the composer configuration
run: composer validate --strict
- name: Run phpstan
run: vendor/bin/phpstan
build-phar:
needs:
- unit-tests
- coding-standards
- static-analysis
# See build-phar.yml for a list of the permissions and why they are needed
permissions:
contents: read
id-token: write
attestations: write
uses: ./.github/workflows/build-phar.yml