1- name : Windows
1+ name : Zephir Parser CI
22
33on :
4+ schedule :
5+ - cron : ' 0 2 * * *' # Daily at 02:00 runs only on default branch
46 push :
57 branches-ignore :
68 - ' wip-*'
79 paths-ignore :
810 - ' *.md'
9-
10- # pull_request:
11- # branches:
12- # - master
13- # - development
14-
15- # schedule:
16- # - cron: '0 11 * * *'
11+ pull_request :
12+ paths-ignore :
13+ - ' *.md'
14+ branches :
15+ - master
16+ - development
1717
1818env :
19+ RE2C_VERSION : 2.2
1920 PHP_SDK_VERSION : 2.2.0
2021 PHP_DEVPACK : C:\tools\php-devpack
2122 PHP_SDK_PATH : C:\tools\php-sdk
2223 EXTENSION_FILE : php_zephir_parser.dll
2324
2425jobs :
25- ci :
26+ windows-builds :
27+ # To prevent build a particular commit use
28+ # git commit -m "......... [win skip] - skip Windows builds only"
29+ # git commit -m "......... [ci skip] - skip all builds"
30+ if : " !contains(github.event.head_commit.message, '[win skip]') || !contains(github.event.head_commit.message, '[ci skip]') "
31+
2632 strategy :
2733 fail-fast : false
2834
@@ -186,7 +192,7 @@ jobs:
186192 - name : Upload Zephir Parser
187193 uses : actions/upload-artifact@v2
188194 with :
189- name : zephir-parser-php-${{ matrix.php }}-${{ matrix.build_type }}-win32-${{ matrix.vc_prefix }}${{ matrix.vc_num }}-${{ matrix.arch }}
195+ name : zephir-parser-php-${{ matrix.php }}-${{ matrix.build_type }}-win32-${{ matrix.vc_prefix }}${{ matrix.vc_num }}-${{ matrix.arch }}.zip
190196 path : |
191197 ${{ github.workspace }}\zephir-parser-*.zip
192198
@@ -200,7 +206,7 @@ jobs:
200206 Get-Content -Path "${env:GITHUB_WORKSPACE}\${BaseName}.log"
201207 }
202208
203- - name : Upload Infor for Debug on Fail
209+ - name : Upload Info for Debug on Fail
204210 if : failure()
205211 uses : actions/upload-artifact@v2
206212 with :
@@ -211,3 +217,187 @@ jobs:
211217 ${{ github.workspace }}\parser
212218 ${{ github.workspace }}\Release*
213219 ${{ github.workspace }}\**\Release*
220+
221+ unix-builds :
222+ # To prevent build a particular commit use
223+ # git commit -m "......... [unix skip] - skip Linux & macOS builds only"
224+ # git commit -m "......... [ci skip] - skip all builds"
225+ if : " !contains(github.event.head_commit.message, '[unix skip]') || !contains(github.event.head_commit.message, '[ci skip]') "
226+
227+ strategy :
228+ fail-fast : false
229+
230+ matrix :
231+ php : ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
232+ arch : ['x64']
233+ build_type : ['nts']
234+ name :
235+ - ubuntu
236+ - macos
237+
238+ include :
239+ - name : ubuntu
240+ os : ubuntu-18.04
241+ ccov : ON
242+ compiler : gcc
243+
244+ - name : macos
245+ os : macos-latest
246+ ccov : OFF
247+ compiler : clang
248+
249+ name : " PHP-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.compiler }}-${{ matrix.arch }}"
250+ runs-on : ${{ matrix.os }}
251+
252+ env :
253+ HOMEBREW_NO_INSTALL_CLEANUP : 1
254+ ZEND_DONT_UNLOAD_MODULES : 1
255+ USE_ZEND_ALLOC : 0
256+
257+ steps :
258+ - uses : actions/checkout@v2
259+ with :
260+ fetch-depth : 5
261+
262+ - name : Install PHP ${{ matrix.php }}
263+ uses : shivammathur/setup-php@v2
264+ with :
265+ php-version : ' ${{ matrix.php }}'
266+ coverage : none
267+ env :
268+ PHPTS : ${{ matrix.build_type }}
269+
270+ - name : Cache RE2C Downloads
271+ uses : actions/cache@v2
272+ with :
273+ path : ~/.cache/re2c
274+ key : ${{ runner.os }}-php-${{ matrix.php }}-re2c-${{env.RE2C_VERSION}}
275+
276+ - name : Setup Prerequisites (Linux)
277+ if : runner.os == 'Linux'
278+ run : |
279+ sudo apt-get update --quiet --yes 1>/dev/null
280+ sudo apt-get install --no-install-recommends --quiet --yes lcov gdb
281+
282+ - name : Setup Prerequisites (macOS)
283+ if : runner.os == 'macOS' && matrix.ccov == 'ON'
284+ run : |
285+ brew install lcov
286+ sudo xcode-select -switch /Applications/Xcode.app
287+
288+ - name : Setup Build System (Generic)
289+ run : |
290+ ulimit -c unlimited -S || true
291+
292+ mkdir -p $HOME/.cache/re2c
293+ mkdir -p $HOME/.local/opt/re2c
294+
295+ echo "PATH=$PATH:$HOME/bin:$(brew --prefix lcov)/bin" >> $GITHUB_ENV
296+ echo "MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN)" >> $GITHUB_ENV
297+ echo "CI=true" >> $GITHUB_ENV
298+ echo "ZEPHIR_PARSER_VERSION=$(head -1 VERSION)" >> $GITHUB_ENV
299+
300+ - name : Setup Core Dump (Linux)
301+ if : runner.os == 'Linux'
302+ run : echo '/tmp/core.%e.%p.%t' | sudo tee /proc/sys/kernel/core_pattern
303+
304+ - name : Install re2c
305+ run : .ci/install-re2c.sh
306+
307+ - name : Build extensions
308+ run : |
309+ phpize
310+
311+ if [ "${{ matrix.ccov }}" = "ON" ]; then
312+ ./configure \
313+ --enable-zephir-parser \
314+ --enable-zephir-parser-debug \
315+ --enable-coverage
316+ else
317+ ./configure \
318+ --enable-zephir-parser \
319+ --enable-zephir-parser-debug
320+ fi
321+
322+ make -j$(getconf _NPROCESSORS_ONLN)
323+
324+ - name : Preparing to collect coverage data
325+ if : matrix.ccov == 'ON'
326+ run : make coverage-initial
327+
328+ - name : Run Tests
329+ run : |
330+ php -d extension=./modules/zephir_parser.so --ri 'Zephir Parser'
331+ make test NO_INTERACTION=1 REPORT_EXIT_STATUS=1
332+
333+ - name : Print failures
334+ if : failure() && runner.os == 'Linux'
335+ run : .ci/after-failure.sh
336+
337+ - name : Capture coverage data
338+ if : success() && matrix.ccov == 'ON'
339+ run : make coverage-capture
340+
341+ - name : Prepare Build Artifacts
342+ working-directory : modules
343+ run : |
344+ echo "-- Creating ZIP with Zephir Parser extension"
345+ zip -rv zephir-parser-php-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.compiler }}-${{ matrix.arch }}.zip ./*.so
346+
347+ - name : Upload code coverage report
348+ if : matrix.ccov == 'ON'
349+ uses : codecov/codecov-action@v1
350+ with :
351+ token : ${{secrets.CODECOV_TOKEN}}
352+ file : ./lcov.info
353+ flags : unittests
354+ fail_ci_if_error : false
355+
356+ - name : Upload Zephir Parser
357+ uses : actions/upload-artifact@v2
358+ with :
359+ name : zephir-parser-php-${{ matrix.php }}-${{ matrix.build_type }}-${{ matrix.name }}-${{ matrix.compiler }}-${{ matrix.arch }}.zip
360+ path : |
361+ ${{ github.workspace }}/modules/*.zip
362+
363+ release :
364+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
365+
366+ needs : [windows-builds, unix-builds]
367+ name : Create Release
368+ runs-on : ubuntu-20.04
369+
370+ steps :
371+ - name : Checkout Code
372+ uses : actions/checkout@v2
373+ with :
374+ fetch-depth : 1
375+
376+ - name : Get the release version
377+ id : get-version
378+ run : |
379+ echo ::set-output name=version::${GITHUB_REF#refs/tags/}
380+
381+ - name : Download Zephir Parser build artifacts
382+ id : download
383+ uses : actions/download-artifact@v2
384+ with :
385+ path : ./build-artifacts
386+
387+ - name : Prepare Release assets
388+ run : |
389+ mkdir -p ./build-artifacts/release
390+ find ./build-artifacts -type f -name zephir-parser*.zip -exec cp {} ./build-artifacts/release/ ";"
391+ echo "-- Creating Release Notes"
392+ GITHUB_ACTIONS=false ./.ci/release-notes.sh ./CHANGELOG.md > ./build-artifacts/release/release-notes.md
393+
394+ - name : Create Release
395+ uses : ncipollo/release-action@v1
396+ with :
397+ token : ${{ secrets.GITHUB_TOKEN }}
398+ name : ${{ steps.get-version.outputs.version }}
399+ tag : ${{ steps.get-version.outputs.version }}
400+ bodyFile : " ./build-artifacts/release/release-notes.md"
401+ allowUpdates : true
402+ artifacts : " ./build-artifacts/release/*.zip"
403+ artifactContentType : application/octet-stream
0 commit comments