Skip to content

Commit 046b965

Browse files
ArshidArshid
authored andcommitted
composer added
1 parent 10d0726 commit 046b965

1 file changed

Lines changed: 101 additions & 16 deletions

File tree

.github/workflows/main.yml

Lines changed: 101 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,102 @@
1+
name: Tests and Release Artifacts
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
release:
9+
types: [created]
10+
create:
11+
112
jobs:
2-
php:
3-
strategy:
4-
matrix:
5-
arch: [x64, x86]
6-
ts: [nts, ts]
7-
runs-on: windows-2022
8-
steps:
9-
- name: Checkout
10-
uses: actions/checkout@v4
11-
12-
- name: Build
13-
uses: php/php-windows-builder/php@v1
14-
with:
15-
php-version: '8.4.1'
16-
arch: ${{ matrix.arch }}
17-
ts: ${{ matrix.ts }}
13+
get-extension-matrix:
14+
runs-on: ubuntu-latest
15+
name: "Windows Build Matrix"
16+
outputs:
17+
matrix: ${{ steps.extension-matrix.outputs.matrix }}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
- name: Get The Extension Matrix
22+
id: extension-matrix
23+
uses: php/php-windows-builder/extension-matrix@v1
24+
with:
25+
php-version-list: '8.0, 8.1, 8.2, 8.3, 8.4'
26+
arch-list: 'x64'
27+
28+
windows:
29+
needs: get-extension-matrix
30+
runs-on: ${{ matrix.os }}
31+
name: "Windows"
32+
strategy:
33+
matrix: ${{fromJson(needs.get-extension-matrix.outputs.matrix)}}
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
- name: Build The Extension
38+
uses: php/php-windows-builder/extension@v1
39+
with:
40+
php-version: ${{ matrix.php-version }}
41+
arch: ${{ matrix.arch }}
42+
ts: ${{ matrix.ts }}
43+
args: --with-traitify
44+
45+
linux:
46+
runs-on: ubuntu-latest
47+
name: "Linux"
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
php: [8.0, 8.1, 8.2, 8.3, 8.4, 8.5]
52+
use-opcache: [true, false]
53+
experimental: [false]
54+
steps:
55+
- uses: actions/checkout@v4
56+
57+
- name: Setup PHP
58+
uses: shivammathur/setup-php@v2
59+
with:
60+
php-version: "${{ matrix.php }}"
61+
coverage: none
62+
ini-values: "session.save_path=/tmp"
63+
tools: pecl
64+
extensions: xmlreader
65+
66+
- name: Compile
67+
run: ./.build.scripts/compile.sh
68+
69+
- name: Find PHP
70+
run: |
71+
TEST_PHP_EXECUTABLE=`make findphp`
72+
echo "Found PHP in: $TEST_PHP_EXECUTABLE"
73+
echo "TEST_PHP_EXECUTABLE=$TEST_PHP_EXECUTABLE" >> $GITHUB_ENV
74+
75+
- name: Define PHP arguments
76+
run: |
77+
TEST_PHP_ARGS="-n -d foo=yes -d session.save_path=/tmp"
78+
[[ "${{ matrix.use-opcache }}" != "true" ]] || TEST_PHP_ARGS="$TEST_PHP_ARGS -d zend_extension=opcache.so -d opcache.enable=1 -d opcache.enable_cli=1"
79+
TEST_PHP_ARGS="$TEST_PHP_ARGS -d zend_extension=$PWD/modules/traitify.so"
80+
echo "Test PHP arguments: $TEST_PHP_ARGS"
81+
echo "TEST_PHP_ARGS=$TEST_PHP_ARGS" >> $GITHUB_ENV
82+
83+
- name: Run tests
84+
continue-on-error: ${{ matrix.experimental }}
85+
run: |
86+
$TEST_PHP_EXECUTABLE $TEST_PHP_ARGS -v
87+
88+
- name: Show errors
89+
if: ${{ failure() }}
90+
run: ./.build.scripts/show-errors.sh
91+
92+
release:
93+
runs-on: ubuntu-latest
94+
name: "PIE Release Artifacts"
95+
needs: windows
96+
if: ${{ github.event_name == 'release' }}
97+
steps:
98+
- name: Upload artifact to the release
99+
uses: php/php-windows-builder/release@v1
100+
with:
101+
release: ${{ github.event.release.tag_name }}
102+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)