Skip to content

Commit

Permalink
Merge branch 'development' into #2255-php8.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/main.yml
#	.github/workflows/nightly.yml
  • Loading branch information
Jeckerson committed Dec 11, 2021
2 parents 3a7a34f + ff6c524 commit a5756d0
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 98 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/build-linux-ext/action.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: 'Zephir Stub PHP Extension Build'
description: 'Build Stub extension for Linux according to various php versions.'

inputs:
compiler:
description: 'compiler name'
required: false
default: 'gcc'

cflags:
description: 'CFLAGS for GCC compiler'
required: false
default: ''

ldflags:
description: 'LDFLAGS for Linker'
required: false
Expand All @@ -35,16 +38,12 @@ runs:
- name: Compile Stub Extension
shell: bash
env:
CC: ${{ inputs.compiler }}
CFLAGS: ${{ inputs.cflags }}
CXXFLAGS: ${{ inputs.cflags }}
LDFLAGS: ${{ inputs.ldflags }}
run: |
echo "::group::Configure compiler"
CC=${{ inputs.compiler }}
CFLAGS="${{ inputs.cflags }}"
CXXFLAGS="${{ inputs.cflags }}"
LDFLAGS="${{ inputs.ldflags }}"
export CC CFLAGS CXXFLAGS LDFLAGS
echo "::endgroup::"
echo "::group::Init stage"
php zephir fullclean
echo "::endgroup::"
Expand All @@ -56,6 +55,13 @@ runs:
echo "::group::Compile stage"
cd ./ext
phpize
./configure --enable-stub CFLAGS="${{ inputs.cflags }}" CXXFLAGS="${{ inputs.cflags }}" LDFLAGS="${{ inputs.ldflags }}"
make
./configure --enable-stub
make -j$(getconf _NPROCESSORS_ONLN)
echo "::endgroup::"
- name: Enable Stub Extension
shell: bash
run: |
sudo cp ./ext/modules/stub.so "$(php -r 'echo ini_get("extension_dir");')/stub.so"
echo "extension=stub.so" > ./ext-stub.ini
sudo cp ./ext-stub.ini /etc/php/${{ matrix.php }}/cli/conf.d/99-stub.ini
26 changes: 16 additions & 10 deletions .github/workflows/build-macos-ext/action.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
name: 'Zephir Stub PHP Extension Build'
description: 'Build Stub extension for macOS according to various php versions.'

inputs:
compiler:
description: 'compiler name'
required: false
default: 'clang'

cflags:
description: 'CFLAGS for GCC compiler'
required: false
default: ''

ldflags:
description: 'LDFLAGS for Linker'
required: false
Expand All @@ -28,15 +31,12 @@ runs:
- name: Compile Stub Extension
shell: bash
env:
CC: ${{ inputs.compiler }}
CFLAGS: ${{ inputs.cflags }}
CXXFLAGS: ${{ inputs.cflags }}
LDFLAGS: ${{ inputs.ldflags }}
run: |
echo "::group::Configure compiler"
CFLAGS="${{ inputs.cflags }}"
CXXFLAGS="${{ inputs.cflags }}"
LDFLAGS="${{ inputs.ldflags }}"
export CFLAGS CXXFLAGS LDFLAGS
echo "::endgroup::"
echo "::group::Init stage"
php zephir fullclean
echo "::endgroup::"
Expand All @@ -48,6 +48,12 @@ runs:
echo "::group::Compile stage"
cd ./ext
phpize
./configure --enable-stub CFLAGS="${{ inputs.cflags }}" CXXFLAGS="${{ inputs.cflags }}" LDFLAGS="${{ inputs.ldflags }}"
make
./configure --enable-stub
make -j$(getconf _NPROCESSORS_ONLN)
echo "::endgroup::"
- name: Enable Stub Extension
shell: bash
run: |
cp ./ext/modules/stub.so "$(php -r 'echo ini_get("extension_dir");')/stub.so"
echo "extension=stub.so" > /usr/local/etc/php/${{ matrix.php }}/conf.d/99-stub.ini
19 changes: 16 additions & 3 deletions .github/workflows/build-win-ext/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ runs:
}
Write-Output "::endgroup::"
- name: Setup PHP SDK tool kit
- name: Setup PHP SDK Tool Kit
uses: zephir-lang/setup-php-sdk@v1
with:
php_version: ${{ inputs.php_version }}
Expand All @@ -73,6 +73,16 @@ runs:
with:
arch: ${{ inputs.arch }}

# Workaround for Windows-2019 and PHP 7.4 with old msvc version
# PHP Warning: PHP Startup: Can't load module 'C:\tools\php\ext\php_stub.dll'
# as it's linked with 14.29, but the core is linked with 14.16 in Unknown on line 0
- name: Configure Developer Command Prompt for MSVC compiler
if: inputs.php_version == '7.4'
uses: ilammy/msvc-dev-cmd@v1.10.0
with:
arch: ${{ inputs.arch }}
toolset: 14.16

- name: Generate C code
shell: powershell
run: |
Expand All @@ -88,10 +98,13 @@ runs:
- name: Configure
shell: powershell
working-directory: ext
env:
CFLAGS: ${{ inputs.cflags }}
CXXFLAGS: ${{ inputs.cflags }}
LDFLAGS: ${{ inputs.ldflags }}
run: |
Write-Output "::group::Configure"
.\configure.bat --enable-stub --with-prefix=${{ env.PHP_ROOT }} `
CFLAGS="${{ inputs.cflags }}" CXXFLAGS="${{ inputs.cflags }}" LDFLAGS="${{ inputs.ldflags }}"
.\configure.bat --enable-stub --with-prefix=${{ env.PHP_ROOT }}
Write-Output "::endgroup::"
- name: Zephir compile
Expand Down
77 changes: 26 additions & 51 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ on:
- '**.md'
- '**.txt'
- '**/nightly.yml'
- '**/release.yml'
- '**/FUNDING.yml'
pull_request:
branches:
- master
- develoment
- development

env:
RE2C_VERSION: 2.2
ZEPHIR_PARSER_VERSION: 1.4.1
PSR_VERSION: 1.2.0
CACHE_DIR: .cache

jobs:
Expand Down Expand Up @@ -52,55 +55,32 @@ jobs:
run: shellcheck .ci/*.sh

build-and-test:
# To prevent build a particular commit use
# git commit -m "......... [ci skip]"
if: "!contains(github.event.head_commit.message, '[ci skip]')"
name: "PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.arch }}"

name: "PHP-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.arch }}"
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false

matrix:
php: ['7.4', '8.0', '8.1']
build_type: ['ts', 'nts']
arch: ['x64']
php: [ '7.4', '8.0' , '8.1' ]
ts: [ 'ts', 'nts' ]
arch: [ 'x64' ]

name:
- ubuntu-gcc
- macos-clang
- win2016-vc15
- win2019-vs16

# matrix names should be in next format:
# {php}-{ts}-{os.name}-{compiler}-{arch}
include:
# Linux
- name: ubuntu-gcc
os: ubuntu-18.04
compiler: gcc

- { name: ubuntu-gcc, os: ubuntu-18.04, compiler: gcc }
# macOS
- name: macos-clang
os: macos-10.15
compiler: clang

- { name: macos-clang, os: macos-10.15, compiler: clang }
# Windows
- name: win2016-vc15
os: windows-2016
compiler: vc15

- name: win2019-vs16
os: windows-2019
compiler: vs16

exclude:
- name: win2019-vs16
php: '7.4'

- name: win2016-vc15
php: '8.0'
- { php: '7.4', ts: 'ts', arch: 'x64', name: 'windows2019-vc15', os: 'windows-2019', compiler: 'vc15' }
- { php: '7.4', ts: 'nts', arch: 'x64', name: 'windows2019-vc15', os: 'windows-2019', compiler: 'vc15' }
- { php: '8.0', ts: 'ts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' }
- { php: '8.0', ts: 'nts', arch: 'x64', name: 'windows2019-vs16', os: 'windows-2019', compiler: 'vs16' }

- name: win2016-vc15
php: '8.1'
Expand All @@ -118,7 +98,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php }}'
extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr-1.2.0, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }}
extensions: mbstring, fileinfo, gmp, sqlite, pdo_sqlite, psr-${{ env.PSR_VERSION }}, zip, mysqli, zephir_parser-${{ env.ZEPHIR_PARSER_VERSION }}
tools: phpize, php-config
coverage: xdebug
# variables_order: https://github.com/zephir-lang/zephir/pull/1537
Expand All @@ -134,7 +114,7 @@ jobs:
date.timezone=UTC,
xdebug.max_nesting_level=256
env:
PHPTS: ${{ matrix.build_type }}
PHPTS: ${{ matrix.ts }}
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get composer cache directory
Expand Down Expand Up @@ -177,37 +157,32 @@ jobs:
uses: ./.github/workflows/build-win-ext
with:
php_version: ${{ matrix.php }}
ts: ${{ matrix.build_type }}
ts: ${{ matrix.ts }}
msvc: ${{ matrix.compiler }}
arch: ${{ matrix.arch }}
cflags: '/D ZEPHIR_RELEASE /Oi /Ot /Oy /Ob2 /Gs /GF /Gy /GL'
ldflags: '/LTCG'
env:
CACHE_DIR: 'C:\Downloads'
PHP_ROOT: 'C:\tools\php'

- name: Stub Extension Info
shell: pwsh
run: |
if ("${{ runner.os }}" -eq "Windows") {
php --ri stub
} else {
php -d extension=./ext/modules/stub.so --ri stub
}
php --ini
php --ri stub
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Unit Tests (Stub Extension)
shell: pwsh
run: |
if ("${{ runner.os }}" -eq "Windows") {
php vendor/bin/phpunit -c phpunit.ext.xml
} else {
php -d extension=./ext/modules/stub.so vendor/bin/phpunit -c phpunit.ext.xml
}
php vendor/bin/phpunit -c phpunit.ext.xml
- name: Unit Tests (Zephir)
if: always()
run: vendor/bin/phpunit --testsuite Zephir
run: php vendor/bin/phpunit --testsuite Zephir
env:
XDEBUG_MODE: coverage

Expand All @@ -223,19 +198,19 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./tests/output/clover.xml
flags: unittests,${{ matrix.name }},php-${{ matrix.php }}
flags: unittests,${{ runner.os }},php-${{ matrix.php }}
name: codecov-umbrella

- name: Upload build artifacts after Failure
if: failure()
uses: actions/upload-artifact@v2
with:
name: debug-${{ matrix.name }}-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.compiler }}-${{ matrix.arch }}
name: debug-PHP-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.arch }}
path: |
${{ github.workspace }}/*.log
${{ github.workspace }}/ext/
!${{ github.workspace }}/ext/kernel/
!${{ github.workspace }}/ext/stub/
!${{ github.workspace }}/ext/Release/
!${{ github.workspace }}/ext/x64/Release/
retention-days: 1
retention-days: 7
Loading

0 comments on commit a5756d0

Please sign in to comment.